- Revision
- 117026
- Author
- [email protected]
- Date
- 2012-05-14 21:36:22 -0700 (Mon, 14 May 2012)
Log Message
Styles are not recalculated when the seamless attribute is dynamically added/removed
https://bugs.webkit.org/show_bug.cgi?id=86315
Reviewed by Andreas Kling.
Source/WebCore:
Covered by fast/frames/seamless/seamless-css-cascade.html.
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::isPresentationAttribute):
- Make seamless a presentational attribute, which means style on the <iframe> will
be forced to recalculate when it changes. This is correct, but not observable
until the layout changes are landed (as then the iframe should correctly revert to not
being sized to fit its content if seamless is removed).
(WebCore::HTMLIFrameElement::parseAttribute):
- When the seamless attribute is added or remove, force the content document to recalc
its style resolver, which will refresh the list of inherited stylesheets from the
parent. This doesn't need to happen synchronously. When the layout changes land
the content document will actually cause that recalc to redirect to the parent document
in the seamless case anyway, but it's more correct to ask the content document directly.
LayoutTests:
Add a subtest to cover this case.
* fast/frames/seamless/seamless-css-cascade-expected.txt:
* fast/frames/seamless/seamless-css-cascade.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (117025 => 117026)
--- trunk/LayoutTests/ChangeLog 2012-05-15 03:43:54 UTC (rev 117025)
+++ trunk/LayoutTests/ChangeLog 2012-05-15 04:36:22 UTC (rev 117026)
@@ -1,3 +1,15 @@
+2012-05-14 Eric Seidel <[email protected]>
+
+ Styles are not recalculated when the seamless attribute is dynamically added/removed
+ https://bugs.webkit.org/show_bug.cgi?id=86315
+
+ Reviewed by Andreas Kling.
+
+ Add a subtest to cover this case.
+
+ * fast/frames/seamless/seamless-css-cascade-expected.txt:
+ * fast/frames/seamless/seamless-css-cascade.html:
+
2012-05-14 Kent Tamura <[email protected]>
[Chromium] Update text expectations.
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade-expected.txt (117025 => 117026)
--- trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade-expected.txt 2012-05-15 03:43:54 UTC (rev 117025)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade-expected.txt 2012-05-15 04:36:22 UTC (rev 117026)
@@ -5,4 +5,7 @@
PASS window.getComputedStyle(rootElement).color is "rgb(255, 165, 0)"
PASS window.getComputedStyle(rootElement).color is "rgb(1, 2, 3)"
PASS window.getComputedStyle(one).color is "rgb(3, 2, 1)"
+PASS window.getComputedStyle(one).color is "rgb(0, 0, 0)"
+PASS window.getComputedStyle(two).color is "rgb(128, 0, 128)"
+PASS window.getComputedStyle(three).color is "rgb(0, 0, 0)"
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade.html (117025 => 117026)
--- trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade.html 2012-05-15 03:43:54 UTC (rev 117025)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade.html 2012-05-15 04:36:22 UTC (rev 117026)
@@ -42,5 +42,11 @@
document.head.appendChild(styleSheet);
// #one's style is only specified by this parent, so adding a later sheet should override the color and update the child frame.
shouldBeEqualToString("window.getComputedStyle(one).color", "rgb(3, 2, 1)");
+
+ // Test that removing the seamless attribute recalculates the child's style.
+ window.iframe.removeAttribute("seamless");
+ shouldBeEqualToString("window.getComputedStyle(one).color", "rgb(0, 0, 0)"); // black, default.
+ shouldBeEqualToString("window.getComputedStyle(two).color", "rgb(128, 0, 128)"); // purple, selector in child.
+ shouldBeEqualToString("window.getComputedStyle(three).color", "rgb(0, 0, 0)"); // black, default.
}
</script>
Modified: trunk/Source/WebCore/ChangeLog (117025 => 117026)
--- trunk/Source/WebCore/ChangeLog 2012-05-15 03:43:54 UTC (rev 117025)
+++ trunk/Source/WebCore/ChangeLog 2012-05-15 04:36:22 UTC (rev 117026)
@@ -1,3 +1,25 @@
+2012-05-14 Eric Seidel <[email protected]>
+
+ Styles are not recalculated when the seamless attribute is dynamically added/removed
+ https://bugs.webkit.org/show_bug.cgi?id=86315
+
+ Reviewed by Andreas Kling.
+
+ Covered by fast/frames/seamless/seamless-css-cascade.html.
+
+ * html/HTMLIFrameElement.cpp:
+ (WebCore::HTMLIFrameElement::isPresentationAttribute):
+ - Make seamless a presentational attribute, which means style on the <iframe> will
+ be forced to recalculate when it changes. This is correct, but not observable
+ until the layout changes are landed (as then the iframe should correctly revert to not
+ being sized to fit its content if seamless is removed).
+ (WebCore::HTMLIFrameElement::parseAttribute):
+ - When the seamless attribute is added or remove, force the content document to recalc
+ its style resolver, which will refresh the list of inherited stylesheets from the
+ parent. This doesn't need to happen synchronously. When the layout changes land
+ the content document will actually cause that recalc to redirect to the parent document
+ in the seamless case anyway, but it's more correct to ask the content document directly.
+
2012-05-14 Alexandre Elias <[email protected]>
[chromium] Prevent KeyCodeConversionAndroid from breaking on next NDK roll
Modified: trunk/Source/WebCore/html/HTMLIFrameElement.cpp (117025 => 117026)
--- trunk/Source/WebCore/html/HTMLIFrameElement.cpp 2012-05-15 03:43:54 UTC (rev 117025)
+++ trunk/Source/WebCore/html/HTMLIFrameElement.cpp 2012-05-15 04:36:22 UTC (rev 117026)
@@ -51,7 +51,7 @@
bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const
{
- if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr)
+ if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr || name == seamlessAttr)
return true;
return HTMLFrameElementBase::isPresentationAttribute(name);
}
@@ -87,7 +87,11 @@
m_name = newName;
} else if (attr->name() == sandboxAttr)
setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value()));
- else
+ else if (attr->name() == seamlessAttr) {
+ // If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
+ if (contentDocument())
+ contentDocument()->styleResolverChanged(DeferRecalcStyle);
+ } else
HTMLFrameElementBase::parseAttribute(attr);
}