Title: [122636] trunk/Source/WebCore
Revision
122636
Author
[email protected]
Date
2012-07-13 15:37:58 -0700 (Fri, 13 Jul 2012)

Log Message

Refactor RenderTable to use the section's iteration functions.
https://bugs.webkit.org/show_bug.cgi?id=89751

Patch by Arpita Bahuguna <[email protected]> on 2012-07-13
Reviewed by Julien Chaffraix.

Removing anti-pattern wherever possible from RenderTable code. Also, modifying
RenderTable sections' iterations to use helper functions.

No new tests required for this change since no change in behavior is expected.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::addOverflowFromChildren):
(WebCore::RenderTable::setCellLogicalWidths):
(WebCore::RenderTable::outerBorderStart):
(WebCore::RenderTable::outerBorderEnd):
Removed anti-patterns involving iterations over RenderObjects.

(WebCore::RenderTable::outerBorderAfter):
Modified RenderTable sections' iteration to use helper functions.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122635 => 122636)


--- trunk/Source/WebCore/ChangeLog	2012-07-13 22:35:11 UTC (rev 122635)
+++ trunk/Source/WebCore/ChangeLog	2012-07-13 22:37:58 UTC (rev 122636)
@@ -1,3 +1,25 @@
+2012-07-13  Arpita Bahuguna  <[email protected]>
+
+        Refactor RenderTable to use the section's iteration functions.
+        https://bugs.webkit.org/show_bug.cgi?id=89751
+
+        Reviewed by Julien Chaffraix.
+
+        Removing anti-pattern wherever possible from RenderTable code. Also, modifying
+        RenderTable sections' iterations to use helper functions.
+
+        No new tests required for this change since no change in behavior is expected.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::addOverflowFromChildren):
+        (WebCore::RenderTable::setCellLogicalWidths):
+        (WebCore::RenderTable::outerBorderStart):
+        (WebCore::RenderTable::outerBorderEnd):
+        Removed anti-patterns involving iterations over RenderObjects.
+
+        (WebCore::RenderTable::outerBorderAfter):
+        Modified RenderTable sections' iteration to use helper functions.
+
 2012-07-13  Enrica Casucci  <[email protected]>
 
         Threadsafety issues in WebScriptObject

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (122635 => 122636)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-07-13 22:35:11 UTC (rev 122635)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-07-13 22:37:58 UTC (rev 122636)
@@ -521,20 +521,14 @@
         addOverflowFromChild(m_captions[i]);
 
     // Add overflow from our sections.
-    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->isTableSection()) {
-            RenderTableSection* section = toRenderTableSection(child);
-            addOverflowFromChild(section);
-        }
-    }
+    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
+        addOverflowFromChild(section);
 }
 
 void RenderTable::setCellLogicalWidths()
 {
-    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->isTableSection())
-            toRenderTableSection(child)->setCellLogicalWidths();
-    }
+    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
+        section->setCellLogicalWidths();
 }
 
 void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
@@ -1000,18 +994,11 @@
     if (!collapseBorders())
         return 0;
     int borderWidth = 0;
-    RenderTableSection* bottomSection;
-    if (m_foot)
-        bottomSection = m_foot;
-    else {
-        RenderObject* child;
-        for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { }
-        bottomSection = child ? toRenderTableSection(child) : 0;
-    }
-    if (bottomSection) {
-        borderWidth = bottomSection->outerBorderAfter();
+
+    if (RenderTableSection* section = bottomSection()) {
+        borderWidth = section->outerBorderAfter();
         if (borderWidth < 0)
-            return 0;   // Overridden by hidden
+            return 0; // Overridden by hidden
     }
     const BorderValue& tb = style()->borderAfter();
     if (tb.style() == BHIDDEN)
@@ -1035,10 +1022,8 @@
         borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2;
 
     bool allHidden = true;
-    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (!child->isTableSection())
-            continue;
-        int sw = toRenderTableSection(child)->outerBorderStart();
+    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
+        int sw = section->outerBorderStart();
         if (sw < 0)
             continue;
         allHidden = false;
@@ -1064,10 +1049,8 @@
         borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2;
 
     bool allHidden = true;
-    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
-        if (!child->isTableSection())
-            continue;
-        int sw = toRenderTableSection(child)->outerBorderEnd();
+    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
+        int sw = section->outerBorderEnd();
         if (sw < 0)
             continue;
         allHidden = false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to