Title: [95600] trunk/Source/WebCore
Revision
95600
Author
[email protected]
Date
2011-09-20 22:58:02 -0700 (Tue, 20 Sep 2011)

Log Message

Style changes on forwarded shadow children should trigger shadow renderer reconstruction.
https://bugs.webkit.org/show_bug.cgi?id=68228

Reviewed by Dimitri Glazkov.

Currently style changes on forwarded shadow child triggers
Node::reattach() only for the forwarded node. But it should
invalidate whole renderers on the shadow tree because
ShadowContentElement expects its inclusions to be attached and to
create renderers in the inclusion order. But single node
reattach() violates the expectation and possibly creates
inconsistent render tree.

This change makes NodeRenderingContext to go
AttachContentForwarded, where the ShadowContentElement::attach()
happens, only during ShadowRoot::attach(), not for style-change
triggered Node::attach() on the forwarded nodes.

Note that the altering phase AttachContentLight doesn't create
renderers for the forwarded nodes. Instead of that, it possibly
triggers shadow subtree reconstruction on
NodeRenderingContext::hostChildrenChanged().

No new tests. This is a defensive change. There is no visible
difference at this time.

* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::NodeRenderingContext):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::isInclusionSelectorActive):
* dom/ShadowRoot.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95599 => 95600)


--- trunk/Source/WebCore/ChangeLog	2011-09-21 05:41:27 UTC (rev 95599)
+++ trunk/Source/WebCore/ChangeLog	2011-09-21 05:58:02 UTC (rev 95600)
@@ -1,3 +1,37 @@
+2011-09-16  MORITA Hajime  <[email protected]>
+
+        Style changes on forwarded shadow children should trigger shadow renderer reconstruction.
+        https://bugs.webkit.org/show_bug.cgi?id=68228
+
+        Reviewed by Dimitri Glazkov.
+
+        Currently style changes on forwarded shadow child triggers
+        Node::reattach() only for the forwarded node. But it should
+        invalidate whole renderers on the shadow tree because
+        ShadowContentElement expects its inclusions to be attached and to
+        create renderers in the inclusion order. But single node
+        reattach() violates the expectation and possibly creates
+        inconsistent render tree.
+
+        This change makes NodeRenderingContext to go
+        AttachContentForwarded, where the ShadowContentElement::attach()
+        happens, only during ShadowRoot::attach(), not for style-change
+        triggered Node::attach() on the forwarded nodes.
+
+        Note that the altering phase AttachContentLight doesn't create
+        renderers for the forwarded nodes. Instead of that, it possibly
+        triggers shadow subtree reconstruction on
+        NodeRenderingContext::hostChildrenChanged().
+
+        No new tests. This is a defensive change. There is no visible
+        difference at this time.
+
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRenderingContext::NodeRenderingContext):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::isInclusionSelectorActive):
+        * dom/ShadowRoot.h:
+
 2011-09-20  MORITA Hajime  <[email protected]>
 
         <meter> doesn't update rendering when its value is changed.

Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (95599 => 95600)


--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2011-09-21 05:41:27 UTC (rev 95599)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp	2011-09-21 05:58:02 UTC (rev 95600)
@@ -64,7 +64,8 @@
         m_visualParentShadowRoot = toElement(parent)->shadowRoot();
 
         if (m_visualParentShadowRoot) {
-            if ((m_includer = m_visualParentShadowRoot->includerFor(m_node))) {
+            if ((m_includer = m_visualParentShadowRoot->includerFor(m_node))
+                && m_visualParentShadowRoot->isInclusionSelectorActive()) {
                 m_phase = AttachContentForwarded;
                 m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_includer).parentNodeForRenderingAndStyle();
                 return;

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (95599 => 95600)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2011-09-21 05:41:27 UTC (rev 95599)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2011-09-21 05:58:02 UTC (rev 95600)
@@ -119,6 +119,11 @@
     setNeedsStyleRecalc();
 }
 
+bool ShadowRoot::isInclusionSelectorActive() const
+{
+    return m_inclusions && m_inclusions->hasCandidates();
+}
+
 bool ShadowRoot::hasContentElement() const
 {
     for (Node* n = firstChild(); n; n = n->traverseNextNode(this)) {

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (95599 => 95600)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2011-09-21 05:41:27 UTC (rev 95599)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2011-09-21 05:58:02 UTC (rev 95600)
@@ -43,6 +43,7 @@
 
     ShadowContentElement* includerFor(Node*) const;
     void hostChildrenChanged();
+    bool isInclusionSelectorActive() const;
 
     virtual void attach();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to