- Revision
- 138704
- Author
- mk...@chromium.org
- Date
- 2013-01-03 01:13:50 -0800 (Thu, 03 Jan 2013)
Log Message
seamless iframes don't inherit styles when srcdoc is used
https://bugs.webkit.org/show_bug.cgi?id=103539
Reviewed by Antti Koivisto.
Source/WebCore:
Seamless iframes populated via a 'srcdoc' attribute should always
inherit styles from their parent documents. At the moment, this is
only the case when they contain a stylesheet or some other markup
that forces a style recalculation on the document. Simple 'srcdoc'
attributes (e.g. "srcdoc='<p>This is a comment.</p>'") bail out of
recalculating style early, resulting in unstyled appearance.
This patch instructs WebCore to treat seamless documents as having an
updated StyleResolver regardless of what actions the parser takes,
which in turn ensures that the document's style is recalculated
correctly.
Test: fast/frames/seamless/seamless-srcdoc.html
* dom/Document.cpp:
(WebCore::Document::implicitOpen):
If it's a seamless document, notify it that its StyleResolver isn't
what it might have expected.
LayoutTests:
* fast/frames/seamless/resources/span.html: Added.
* fast/frames/seamless/seamless-contenteditable-not-inherited-expected.txt:
Updating the previously failing expectation.
* fast/frames/seamless/seamless-srcdoc-expected.txt: Added.
* fast/frames/seamless/seamless-srcdoc.html: Added.
Exciting new test to ensure that this doesn't regress, neither
for totally simple srcdoc attriubtes, nor for slightly more
complex variations.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (138703 => 138704)
--- trunk/LayoutTests/ChangeLog 2013-01-03 08:42:24 UTC (rev 138703)
+++ trunk/LayoutTests/ChangeLog 2013-01-03 09:13:50 UTC (rev 138704)
@@ -1,3 +1,19 @@
+2013-01-03 Mike West <mk...@chromium.org>
+
+ seamless iframes don't inherit styles when srcdoc is used
+ https://bugs.webkit.org/show_bug.cgi?id=103539
+
+ Reviewed by Antti Koivisto.
+
+ * fast/frames/seamless/resources/span.html: Added.
+ * fast/frames/seamless/seamless-contenteditable-not-inherited-expected.txt:
+ Updating the previously failing expectation.
+ * fast/frames/seamless/seamless-srcdoc-expected.txt: Added.
+ * fast/frames/seamless/seamless-srcdoc.html: Added.
+ Exciting new test to ensure that this doesn't regress, neither
+ for totally simple srcdoc attriubtes, nor for slightly more
+ complex variations.
+
2013-01-02 Ryosuke Niwa <rn...@webkit.org>
Add failing test expectations for two canvas tests on Mac Lion
Added: trunk/LayoutTests/fast/frames/seamless/resources/span.html (0 => 138704)
--- trunk/LayoutTests/fast/frames/seamless/resources/span.html (rev 0)
+++ trunk/LayoutTests/fast/frames/seamless/resources/span.html 2013-01-03 09:13:50 UTC (rev 138704)
@@ -0,0 +1 @@
+<span>This is a span.</span>
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-contenteditable-not-inherited-expected.txt (138703 => 138704)
--- trunk/LayoutTests/fast/frames/seamless/seamless-contenteditable-not-inherited-expected.txt 2013-01-03 08:42:24 UTC (rev 138703)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-contenteditable-not-inherited-expected.txt 2013-01-03 09:13:50 UTC (rev 138704)
@@ -1,4 +1,4 @@
This test ensures that content inside a seamless iframe does not inherit editability via the contenteditable attribute on a parent element, but does via a CSS rule that cascades into the frame.
PASS window.getComputedStyle(span).getPropertyCSSValue('-webkit-user-modify').cssText is "read-only"
-FAIL window.getComputedStyle(p).getPropertyCSSValue('-webkit-user-modify').cssText should be read-write. Was read-only.
+PASS window.getComputedStyle(p).getPropertyCSSValue('-webkit-user-modify').cssText is "read-write"
Added: trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc-expected.txt (0 => 138704)
--- trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc-expected.txt 2013-01-03 09:13:50 UTC (rev 138704)
@@ -0,0 +1,5 @@
+This test ensures that content inside a seamless srcdoc iframe correctly inherits style, even if it doesn't set any styles of its own.
+PASS window.getComputedStyle(srcdocspan).getPropertyCSSValue('color').cssText is "rgb(255, 0, 0)"
+PASS window.getComputedStyle(srcdocstylespan).getPropertyCSSValue('color').cssText is "rgb(255, 0, 0)"
+PASS window.getComputedStyle(span).getPropertyCSSValue('color').cssText is "rgb(255, 0, 0)"
+
Added: trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc.html (0 => 138704)
--- trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc.html (rev 0)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-srcdoc.html 2013-01-03 09:13:50 UTC (rev 138704)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src=""
+ <script>
+ window._onload_ = function () {
+ debug("This test ensures that content inside a seamless srcdoc iframe correctly inherits style, even if it doesn't set any styles of its own.");
+
+ window.srcdocspan = document.getElementById("nostyle").contentDocument.querySelector('span');
+ window.srcdocstylespan = document.getElementById("style").contentDocument.querySelector('span');
+ window.span = document.querySelector('iframe[src]').contentDocument.querySelector('span');
+
+ shouldBeEqualToString("window.getComputedStyle(srcdocspan).getPropertyCSSValue('color').cssText", "rgb(255, 0, 0)");
+ shouldBeEqualToString("window.getComputedStyle(srcdocstylespan).getPropertyCSSValue('color').cssText", "rgb(255, 0, 0)");
+ shouldBeEqualToString("window.getComputedStyle(span).getPropertyCSSValue('color').cssText", "rgb(255, 0, 0)");
+ };
+ </script>
+ <style>
+ span { color: red; }
+ </style>
+</head>
+<body>
+ <iframe id="nostyle" seamless srcdoc="<span>This is a span.</span>"></iframe>
+ <iframe id="style" seamless srcdoc="<style></style><span>This is a span.</span>"></iframe>
+ <iframe seamless src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (138703 => 138704)
--- trunk/Source/WebCore/ChangeLog 2013-01-03 08:42:24 UTC (rev 138703)
+++ trunk/Source/WebCore/ChangeLog 2013-01-03 09:13:50 UTC (rev 138704)
@@ -1,3 +1,29 @@
+2013-01-03 Mike West <mk...@chromium.org>
+
+ seamless iframes don't inherit styles when srcdoc is used
+ https://bugs.webkit.org/show_bug.cgi?id=103539
+
+ Reviewed by Antti Koivisto.
+
+ Seamless iframes populated via a 'srcdoc' attribute should always
+ inherit styles from their parent documents. At the moment, this is
+ only the case when they contain a stylesheet or some other markup
+ that forces a style recalculation on the document. Simple 'srcdoc'
+ attributes (e.g. "srcdoc='<p>This is a comment.</p>'") bail out of
+ recalculating style early, resulting in unstyled appearance.
+
+ This patch instructs WebCore to treat seamless documents as having an
+ updated StyleResolver regardless of what actions the parser takes,
+ which in turn ensures that the document's style is recalculated
+ correctly.
+
+ Test: fast/frames/seamless/seamless-srcdoc.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::implicitOpen):
+ If it's a seamless document, notify it that its StyleResolver isn't
+ what it might have expected.
+
2013-01-03 Allan Sandfeld Jensen <allan.jen...@digia.com>
[Qt] Implement SimpleFontData::platformBoundsForGlyph
Modified: trunk/Source/WebCore/dom/Document.cpp (138703 => 138704)
--- trunk/Source/WebCore/dom/Document.cpp 2013-01-03 08:42:24 UTC (rev 138703)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-01-03 09:13:50 UTC (rev 138704)
@@ -2254,6 +2254,12 @@
setCompatibilityMode(NoQuirksMode);
+ // Documents rendered seamlessly should start out requiring a stylesheet
+ // collection update in order to ensure they inherit all the relevant data
+ // from their parent.
+ if (shouldDisplaySeamlesslyWithParent())
+ styleResolverChanged(DeferRecalcStyle);
+
m_parser = createParser();
setParsing(true);
setReadyState(Loading);