Changeset 122636 in webkit


Ignore:
Timestamp:
Jul 13, 2012 3:37:58 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Arpita Bahuguna <arpitabahuguna@gmail.com> 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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122635 r122636  
     12012-07-13  Arpita Bahuguna  <arpitabahuguna@gmail.com>
     2
     3        Refactor RenderTable to use the section's iteration functions.
     4        https://bugs.webkit.org/show_bug.cgi?id=89751
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        Removing anti-pattern wherever possible from RenderTable code. Also, modifying
     9        RenderTable sections' iterations to use helper functions.
     10
     11        No new tests required for this change since no change in behavior is expected.
     12
     13        * rendering/RenderTable.cpp:
     14        (WebCore::RenderTable::addOverflowFromChildren):
     15        (WebCore::RenderTable::setCellLogicalWidths):
     16        (WebCore::RenderTable::outerBorderStart):
     17        (WebCore::RenderTable::outerBorderEnd):
     18        Removed anti-patterns involving iterations over RenderObjects.
     19
     20        (WebCore::RenderTable::outerBorderAfter):
     21        Modified RenderTable sections' iteration to use helper functions.
     22
    1232012-07-13  Enrica Casucci  <enrica@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r121309 r122636  
    522522
    523523    // Add overflow from our sections.
    524     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    525         if (child->isTableSection()) {
    526             RenderTableSection* section = toRenderTableSection(child);
    527             addOverflowFromChild(section);
    528         }
    529     }
     524    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
     525        addOverflowFromChild(section);
    530526}
    531527
    532528void RenderTable::setCellLogicalWidths()
    533529{
    534     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    535         if (child->isTableSection())
    536             toRenderTableSection(child)->setCellLogicalWidths();
    537     }
     530    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
     531        section->setCellLogicalWidths();
    538532}
    539533
     
    1001995        return 0;
    1002996    int borderWidth = 0;
    1003     RenderTableSection* bottomSection;
    1004     if (m_foot)
    1005         bottomSection = m_foot;
    1006     else {
    1007         RenderObject* child;
    1008         for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { }
    1009         bottomSection = child ? toRenderTableSection(child) : 0;
    1010     }
    1011     if (bottomSection) {
    1012         borderWidth = bottomSection->outerBorderAfter();
     997
     998    if (RenderTableSection* section = bottomSection()) {
     999        borderWidth = section->outerBorderAfter();
    10131000        if (borderWidth < 0)
    1014             return 0;   // Overridden by hidden
     1001            return 0; // Overridden by hidden
    10151002    }
    10161003    const BorderValue& tb = style()->borderAfter();
     
    10361023
    10371024    bool allHidden = true;
    1038     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    1039         if (!child->isTableSection())
    1040             continue;
    1041         int sw = toRenderTableSection(child)->outerBorderStart();
     1025    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
     1026        int sw = section->outerBorderStart();
    10421027        if (sw < 0)
    10431028            continue;
     
    10651050
    10661051    bool allHidden = true;
    1067     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
    1068         if (!child->isTableSection())
    1069             continue;
    1070         int sw = toRenderTableSection(child)->outerBorderEnd();
     1052    for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) {
     1053        int sw = section->outerBorderEnd();
    10711054        if (sw < 0)
    10721055            continue;
Note: See TracChangeset for help on using the changeset viewer.