Title: [89521] trunk/Source/WebCore
Revision
89521
Author
[email protected]
Date
2011-06-22 19:26:27 -0700 (Wed, 22 Jun 2011)

Log Message

2011-06-22  Julien Chaffraix  <[email protected]>

        Reviewed by Dimitri Glazkov.

        Tighten type usage in the Shadow tree code
        https://bugs.webkit.org/show_bug.cgi?id=63210

        Refactoring only, no new test required.

        * dom/Document.cpp:
        (WebCore::Document::buildAccessKeyMap):
        * dom/Document.h:
        Changed the argument of buildAccessKeyMap to TreeScope.

        * dom/Element.cpp:
        (WebCore::Element::attach):
        (WebCore::Element::removeShadowRoot):
        * html/ColorInputType.cpp:
        (WebCore::ColorInputType::shadowColorSwatch):
        * html/HTMLKeygenElement.cpp:
        (WebCore::HTMLKeygenElement::shadowSelect):
        * html/shadow/SliderThumbElement.cpp:
        (WebCore::sliderThumbElementOf):
        Use ShadowRoot for the previous call sites as this is what is
        returned by shadowRoot().

        * dom/Node.cpp:
        (WebCore::traverseTreeAndMark): Renamed the parameter here as it is not
        expected to be a shadow object. Just the rootNode of our traversal.

        * dom/ShadowRoot.h: Made attach() public as it is public in ContainerNode
        and we would do some casting to avoid the private attribute in ShadowRoot.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89520 => 89521)


--- trunk/Source/WebCore/ChangeLog	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/ChangeLog	2011-06-23 02:26:27 UTC (rev 89521)
@@ -1,3 +1,36 @@
+2011-06-22  Julien Chaffraix  <[email protected]>
+
+        Reviewed by Dimitri Glazkov.
+
+        Tighten type usage in the Shadow tree code
+        https://bugs.webkit.org/show_bug.cgi?id=63210
+
+        Refactoring only, no new test required.
+
+        * dom/Document.cpp:
+        (WebCore::Document::buildAccessKeyMap):
+        * dom/Document.h:
+        Changed the argument of buildAccessKeyMap to TreeScope.
+
+        * dom/Element.cpp:
+        (WebCore::Element::attach):
+        (WebCore::Element::removeShadowRoot):
+        * html/ColorInputType.cpp:
+        (WebCore::ColorInputType::shadowColorSwatch):
+        * html/HTMLKeygenElement.cpp:
+        (WebCore::HTMLKeygenElement::shadowSelect):
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::sliderThumbElementOf):
+        Use ShadowRoot for the previous call sites as this is what is
+        returned by shadowRoot().
+
+        * dom/Node.cpp:
+        (WebCore::traverseTreeAndMark): Renamed the parameter here as it is not
+        expected to be a shadow object. Just the rootNode of our traversal.
+
+        * dom/ShadowRoot.h: Made attach() public as it is public in ContainerNode
+        and we would do some casting to avoid the private attribute in ShadowRoot.
+
 2011-06-22  Joseph Pecoraro  <[email protected]>
 
         Reviewed by Darin Adler.

Modified: trunk/Source/WebCore/dom/Document.cpp (89520 => 89521)


--- trunk/Source/WebCore/dom/Document.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -618,7 +618,7 @@
     return m_elementsByAccessKey.get(key.impl());
 }
 
-void Document::buildAccessKeyMap(ContainerNode* root)
+void Document::buildAccessKeyMap(TreeScope* root)
 {
      for (Node* n = root; n; n = n->traverseNextNode(root)) {
         if (!n->isElementNode())

Modified: trunk/Source/WebCore/dom/Document.h (89520 => 89521)


--- trunk/Source/WebCore/dom/Document.h	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/dom/Document.h	2011-06-23 02:26:27 UTC (rev 89521)
@@ -1130,7 +1130,7 @@
 
     void cacheDocumentElement() const;
 
-    void buildAccessKeyMap(ContainerNode* root);
+    void buildAccessKeyMap(TreeScope* root);
 
     void createStyleSelector();
 

Modified: trunk/Source/WebCore/dom/Element.cpp (89520 => 89521)


--- trunk/Source/WebCore/dom/Element.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/dom/Element.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -1019,7 +1019,7 @@
         parentPusher.push();
     ContainerNode::attach();
 
-    if (Node* shadow = shadowRoot()) {
+    if (ShadowRoot* shadow = shadowRoot()) {
         parentPusher.push();
         shadow->attach();
     }
@@ -1217,7 +1217,7 @@
         return;
 
     ElementRareData* data = ""
-    if (RefPtr<Node> oldRoot = data->m_shadowRoot) {
+    if (RefPtr<ShadowRoot> oldRoot = data->m_shadowRoot) {
         data->m_shadowRoot = 0;
         document()->removeFocusedNodeOfSubtree(oldRoot.get());
 

Modified: trunk/Source/WebCore/dom/Node.cpp (89520 => 89521)


--- trunk/Source/WebCore/dom/Node.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -2318,14 +2318,14 @@
         fprintf(stderr, "%s", indent.utf8().data());
         node->showNode();
 
-        ContainerNode* shadow = shadowRoot(const_cast<Node*>(node));
+        ContainerNode* rootNode = shadowRoot(const_cast<Node*>(node));
 
-        if (!shadow && node->renderer() && node->renderer()->isTextControl())
-            shadow = static_cast<RenderTextControl*>(node->renderer())->innerTextElement();
+        if (!rootNode && node->renderer() && node->renderer()->isTextControl())
+            rootNode = static_cast<RenderTextControl*>(node->renderer())->innerTextElement();
 
-        if (shadow) {
+        if (rootNode) {
             indent += "\t";
-            traverseTreeAndMark(indent, shadow, markedNode1, markedLabel1, markedNode2, markedLabel2);
+            traverseTreeAndMark(indent, rootNode, markedNode1, markedLabel1, markedNode2, markedLabel2);
         }
     }
 }

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (89520 => 89521)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2011-06-23 02:26:27 UTC (rev 89521)
@@ -44,6 +44,8 @@
     ContainerNode* activeContentContainer();
     void hostChildrenChanged();
 
+    virtual void attach();
+
 private:
     ShadowRoot(Document*);
     virtual ~ShadowRoot();
@@ -53,7 +55,6 @@
     virtual PassRefPtr<Node> cloneNode(bool deep);
     virtual bool childTypeAllowed(NodeType) const;
     virtual bool applyAuthorSheets() const;
-    virtual void attach();
 
     bool hasContentElement() const;
 };

Modified: trunk/Source/WebCore/html/ColorInputType.cpp (89520 => 89521)


--- trunk/Source/WebCore/html/ColorInputType.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/html/ColorInputType.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -120,7 +120,7 @@
 
 HTMLElement* ColorInputType::shadowColorSwatch() const
 {
-    Node* shadow = element()->shadowRoot();
+    ShadowRoot* shadow = element()->shadowRoot();
     return shadow ? toHTMLElement(shadow->firstChild()->firstChild()) : 0;
 }
 

Modified: trunk/Source/WebCore/html/HTMLKeygenElement.cpp (89520 => 89521)


--- trunk/Source/WebCore/html/HTMLKeygenElement.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/html/HTMLKeygenElement.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -132,7 +132,7 @@
 
 HTMLSelectElement* HTMLKeygenElement::shadowSelect() const
 {
-    Node* shadow = shadowRoot();
+    ShadowRoot* shadow = shadowRoot();
     ASSERT(shadow);
     return shadow ? static_cast<HTMLSelectElement*>(shadow->firstChild()) : 0;
 }

Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (89520 => 89521)


--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2011-06-23 02:14:30 UTC (rev 89520)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2011-06-23 02:26:27 UTC (rev 89521)
@@ -66,7 +66,7 @@
 SliderThumbElement* sliderThumbElementOf(Node* node)
 {
     ASSERT(node);
-    Node* shadow = node->toInputElement()->shadowRoot();
+    ShadowRoot* shadow = node->toInputElement()->shadowRoot();
     ASSERT(shadow);
     Node* thumb = shadow->firstChild()->firstChild()->firstChild();
     ASSERT(thumb);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to