Title: [87227] trunk/Source/WebCore
Revision
87227
Author
tk...@chromium.org
Date
2011-05-24 16:19:55 -0700 (Tue, 24 May 2011)

Log Message

2011-05-24  Kent Tamura  <tk...@chromium.org>

        Reviewed by Dimitri Glazkov.

        Node::shadowAncestorNode() and shadowTreeRootNode() should be const.
        https://bugs.webkit.org/show_bug.cgi?id=61398

        shadowAncestorNode() and shadowTreeRootNode() should be const
        though they can return 'this' pointer.

        No new tests. This doesn't change any visible behavior.

        * dom/Node.cpp:
        (WebCore::Node::shadowAncestorNode): Make this const.
        (WebCore::Node::shadowTreeRootNode): ditto.
        * dom/Node.h: Update declarations.
        * html/shadow/TextControlInnerElements.h:
        (WebCore::SpinButtonElement::isEnabledFormControl): Need no const_cast<>.
        (WebCore::SpinButtonElement::isReadOnlyFormControl): ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87226 => 87227)


--- trunk/Source/WebCore/ChangeLog	2011-05-24 23:13:46 UTC (rev 87226)
+++ trunk/Source/WebCore/ChangeLog	2011-05-24 23:19:55 UTC (rev 87227)
@@ -1,3 +1,23 @@
+2011-05-24  Kent Tamura  <tk...@chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Node::shadowAncestorNode() and shadowTreeRootNode() should be const.
+        https://bugs.webkit.org/show_bug.cgi?id=61398
+
+        shadowAncestorNode() and shadowTreeRootNode() should be const
+        though they can return 'this' pointer.
+
+        No new tests. This doesn't change any visible behavior.
+
+        * dom/Node.cpp:
+        (WebCore::Node::shadowAncestorNode): Make this const.
+        (WebCore::Node::shadowTreeRootNode): ditto.
+        * dom/Node.h: Update declarations.
+        * html/shadow/TextControlInnerElements.h:
+        (WebCore::SpinButtonElement::isEnabledFormControl): Need no const_cast<>.
+        (WebCore::SpinButtonElement::isReadOnlyFormControl): ditto.
+
 2011-05-24  James Simonsen  <simon...@chromium.org>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/dom/Node.cpp (87226 => 87227)


--- trunk/Source/WebCore/dom/Node.cpp	2011-05-24 23:13:46 UTC (rev 87226)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-05-24 23:19:55 UTC (rev 87227)
@@ -1538,7 +1538,7 @@
 }
 #endif
 
-Node* Node::shadowAncestorNode()
+Node* Node::shadowAncestorNode() const
 {
 #if ENABLE(SVG)
     // SVG elements living in a shadow tree only occur when <use> created them.
@@ -1546,18 +1546,18 @@
     // but the actual shadow tree element - as main difference to the HTML forms
     // shadow tree concept. (This function _could_ be made virtual - opinions?)
     if (isSVGElement())
-        return this;
+        return const_cast<Node*>(this);
 #endif
 
     Node* root = shadowTreeRootNode();
     if (root)
         return root->shadowHost();
-    return this;
+    return const_cast<Node*>(this);
 }
 
-Node* Node::shadowTreeRootNode()
+Node* Node::shadowTreeRootNode() const
 {
-    Node* root = this;
+    Node* root = const_cast<Node*>(this);
     while (root) {
         if (root->isShadowRoot() || root->isSVGShadowRoot())
             return root;

Modified: trunk/Source/WebCore/dom/Node.h (87226 => 87227)


--- trunk/Source/WebCore/dom/Node.h	2011-05-24 23:13:46 UTC (rev 87226)
+++ trunk/Source/WebCore/dom/Node.h	2011-05-24 23:19:55 UTC (rev 87227)
@@ -214,9 +214,9 @@
     virtual bool isShadowBoundary() const { return false; }
     virtual bool canHaveLightChildRendererWithShadow() const { return false; }
 
-    Node* shadowAncestorNode();
+    Node* shadowAncestorNode() const;
     // Returns 0, a ShadowRoot, or a legacy shadow root.
-    Node* shadowTreeRootNode();
+    Node* shadowTreeRootNode() const;
     // Returns 0, a child of ShadowRoot, or a legacy shadow root.
     Node* nonBoundaryShadowTreeRootNode();
     bool isInShadowTree();

Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.h (87226 => 87227)


--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.h	2011-05-24 23:13:46 UTC (rev 87226)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.h	2011-05-24 23:19:55 UTC (rev 87227)
@@ -106,9 +106,8 @@
     virtual PassRefPtr<RenderStyle> styleForRenderer();
     virtual void detach();
     virtual bool isSpinButtonElement() const { return true; }
-    // FIXME: shadowAncestorNode() should be const.
-    virtual bool isEnabledFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isEnabledFormControl(); }
-    virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); }
+    virtual bool isEnabledFormControl() const { return static_cast<Element*>(shadowAncestorNode())->isEnabledFormControl(); }
+    virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(shadowAncestorNode())->isReadOnlyFormControl(); }
     virtual void defaultEventHandler(Event*);
     void startRepeatingTimer();
     void stopRepeatingTimer();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to