Reviewed by Mitz.
Fix <rdar://problem/
5425951>
REGRESSION: change to updateLayoutIgnorePendingStylesheets causes SAP Portal page to render wrong
If new nodes have been added or style recalc has been done with style sheets still pending, some nodes
may not have had their real style calculated yet. Normally this state gets cleaned when style sheets arrive
but in updateLayoutIgnorePendingStylesheets() we need to do full style recalc to get up-to-date style immediatly.
Added a document flag to track if there are any nodes that did not have their real style calculated due to
pending stylesheets.
Test: fast/dynamic/style-access-late-stylesheet-load.html
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::styleForElement):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::recalcStyle):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
* dom/Document.h:
(WebCore::Document::setHasNodesWithPlaceholderStyle):
LayoutTests:
Reviewed by Mitz.
Test for <rdar://problem/
5425951>
REGRESSION: change to updateLayoutIgnorePendingStylesheets causes SAP Portal page to render wrong
* fast/dynamic/style-access-late-stylesheet-load-expected.txt: Added.
* fast/dynamic/style-access-late-stylesheet-load.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25308
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-08-29 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Mitz.
+
+ Test for <rdar://problem/5425951>
+ REGRESSION: change to updateLayoutIgnorePendingStylesheets causes SAP Portal page to render wrong
+
+ * fast/dynamic/style-access-late-stylesheet-load-expected.txt: Added.
+ * fast/dynamic/style-access-late-stylesheet-load.html: Added.
+
2007-08-28 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
--- /dev/null
+Test that offsetWidth and similar get up to date style information even if a new stylesheet load is started at late stage of document rendering
+PASS
--- /dev/null
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+<style>
+#test { position: absolute; width: 100px; height: 100px }
+</style>
+</head>
+<body>
+Test that offsetWidth and similar get up to date style information even if a new stylesheet load is started at late stage of document rendering
+<link rel=stylesheet href="data:text/css,blah">
+<div id=console></div>
+<div id=test></div>
+
+<script>
+var test = document.getElementById('test');
+var console = document.getElementById('console');
+console.innerHTML = ((test.offsetWidth == 100) ? "<span style='color:green'>PASS</span> " : "<span style='color:red'>FAIL</span> ");
+</script>
+
+</body>
+</html>
+2007-08-29 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Mitz.
+
+ Fix <rdar://problem/5425951>
+ REGRESSION: change to updateLayoutIgnorePendingStylesheets causes SAP Portal page to render wrong
+
+ If new nodes have been added or style recalc has been done with style sheets still pending, some nodes
+ may not have had their real style calculated yet. Normally this state gets cleaned when style sheets arrive
+ but in updateLayoutIgnorePendingStylesheets() we need to do full style recalc to get up-to-date style immediatly.
+
+ Added a document flag to track if there are any nodes that did not have their real style calculated due to
+ pending stylesheets.
+
+ Test: fast/dynamic/style-access-late-stylesheet-load.html
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::styleForElement):
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::recalcStyle):
+ (WebCore::Document::updateLayoutIgnorePendingStylesheets):
+ * dom/Document.h:
+ (WebCore::Document::setHasNodesWithPlaceholderStyle):
+
2007-08-29 Alice Liu <alice.liu@apple.com>
Reviewed by Maciej.
styleNotYetAvailable->font().update();
}
styleNotYetAvailable->ref();
+ e->document()->setHasNodesWithPlaceholderStyle();
return styleNotYetAvailable;
}
m_didCalculateStyleSelector = false;
m_pendingStylesheets = 0;
m_ignorePendingStylesheets = false;
+ m_hasNodesWithPlaceholderStyle = false;
m_pendingSheetLayout = NoLayoutWithPendingSheets;
m_cssTarget = 0;
goto bail_out;
if (change == Force) {
+ // style selector may set this again during recalc
+ m_hasNodesWithPlaceholderStyle = false;
+
RenderStyle* oldStyle = renderer()->style();
if (oldStyle)
oldStyle->ref();
if (body() && !body()->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
m_pendingSheetLayout = DidLayoutWithPendingSheets;
updateStyleSelector();
- }
+ } else if (m_hasNodesWithPlaceholderStyle)
+ // If new nodes have been added or style recalc has been done with style sheets still pending, some nodes
+ // may not have had their real style calculated yet. Normally this gets cleaned when style sheets arrive
+ // but here we need up-to-date style immediatly.
+ recalcStyle(Force);
}
updateLayout();
enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
+
+ void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
String iconURL();
void setIconURL(const String& iconURL, const String& type);
// to track that this happened so that we can do a full repaint when the stylesheets
// do eventually load.
PendingSheetLayout m_pendingSheetLayout;
+
+ bool m_hasNodesWithPlaceholderStyle;
RefPtr<CSSStyleSheet> m_elemSheet;