Commit ef75e9e9 authored by antti@apple.com's avatar antti@apple.com
Browse files

matchMedia() MediaQueryList not updating

https://bugs.webkit.org/show_bug.cgi?id=75903

Patch by Luiz Agostini <luiz.agostini@palm.com> on 2012-04-18
Reviewed by Antti Koivisto.

Source/WebCore: 

Test: fast/media/media-query-list-08.html

Viewport related MediaQueryList listeners were not triggered and the value
of matches were not updated if the document's style selector were not
affected by viewport changes.

The new method evaluateMediaQueries() is now called by FrameView instead of
styleSelectorChanged() if the style selector is not affected by viewport changes.

* dom/Document.cpp:
(WebCore::Document::evaluateMediaQueries):
(WebCore):
(WebCore::Document::styleSelectorChanged):
* dom/Document.h:
(Document):
* page/FrameView.cpp:
(WebCore::FrameView::layout):

LayoutTests: 

Testing MediaQueryLists listeners related to viewport changes.

* fast/media/media-query-list-08-expected.txt: Added.
* fast/media/media-query-list-08.html: Added.

Skipping the new test in Mac and Qt due to an issue in its DumpRenderTree.

* platform/qt/Skipped:
* platform/mac/Skipped:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114538 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 21eb8999
2012-04-18 Luiz Agostini <luiz.agostini@palm.com>
matchMedia() MediaQueryList not updating
https://bugs.webkit.org/show_bug.cgi?id=75903
Reviewed by Antti Koivisto.
Testing MediaQueryLists listeners related to viewport changes.
* fast/media/media-query-list-08-expected.txt: Added.
* fast/media/media-query-list-08.html: Added.
Skipping the new test in Mac and Qt due to an issue in its DumpRenderTree.
* platform/qt/Skipped:
* platform/mac/Skipped:
2012-04-18 Philippe Normand <pnormand@igalia.com>
 
Unreviewed, GTK test_expectations update.
......@@ -785,6 +785,7 @@ fast/animation/request-animation-frame-during-modal.html
# window.resizeTo() does not seem to work as expected in Mac DRT. The outerWidth changes after a resizeTo()
# but not the innerWidth. The test passes on Qt, GTK and Chromium.
fast/css/align-positioned-object-on-resize.html
fast/media/media-query-list-08.html
# https://bugs.webkit.org/show_bug.cgi?id=83618
fast/dom/inline-event-attributes-release.html
......
......@@ -1112,6 +1112,9 @@ fast/autoresize
fast/canvas/2d.backingStorePixelRatio.html
fast/canvas/2d.imageDataHD.html
# window.resizeTo() does not trigger a relayout in our DumpRenderTree
fast/media/media-query-list-08.html
# This requires didClearWindowObjectForFrameInIsolatedWorld foo in FrameLoaderClient
http/tests/security/isolatedWorld/didClearWindowObject.html
# This needs more investigation
......
2012-04-18 Luiz Agostini <luiz.agostini@palm.com>
matchMedia() MediaQueryList not updating
https://bugs.webkit.org/show_bug.cgi?id=75903
Reviewed by Antti Koivisto.
Test: fast/media/media-query-list-08.html
Viewport related MediaQueryList listeners were not triggered and the value
of matches were not updated if the document's style selector were not
affected by viewport changes.
The new method evaluateMediaQueries() is now called by FrameView instead of
styleSelectorChanged() if the style selector is not affected by viewport changes.
* dom/Document.cpp:
(WebCore::Document::evaluateMediaQueries):
(WebCore):
(WebCore::Document::styleSelectorChanged):
* dom/Document.h:
(Document):
* page/FrameView.cpp:
(WebCore::FrameView::layout):
2012-04-18 Emil A Eklund <eae@chromium.org>
 
Use explicit casts for size_t to unsigned conversion
......@@ -3156,6 +3156,12 @@ void Document::removePendingSheet()
view()->scrollToFragment(m_url);
}
void Document::evaluateMediaQueryList()
{
if (m_mediaQueryMatcher)
m_mediaQueryMatcher->styleSelectorChanged();
}
void Document::styleSelectorChanged(StyleSelectorUpdateFlag updateFlag)
{
// Don't bother updating, since we haven't loaded all our style info yet
......@@ -3205,8 +3211,7 @@ void Document::styleSelectorChanged(StyleSelectorUpdateFlag updateFlag)
view()->scheduleRelayout();
}
if (m_mediaQueryMatcher)
m_mediaQueryMatcher->styleSelectorChanged();
evaluateMediaQueryList();
}
void Document::addStyleSheetCandidateNode(Node* node, bool createdByParser)
......
......@@ -505,6 +505,8 @@ public:
*/
void styleSelectorChanged(StyleSelectorUpdateFlag);
void evaluateMediaQueryList();
bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRulesOverride; }
void setUsesSiblingRules(bool b) { m_usesSiblingRulesOverride = b; }
bool usesFirstLineRules() const { return m_usesFirstLineRules; }
......
......@@ -978,7 +978,8 @@ void FrameView::layout(bool allowSubtree)
if (document->styleSelector()->affectedByViewportChange()) {
document->styleSelectorChanged(RecalcStyleImmediately);
InspectorInstrumentation::mediaQueryResultChanged(document);
}
} else
document->evaluateMediaQueryList();
// Always ensure our style info is up-to-date. This can happen in situations where
// the layout beats any sort of style recalc update that needs to occur.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment