- Revision
- 137112
- Author
- ta...@google.com
- Date
- 2012-12-09 23:43:42 -0800 (Sun, 09 Dec 2012)
Log Message
[Shadow DOM]: reset-style-inheritance doesn't work for insertion point
https://bugs.webkit.org/show_bug.cgi?id=103711
Reviewed by Hajime Morita.
Source/WebCore:
reset-style-inheritance can be specified by using insertion points'
attribute, e.g. <content reset-style-inheritance>.
c.f. shadow dom spec:
https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
No new tests. Updated an existing test,
fast/dom/shadow/insertion-point-resetStyleInheritance.html to cover
this feature.
* html/HTMLAttributeNames.in:
Added HTMLNames::reset_style_inheritanceAttr.
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::InsertionPoint):
(WebCore::InsertionPoint::parseAttribute):
Since both shadow and content elements have to support
reset-style-inheritance, added InsertionPoint::parseAttribute.
(WebCore::InsertionPoint::resetStyleInheritance):
(WebCore::InsertionPoint::setResetStyleInheritance):
Modified to update reset-style-inheritance attribute value.
* html/shadow/InsertionPoint.h:
(InsertionPoint):
Removed m_shouldResetStyleInheritance. Instead, use
reset-style-inheritance attribute value.
LayoutTests:
* fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt:
* fast/dom/shadow/insertion-point-resetStyleInheritance.html:
Added two more basic tests to cover <content reset-style-inheritance>
and <shadow reset-style-inheritance>.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (137111 => 137112)
--- trunk/LayoutTests/ChangeLog 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/LayoutTests/ChangeLog 2012-12-10 07:43:42 UTC (rev 137112)
@@ -1,3 +1,15 @@
+2012-12-09 Takashi Sakamoto <ta...@google.com>
+
+ [Shadow DOM]: reset-style-inheritance doesn't work for insertion point
+ https://bugs.webkit.org/show_bug.cgi?id=103711
+
+ Reviewed by Hajime Morita.
+
+ * fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt:
+ * fast/dom/shadow/insertion-point-resetStyleInheritance.html:
+ Added two more basic tests to cover <content reset-style-inheritance>
+ and <shadow reset-style-inheritance>.
+
2012-12-09 Huang Dongsung <luxte...@company100.net>
[Qt] Gardening after r137006.
Modified: trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt (137111 => 137112)
--- trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance-expected.txt 2012-12-10 07:43:42 UTC (rev 137112)
@@ -4,6 +4,12 @@
Test case: reset-style-inhertiace basic test. color value should be initial because insertion point's resetStyleInheritance is true.
PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
+Test case: make a content element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.
+PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
+PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
+Test case: make a shadow element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.
+PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color is "rgb(0, 0, 0)"
+PASS window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
Test case: reset-style-inhertiace changes dynamically. Firstly color value should be inherited. Next, initial. At last, inherited.
PASS window.getComputedStyle(document.getElementById("reset-style-inheritance-dynamic").firstChild).color is "rgb(255, 238, 238)"
PASS window.getComputedStyle(document.getElementById("reset-style-inheritance-dynamic").firstChild).backgroundColor is "rgba(0, 0, 0, 0)"
Modified: trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance.html (137111 => 137112)
--- trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance.html 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/LayoutTests/fast/dom/shadow/insertion-point-resetStyleInheritance.html 2012-12-10 07:43:42 UTC (rev 137112)
@@ -34,6 +34,28 @@
shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
}
+function testResetStyleInheritanceWithAttribute() {
+ debug("Test case: make a content element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.");
+ var div = document.getElementById('reset-style-inheritance');
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ shadowRoot.innerHTML = '<content id="content" reset-style-inheritance></content>';
+
+ shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color', '"rgb(0, 0, 0)"');
+ shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
+}
+
+function testShadowResetStyleInheritanceWithAttribute() {
+ debug("Test case: make a shadow element reset-style-inhertiace by using its attribute. color value should be initial because insertion point's resetStyleInheritance is true.");
+ var div = document.getElementById('reset-style-inheritance');
+
+ var shadowRoot = new WebKitShadowRoot(div);
+ shadowRoot.innerHTML = '<shadow id="content" reset-style-inheritance></content>';
+
+ shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).color', '"rgb(0, 0, 0)"');
+ shouldBe('window.getComputedStyle(document.getElementById("reset-style-inheritance").firstChild).backgroundColor', '"rgba(0, 0, 0, 0)"');
+}
+
function testResetStyleInheritanceDynamic() {
debug("Test case: reset-style-inhertiace changes dynamically. Firstly color value should be inherited. Next, initial. At last, inherited.");
var div = document.getElementById('reset-style-inheritance-dynamic');
@@ -106,6 +128,8 @@
function runTests() {
testNoResetStyleInheritance();
testResetStyleInheritance();
+ testResetStyleInheritanceWithAttribute();
+ testShadowResetStyleInheritanceWithAttribute();
testResetStyleInheritanceDynamic();
testResetStyleInheritanceWithoutCrossingUpperBoundary()
testResetStyleInheritanceWithMultipleShadowRoots();
Modified: trunk/Source/WebCore/ChangeLog (137111 => 137112)
--- trunk/Source/WebCore/ChangeLog 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/Source/WebCore/ChangeLog 2012-12-10 07:43:42 UTC (rev 137112)
@@ -1,3 +1,34 @@
+2012-12-09 Takashi Sakamoto <ta...@google.com>
+
+ [Shadow DOM]: reset-style-inheritance doesn't work for insertion point
+ https://bugs.webkit.org/show_bug.cgi?id=103711
+
+ Reviewed by Hajime Morita.
+
+ reset-style-inheritance can be specified by using insertion points'
+ attribute, e.g. <content reset-style-inheritance>.
+ c.f. shadow dom spec:
+ https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
+
+ No new tests. Updated an existing test,
+ fast/dom/shadow/insertion-point-resetStyleInheritance.html to cover
+ this feature.
+
+ * html/HTMLAttributeNames.in:
+ Added HTMLNames::reset_style_inheritanceAttr.
+ * html/shadow/InsertionPoint.cpp:
+ (WebCore::InsertionPoint::InsertionPoint):
+ (WebCore::InsertionPoint::parseAttribute):
+ Since both shadow and content elements have to support
+ reset-style-inheritance, added InsertionPoint::parseAttribute.
+ (WebCore::InsertionPoint::resetStyleInheritance):
+ (WebCore::InsertionPoint::setResetStyleInheritance):
+ Modified to update reset-style-inheritance attribute value.
+ * html/shadow/InsertionPoint.h:
+ (InsertionPoint):
+ Removed m_shouldResetStyleInheritance. Instead, use
+ reset-style-inheritance attribute value.
+
2012-12-09 Ilya Tikhonovsky <loi...@chromium.org>
Native Memory Instrumentation: instrument a part of RenderObject class tree.
Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (137111 => 137112)
--- trunk/Source/WebCore/html/HTMLAttributeNames.in 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in 2012-12-10 07:43:42 UTC (rev 137112)
@@ -278,6 +278,7 @@
readonly
rel
required
+reset-style-inheritance
results
rev
reversed
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (137111 => 137112)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-12-10 07:43:42 UTC (rev 137112)
@@ -32,14 +32,17 @@
#include "InsertionPoint.h"
#include "ElementShadow.h"
+#include "HTMLNames.h"
+#include "QualifiedName.h"
#include "ShadowRoot.h"
#include "StaticNodeList.h"
namespace WebCore {
+using namespace HTMLNames;
+
InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document, CreateInsertionPoint)
- , m_shouldResetStyleInheritance(false)
{
}
@@ -163,18 +166,24 @@
HTMLElement::removedFrom(insertionPoint);
}
+void InsertionPoint::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+ if (name == reset_style_inheritanceAttr) {
+ if (!inDocument() || !attached() || !isActive())
+ return;
+ containingShadowRoot()->host()->setNeedsStyleRecalc();
+ } else
+ HTMLElement::parseAttribute(name, value);
+}
+
bool InsertionPoint::resetStyleInheritance() const
{
- return m_shouldResetStyleInheritance;
+ return fastHasAttribute(reset_style_inheritanceAttr);
}
void InsertionPoint::setResetStyleInheritance(bool value)
{
- if (value != m_shouldResetStyleInheritance) {
- m_shouldResetStyleInheritance = value;
- if (attached() && isActive())
- containingShadowRoot()->host()->setNeedsStyleRecalc();
- }
+ setBooleanAttribute(reset_style_inheritanceAttr, value);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (137111 => 137112)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-12-10 07:28:02 UTC (rev 137111)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-12-10 07:43:42 UTC (rev 137112)
@@ -80,10 +80,11 @@
virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
virtual void removedFrom(ContainerNode*) OVERRIDE;
+ virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
private:
+
ContentDistribution m_distribution;
- bool m_shouldResetStyleInheritance : 1;
};
inline InsertionPoint* toInsertionPoint(Node* node)