- Revision
- 104399
- Author
- [email protected]
- Date
- 2012-01-08 03:45:58 -0800 (Sun, 08 Jan 2012)
Log Message
Source/WebCore: REGRESSION (r104060): Layout Test fast/media/viewport-media-query.html is occasionally failing
https://bugs.webkit.org/show_bug.cgi?id=75633
Reviewed by Andreas Kling.
If something triggers CSSStyleSelector construction very early, before documentElement is known,
it won't be able to resolve viewport-related media queries. In the included test case
the attribute on <html> element triggers the style selector creation. I can't repro
the fast/media/viewport-media-query.html failure but I suspect it is the same issue with
a different mechanism for early CSSStyleSelector construction.
- Reset style selector on documentElement change.
- Remove the code for lazy documentElement initialization. It is not an useful optimization,
the children of Document rarely change.
Test: fast/media/viewport-media-query-synchronous.html
* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::childrenChanged):
* dom/Document.h:
(WebCore::Document::documentElement):
LayoutTests: Layout Test fast/media/viewport-media-query.html is occasionally failing
https://bugs.webkit.org/show_bug.cgi?id=75633
Reviewed by Andreas Kling.
* fast/media/viewport-media-query-synchronous-expected.txt: Added.
* fast/media/viewport-media-query-synchronous.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104398 => 104399)
--- trunk/LayoutTests/ChangeLog 2012-01-08 08:06:38 UTC (rev 104398)
+++ trunk/LayoutTests/ChangeLog 2012-01-08 11:45:58 UTC (rev 104399)
@@ -1,3 +1,13 @@
+2012-01-07 Antti Koivisto <[email protected]>
+
+ Layout Test fast/media/viewport-media-query.html is occasionally failing
+ https://bugs.webkit.org/show_bug.cgi?id=75633
+
+ Reviewed by Andreas Kling.
+
+ * fast/media/viewport-media-query-synchronous-expected.txt: Added.
+ * fast/media/viewport-media-query-synchronous.html: Added.
+
2012-01-08 David Levin <[email protected]>
[chromium] Add layout test support for autosize code in FrameView.
Added: trunk/LayoutTests/fast/media/viewport-media-query-synchronous-expected.txt (0 => 104399)
--- trunk/LayoutTests/fast/media/viewport-media-query-synchronous-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/media/viewport-media-query-synchronous-expected.txt 2012-01-08 11:45:58 UTC (rev 104399)
@@ -0,0 +1,10 @@
+Test for bug 75633
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(document.getElementById("test")).backgroundColor is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+foo
Added: trunk/LayoutTests/fast/media/viewport-media-query-synchronous.html (0 => 104399)
--- trunk/LayoutTests/fast/media/viewport-media-query-synchronous.html (rev 0)
+++ trunk/LayoutTests/fast/media/viewport-media-query-synchronous.html 2012-01-08 11:45:58 UTC (rev 104399)
@@ -0,0 +1,19 @@
+<html lang=en>
+<head>
+<script src=""
+<style>
+#test { background-color: red; }
+@media all and (min-width:0px)
+{
+ #test { background-color: green }
+}
+</style>
+</head>
+<body>
+<div id=test>foo</div>
+<script>
+description("Test for bug 75633");
+shouldBe('window.getComputedStyle(document.getElementById("test")).backgroundColor','"rgb(0, 128, 0)"');
+</script>
+<script src=""
+</body>
Modified: trunk/Source/WebCore/ChangeLog (104398 => 104399)
--- trunk/Source/WebCore/ChangeLog 2012-01-08 08:06:38 UTC (rev 104398)
+++ trunk/Source/WebCore/ChangeLog 2012-01-08 11:45:58 UTC (rev 104399)
@@ -1,3 +1,28 @@
+2012-01-07 Antti Koivisto <[email protected]>
+
+ REGRESSION (r104060): Layout Test fast/media/viewport-media-query.html is occasionally failing
+ https://bugs.webkit.org/show_bug.cgi?id=75633
+
+ Reviewed by Andreas Kling.
+
+ If something triggers CSSStyleSelector construction very early, before documentElement is known,
+ it won't be able to resolve viewport-related media queries. In the included test case
+ the attribute on <html> element triggers the style selector creation. I can't repro
+ the fast/media/viewport-media-query.html failure but I suspect it is the same issue with
+ a different mechanism for early CSSStyleSelector construction.
+
+ - Reset style selector on documentElement change.
+ - Remove the code for lazy documentElement initialization. It is not an useful optimization,
+ the children of Document rarely change.
+
+ Test: fast/media/viewport-media-query-synchronous.html
+
+ * WebCore.exp.in:
+ * dom/Document.cpp:
+ (WebCore::Document::childrenChanged):
+ * dom/Document.h:
+ (WebCore::Document::documentElement):
+
2012-01-07 Andreas Kling <[email protected]>
Attempt to regenerate bindings on the Windows bot.
Modified: trunk/Source/WebCore/WebCore.exp.in (104398 => 104399)
--- trunk/Source/WebCore/WebCore.exp.in 2012-01-08 08:06:38 UTC (rev 104398)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-01-08 11:45:58 UTC (rev 104399)
@@ -1407,7 +1407,6 @@
__ZNK7WebCore8Document13nodesFromRectEiijjjjb
__ZNK7WebCore8Document14getElementByIdERKN3WTF12AtomicStringE
__ZNK7WebCore8Document16dashboardRegionsEv
-__ZNK7WebCore8Document20cacheDocumentElementEv
__ZNK7WebCore8Document31displayStringModifiedByEncodingERKN3WTF6StringE
__ZNK7WebCore8Document4bodyEv
__ZNK7WebCore8Document4pageEv
Modified: trunk/Source/WebCore/dom/Document.cpp (104398 => 104399)
--- trunk/Source/WebCore/dom/Document.cpp 2012-01-08 08:06:38 UTC (rev 104398)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-01-08 11:45:58 UTC (rev 104399)
@@ -720,16 +720,14 @@
{
TreeScope::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- // Invalidate the document element we have cached in case it was replaced.
- m_documentElement = 0;
+ Element* newDocumentElement = firstElementChild(this);
+ if (newDocumentElement == m_documentElement)
+ return;
+ m_documentElement = newDocumentElement;
+ // The root style used for media query matching depends on the document element.
+ m_styleSelector.clear();
}
-void Document::cacheDocumentElement() const
-{
- ASSERT(!m_documentElement);
- m_documentElement = firstElementChild(this);
-}
-
PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionCode& ec)
{
if (!isValidName(name)) {
Modified: trunk/Source/WebCore/dom/Document.h (104398 => 104399)
--- trunk/Source/WebCore/dom/Document.h 2012-01-08 08:06:38 UTC (rev 104398)
+++ trunk/Source/WebCore/dom/Document.h 2012-01-08 11:45:58 UTC (rev 104399)
@@ -331,8 +331,6 @@
Element* documentElement() const
{
- if (!m_documentElement)
- cacheDocumentElement();
return m_documentElement.get();
}
@@ -1155,8 +1153,6 @@
void updateFocusAppearanceTimerFired(Timer<Document>*);
void updateBaseURL();
- void cacheDocumentElement() const;
-
void buildAccessKeyMap(TreeScope* root);
void createStyleSelector();
@@ -1255,7 +1251,7 @@
RefPtr<Node> m_focusedNode;
RefPtr<Node> m_hoverNode;
RefPtr<Node> m_activeNode;
- mutable RefPtr<Element> m_documentElement;
+ RefPtr<Element> m_documentElement;
uint64_t m_domTreeVersion;
static uint64_t s_globalTreeVersion;