COMMIT_MESSAGE

 1matchMedia() MediaQueryList not updating
 2https://bugs.webkit.org/show_bug.cgi?id=75903
 3
 4Reviewed by NOBODY (OOPS!).
 5
 6Source/WebCore:
 7
 8Viewport related MediaQueryList listeners were not triggered and the value
 9of matches were not updated if the document's style selector were not
 10affected by viewport changes.
 11
 12The new mehotd Document::viewportDependentStyleSelectorChange updates the
 13MediaQueryLists but it does nothing else if the style selector is not
 14affected by viewport changes.
 15
 16* dom/Document.cpp:
 17(WebCore::Document::viewportDependentStyleSelectorChange):
 18(WebCore):
 19(WebCore::Document::styleSelectorChanged):
 20(WebCore::Document::updateStyleSelector):
 21* dom/Document.h:
 22(Document):
 23
 24Document::viewportDependentStyleSelectorChange is used in FrameView::layout
 25allowing the MediaQueryLists to be updated when the viewport changes.
 26
 27* page/FrameView.cpp:
 28(WebCore::FrameView::layout):
 29
 30Test: fast/media/media-query-list-08.html
 31
 32LayoutTests:
 33
 34Testing MediaQueryLists listeners related to viewport changes.
 35
 36* fast/media/media-query-list-08-expected.txt: Added.
 37* fast/media/media-query-list-08.html: Added.
 38
 39Skipping the new test in Qt due to an issue in its DumpRenderTree.
 40
 41* platform/qt/Skipped:

LayoutTests/ChangeLog

 12012-02-22 Luiz Agostini <luiz.agostini@palm.com>
 2
 3 matchMedia() MediaQueryList not updating
 4 https://bugs.webkit.org/show_bug.cgi?id=75903
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Testing MediaQueryLists listeners related to viewport changes.
 9
 10 * fast/media/media-query-list-08-expected.txt: Added.
 11 * fast/media/media-query-list-08.html: Added.
 12
 13 Skipping the new test in Qt due to an issue in its DumpRenderTree.
 14
 15 * platform/qt/Skipped:
 16
1172012-02-23 Adrienne Walker <enne@google.com>
218
319 [chromium] Unreviewed gardening. Mark two fast/files/ tests as non-flaky.

LayoutTests/fast/media/media-query-list-08-expected.txt

 1Test the MediaQueryList interface: http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface.
 2
 3Testing viewport related callbacks
 4
 5PASS
 6

LayoutTests/fast/media/media-query-list-08.html

 1<html>
 2<head>
 3<title>Test CSSOM View module: MediaQueryList interface</title>
 4<script type="text/javascript" charset="utf-8">
 5 if (window.layoutTestController) {
 6 layoutTestController.dumpAsText();
 7 layoutTestController.waitUntilDone();
 8 }
 9
 10 function log(m) {
 11 document.getElementById('results').innerHTML += m + '<br>';
 12 }
 13
 14 function callback(query) {
 15 log("PASS");
 16 if (window.layoutTestController)
 17 layoutTestController.notifyDone();
 18 }
 19
 20 function runTests()
 21 {
 22 window.matchMedia("(max-width: 250px)").addListener(callback);
 23 window.resizeTo(200, 300);
 24 }
 25
 26</script>
 27</head>
 28<body onload="runTests()">
 29 <p>Test the MediaQueryList interface: <a href="http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface" title="CSSOM View Module">http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface</a>.</p>
 30 <p>Testing viewport related callbacks</p>
 31 <div id="results">
 32 </div>
 33</body>
 34</html>

LayoutTests/platform/qt/Skipped

@@fast/repaint/background-clip-text.html
10311031# Needs layoutTestController.enableAutoResizeMode()
10321032fast/autoresize
10331033
 1034# window.resizeTo() does not trigger a relayout in our DumpRenderTree
 1035fast/media/media-query-list-08.html
 1036
10341037# This requires didClearWindowObjectForFrameInIsolatedWorld foo in FrameLoaderClient
10351038http/tests/security/isolatedWorld/didClearWindowObject.html
10361039# This needs more investigation

Source/WebCore/ChangeLog

 12012-02-23 Luiz Agostini <luiz.agostini@palm.com>
 2
 3 matchMedia() MediaQueryList not updating
 4 https://bugs.webkit.org/show_bug.cgi?id=75903
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Viewport related MediaQueryList listeners were not triggered and the value
 9 of matches were not updated if the document's style selector were not
 10 affected by viewport changes.
 11
 12 The new mehotd Document::viewportDependentStyleSelectorChange updates the
 13 MediaQueryLists but it does nothing else if the style selector is not
 14 affected by viewport changes.
 15
 16 * dom/Document.cpp:
 17 (WebCore::Document::viewportDependentStyleSelectorChange):
 18 (WebCore):
 19 (WebCore::Document::styleSelectorChanged):
 20 (WebCore::Document::updateStyleSelector):
 21 * dom/Document.h:
 22 (Document):
 23
 24 Document::viewportDependentStyleSelectorChange is used in FrameView::layout
 25 allowing the MediaQueryLists to be updated when the viewport changes.
 26
 27 * page/FrameView.cpp:
 28 (WebCore::FrameView::layout):
 29
 30 Test: fast/media/media-query-list-08.html
 31
1322012-02-23 Zoltan Horvath <zoltan@webkit.org>
233
334 [Qt] Allow to use WebCore imagedecoders

Source/WebCore/dom/Document.cpp

@@void Document::removePendingSheet()
30273027 view()->scrollToFragment(m_url);
30283028}
30293029
 3030void Document::viewportDependentStyleSelectorChange(StyleSelectorUpdateFlag updateFlag)
 3031{
 3032 if (styleSelector()->affectedByViewportChange()) {
 3033 // Viewport-dependent media queries may cause us to need completely different style information.
 3034 // Check that here.
 3035 updateStyleSelector(updateFlag);
 3036 InspectorInstrumentation::mediaQueryResultChanged(this);
 3037 }
 3038 if (m_mediaQueryMatcher)
 3039 m_mediaQueryMatcher->styleSelectorChanged();
 3040}
 3041
30303042void Document::styleSelectorChanged(StyleSelectorUpdateFlag updateFlag)
30313043{
 3044 updateStyleSelector(updateFlag);
 3045 if (m_mediaQueryMatcher)
 3046 m_mediaQueryMatcher->styleSelectorChanged();
 3047}
 3048
 3049void Document::updateStyleSelector(StyleSelectorUpdateFlag updateFlag)
 3050{
30323051 // Don't bother updating, since we haven't loaded all our style info yet
30333052 // and haven't calculated the style selector for the first time.
30343053 if (!attached() || (!m_didCalculateStyleSelector && !haveStylesheetsLoaded())) {

@@void Document::styleSelectorChanged(StyleSelectorUpdateFlag updateFlag)
30743093 if (view())
30753094 view()->scheduleRelayout();
30763095 }
3077 
3078  if (m_mediaQueryMatcher)
3079  m_mediaQueryMatcher->styleSelectorChanged();
30803096}
30813097
30823098void Document::addStyleSheetCandidateNode(Node* node, bool createdByParser)

Source/WebCore/dom/Document.h

@@public:
493493 * found and is used to calculate the derived styles for all rendering objects.
494494 */
495495 void styleSelectorChanged(StyleSelectorUpdateFlag);
 496 void viewportDependentStyleSelectorChange(StyleSelectorUpdateFlag);
496497
497498 bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRulesOverride; }
498499 void setUsesSiblingRules(bool b) { m_usesSiblingRulesOverride = b; }

@@private:
11901191
11911192 static void didReceiveTask(void*);
11921193
 1194 void updateStyleSelector(StyleSelectorUpdateFlag);
 1195
11931196#if ENABLE(PAGE_VISIBILITY_API)
11941197 PageVisibilityState visibilityState() const;
11951198#endif

Source/WebCore/page/FrameView.cpp

@@void FrameView::layout(bool allowSubtree)
970970 m_inSynchronousPostLayout = false;
971971 }
972972
973  // Viewport-dependent media queries may cause us to need completely different style information.
974  // Check that here.
975  if (document->styleSelector()->affectedByViewportChange()) {
976  document->styleSelectorChanged(RecalcStyleImmediately);
977  InspectorInstrumentation::mediaQueryResultChanged(document);
978  }
 973 document->viewportDependentStyleSelectorChange(RecalcStyleImmediately);
979974
980975 // Always ensure our style info is up-to-date. This can happen in situations where
981976 // the layout beats any sort of style recalc update that needs to occur.