Title: [203016] trunk/Source/WebCore
Revision
203016
Author
[email protected]
Date
2016-07-08 19:14:43 -0700 (Fri, 08 Jul 2016)

Log Message

Cleanup: Remove use of PassRefPtr from class HTMLTableElement
https://bugs.webkit.org/show_bug.cgi?id=159587

Reviewed by Chris Dumez.

* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::setCaption): Take a rvalue reference to a RefPtr instead of a PassRefPtr.
(WebCore::HTMLTableElement::setTHead): Take a rvalue reference to a RefPtr instead of a PassRefPtr. Also
fix a style nit; add curly braces around the for-loop body since its body is more than a single line.
(WebCore::HTMLTableElement::createTHead): Use Ref::copyRef() instead of Ref::ptr() to pass the instantiated
table section to better convey that we are passing a copy of the table section.
(WebCore::HTMLTableElement::createCaption): Ditto.
* html/HTMLTableElement.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203015 => 203016)


--- trunk/Source/WebCore/ChangeLog	2016-07-09 01:29:55 UTC (rev 203015)
+++ trunk/Source/WebCore/ChangeLog	2016-07-09 02:14:43 UTC (rev 203016)
@@ -1,5 +1,21 @@
 2016-07-08  Daniel Bates  <[email protected]>
 
+        Cleanup: Remove use of PassRefPtr from class HTMLTableElement
+        https://bugs.webkit.org/show_bug.cgi?id=159587
+
+        Reviewed by Chris Dumez.
+
+        * html/HTMLTableElement.cpp:
+        (WebCore::HTMLTableElement::setCaption): Take a rvalue reference to a RefPtr instead of a PassRefPtr.
+        (WebCore::HTMLTableElement::setTHead): Take a rvalue reference to a RefPtr instead of a PassRefPtr. Also
+        fix a style nit; add curly braces around the for-loop body since its body is more than a single line.
+        (WebCore::HTMLTableElement::createTHead): Use Ref::copyRef() instead of Ref::ptr() to pass the instantiated
+        table section to better convey that we are passing a copy of the table section.
+        (WebCore::HTMLTableElement::createCaption): Ditto.
+        * html/HTMLTableElement.h:
+
+2016-07-08  Daniel Bates  <[email protected]>
+
         Move shouldInheritSecurityOriginFromOwner() from URL to Document
         https://bugs.webkit.org/show_bug.cgi?id=158987
 

Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (203015 => 203016)


--- trunk/Source/WebCore/html/HTMLTableElement.cpp	2016-07-09 01:29:55 UTC (rev 203015)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp	2016-07-09 02:14:43 UTC (rev 203016)
@@ -77,7 +77,7 @@
     return nullptr;
 }
 
-void HTMLTableElement::setCaption(PassRefPtr<HTMLTableCaptionElement> newCaption, ExceptionCode& ec)
+void HTMLTableElement::setCaption(RefPtr<HTMLTableCaptionElement>&& newCaption, ExceptionCode& ec)
 {
     deleteCaption();
     if (newCaption)
@@ -93,7 +93,7 @@
     return nullptr;
 }
 
-void HTMLTableElement::setTHead(PassRefPtr<HTMLTableSectionElement> newHead, ExceptionCode& ec)
+void HTMLTableElement::setTHead(RefPtr<HTMLTableSectionElement>&& newHead, ExceptionCode& ec)
 {
     if (UNLIKELY(newHead && !newHead->hasTagName(theadTag))) {
         ec = HIERARCHY_REQUEST_ERR;
@@ -106,9 +106,10 @@
         return;
 
     Node* child;
-    for (child = firstChild(); child; child = child->nextSibling())
+    for (child = firstChild(); child; child = child->nextSibling()) {
         if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
             break;
+    }
 
     insertBefore(*newHead, child, ec);
 }
@@ -142,7 +143,7 @@
     if (HTMLTableSectionElement* existingHead = tHead())
         return *existingHead;
     Ref<HTMLTableSectionElement> head = HTMLTableSectionElement::create(theadTag, document());
-    setTHead(head.ptr(), IGNORE_EXCEPTION);
+    setTHead(head.copyRef(), IGNORE_EXCEPTION);
     return head;
 }
 
@@ -180,7 +181,7 @@
     if (HTMLTableCaptionElement* existingCaption = caption())
         return *existingCaption;
     Ref<HTMLTableCaptionElement> caption = HTMLTableCaptionElement::create(captionTag, document());
-    setCaption(caption.ptr(), IGNORE_EXCEPTION);
+    setCaption(caption.copyRef(), IGNORE_EXCEPTION);
     return caption;
 }
 

Modified: trunk/Source/WebCore/html/HTMLTableElement.h (203015 => 203016)


--- trunk/Source/WebCore/html/HTMLTableElement.h	2016-07-09 01:29:55 UTC (rev 203015)
+++ trunk/Source/WebCore/html/HTMLTableElement.h	2016-07-09 02:14:43 UTC (rev 203016)
@@ -41,10 +41,10 @@
     static Ref<HTMLTableElement> create(const QualifiedName&, Document&);
 
     HTMLTableCaptionElement* caption() const;
-    void setCaption(PassRefPtr<HTMLTableCaptionElement>, ExceptionCode&);
+    void setCaption(RefPtr<HTMLTableCaptionElement>&&, ExceptionCode&);
 
     HTMLTableSectionElement* tHead() const;
-    void setTHead(PassRefPtr<HTMLTableSectionElement>, ExceptionCode&);
+    void setTHead(RefPtr<HTMLTableSectionElement>&&, ExceptionCode&);
 
     HTMLTableSectionElement* tFoot() const;
     void setTFoot(RefPtr<HTMLTableSectionElement>&&, ExceptionCode&);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to