- Revision
- 126442
- Author
- [email protected]
- Date
- 2012-08-23 10:08:21 -0700 (Thu, 23 Aug 2012)
Log Message
Distributed nodes should not share styles.
https://bugs.webkit.org/show_bug.cgi?id=90661
Patch by Takashi Sakamoto <[email protected]> on 2012-08-23
Reviewed by Hajime Morita.
Source/WebCore:
styleForElement tries to use previous sibling's style for distributed
nodes. However distributed nodes are children of a shadow host, but
the nodes are not siblings as the result of distribution.
The spec is:
http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-dom-subtrees
So sharing previous sibling's style should be disabled for distrbuted
nodes.
Test: fast/dom/shadow/style-of-distributed-node.html
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
Initialized m_distributedToInsertionPoint. Its initial value is false.
(WebCore::StyleResolver::initForStyleResolve):
After invoking NodeRenderingContext, if the context returns any
insertion point, set m_distributedToInsertionPoint to be true.
Otherwise, false. The value is used in styleForElement.
(WebCore::StyleResolver::styleForElement):
If m_distributedToInsertionPoint is true, disable local sibling style
cache.
* css/StyleResolver.h:
(StyleResolver):
Added a new member variable, m_distributedToInsertionPoint.
The variable keeps whether the m_element is distributed to an
insertion point.
LayoutTests:
* fast/dom/shadow/style-of-distributed-node-expected.txt: Added.
* fast/dom/shadow/style-of-distributed-node.html: Added.
* fast/dom/shadow/user-modify-inheritance-expected.txt:
As this patch also change the user-modify-inheritance's test result,
updated the expected result.
* fast/dom/shadow/user-modify-inheritance.html:
Added FIXME comment.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (126441 => 126442)
--- trunk/LayoutTests/ChangeLog 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/LayoutTests/ChangeLog 2012-08-23 17:08:21 UTC (rev 126442)
@@ -1,3 +1,18 @@
+2012-08-23 Takashi Sakamoto <[email protected]>
+
+ Distributed nodes should not share styles.
+ https://bugs.webkit.org/show_bug.cgi?id=90661
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/shadow/style-of-distributed-node-expected.txt: Added.
+ * fast/dom/shadow/style-of-distributed-node.html: Added.
+ * fast/dom/shadow/user-modify-inheritance-expected.txt:
+ As this patch also change the user-modify-inheritance's test result,
+ updated the expected result.
+ * fast/dom/shadow/user-modify-inheritance.html:
+ Added FIXME comment.
+
2012-08-23 John Mellor <[email protected]>
Text Autosizing: Multiply large fonts less, as they are already more legible.
Added: trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node-expected.txt (0 => 126442)
--- trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node-expected.txt 2012-08-23 17:08:21 UTC (rev 126442)
@@ -0,0 +1,17 @@
+Tests to ensure that styles of distributed nodes are different if their parent styles are different.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+
+PASS getColorProperty("child-a") is "rgb(255, 0, 0)"
+PASS getColorProperty("child-b") is "rgb(0, 0, 255)"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+
+
Added: trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node.html (0 => 126442)
--- trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/style-of-distributed-node.html 2012-08-23 17:08:21 UTC (rev 126442)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function getColorProperty(id) {
+ return window.getComputedStyle(document.getElementById(id)).color;
+}
+
+function log(message) {
+ var console = document.getElementById('console');
+ console.innerHTML += message + '\n';
+}
+</script>
+</head>
+<body>
+<pre id="console"></div>
+<div id="test">
+ <div id="host" style="color: red">
+ <div id="child-a"></div>
+ <div id="child-b"></div>
+ </div>
+</div>
+<script>
+description("Tests to ensure that styles of distributed nodes are different if their parent styles are different.");
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var sr = new WebKitShadowRoot(document.getElementById("host"));
+sr.innerHTML = '<content select="#child-a"></content><div style="color: blue"><content select="#child-b"></content></div>';
+
+shouldBe('getColorProperty("child-a")', '"rgb(255, 0, 0)"');
+shouldBe('getColorProperty("child-b")', '"rgb(0, 0, 255)"');
+
+document.getElementById("test").innerHTML = '';
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance-expected.txt (126441 => 126442)
--- trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance-expected.txt 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance-expected.txt 2012-08-23 17:08:21 UTC (rev 126442)
@@ -10,7 +10,7 @@
PASS computedStyle(prepareNodeInShadowRoot(document.getElementById("non-contenteditable-host2"), "false"), userModifyPropertyName) is "read-only"
PASS computedStyle(prepareNodeInShadowRoot(document.getElementById("non-contenteditable-host3"), "true"), userModifyPropertyName) is "read-write"
PASS getUserModifyProperty("child-a") is "read-write"
-PASS getUserModifyProperty("child-b") is "read-write"
+FAIL getUserModifyProperty("child-b") should be read-write. Was read-only.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance.html (126441 => 126442)
--- trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance.html 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/LayoutTests/fast/dom/shadow/user-modify-inheritance.html 2012-08-23 17:08:21 UTC (rev 126442)
@@ -62,6 +62,7 @@
document.body.offsetLeft;
shouldBeEqualToString('getUserModifyProperty("child-a")', 'read-write');
+/* FIXME(90017): css property: -user-modify should be inherited from parent.*/
shouldBeEqualToString('getUserModifyProperty("child-b")', 'read-write');
</script>
Modified: trunk/Source/WebCore/ChangeLog (126441 => 126442)
--- trunk/Source/WebCore/ChangeLog 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/Source/WebCore/ChangeLog 2012-08-23 17:08:21 UTC (rev 126442)
@@ -1,3 +1,36 @@
+2012-08-23 Takashi Sakamoto <[email protected]>
+
+ Distributed nodes should not share styles.
+ https://bugs.webkit.org/show_bug.cgi?id=90661
+
+ Reviewed by Hajime Morita.
+
+ styleForElement tries to use previous sibling's style for distributed
+ nodes. However distributed nodes are children of a shadow host, but
+ the nodes are not siblings as the result of distribution.
+ The spec is:
+ http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-dom-subtrees
+ So sharing previous sibling's style should be disabled for distrbuted
+ nodes.
+
+ Test: fast/dom/shadow/style-of-distributed-node.html
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::StyleResolver):
+ Initialized m_distributedToInsertionPoint. Its initial value is false.
+ (WebCore::StyleResolver::initForStyleResolve):
+ After invoking NodeRenderingContext, if the context returns any
+ insertion point, set m_distributedToInsertionPoint to be true.
+ Otherwise, false. The value is used in styleForElement.
+ (WebCore::StyleResolver::styleForElement):
+ If m_distributedToInsertionPoint is true, disable local sibling style
+ cache.
+ * css/StyleResolver.h:
+ (StyleResolver):
+ Added a new member variable, m_distributedToInsertionPoint.
+ The variable keeps whether the m_element is distributed to an
+ insertion point.
+
2012-08-23 John Griggs <[email protected]>
Replace access ot HTMLMediaElement from MediaPlayerPrivateBlackBerry with methods in MediaPlayerClient - updated with notes from initial reviews. https://bugs.webkit.org/show_bug.cgi?id=84291
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (126441 => 126442)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2012-08-23 17:08:21 UTC (rev 126442)
@@ -377,6 +377,7 @@
, m_fontDirty(false)
, m_matchAuthorAndUserStyles(matchAuthorAndUserStyles)
, m_sameOriginOnly(false)
+ , m_distributedToInsertionPoint(false)
, m_fontSelector(CSSFontSelector::create(document))
, m_applyPropertyToRegularStyle(true)
, m_applyPropertyToVisitedLinkStyle(false)
@@ -1220,9 +1221,11 @@
m_parentStyle = context.resetStyleInheritance()? 0 :
parentStyle ? parentStyle :
m_parentNode ? m_parentNode->renderStyle() : 0;
+ m_distributedToInsertionPoint = context.insertionPoint();
} else {
m_parentNode = 0;
m_parentStyle = parentStyle;
+ m_distributedToInsertionPoint = false;
}
Node* docElement = e ? e->document()->documentElement() : 0;
@@ -1752,7 +1755,7 @@
initElement(element);
initForStyleResolve(element, defaultParent);
m_regionForStyling = regionForStyling;
- if (sharingBehavior == AllowStyleSharing) {
+ if (sharingBehavior == AllowStyleSharing && !m_distributedToInsertionPoint) {
RenderStyle* sharedStyle = locateSharedStyle();
if (sharedStyle)
return sharedStyle;
Modified: trunk/Source/WebCore/css/StyleResolver.h (126441 => 126442)
--- trunk/Source/WebCore/css/StyleResolver.h 2012-08-23 16:52:20 UTC (rev 126441)
+++ trunk/Source/WebCore/css/StyleResolver.h 2012-08-23 17:08:21 UTC (rev 126442)
@@ -496,6 +496,7 @@
bool m_fontDirty;
bool m_matchAuthorAndUserStyles;
bool m_sameOriginOnly;
+ bool m_distributedToInsertionPoint;
RefPtr<CSSFontSelector> m_fontSelector;
Vector<OwnPtr<MediaQueryResult> > m_viewportDependentMediaQueryResults;