Changeset 86222 in webkit


Ignore:
Timestamp:
May 11, 2011 12:11:18 AM (13 years ago)
Author:
eae@chromium.org
Message:

2011-05-11 Emil A Eklund <eae@chromium.org>

Reviewed by Eric Seidel.

Convert RenderFlexibleBox to use IntPoint/IntSize instead of x,y/w,h pairs
https://bugs.webkit.org/show_bug.cgi?id=60592

Refactoring, covered by existing tests.

  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock): (WebCore::RenderFlexibleBox::layoutHorizontalBox): (WebCore::RenderFlexibleBox::layoutVerticalBox): (WebCore::RenderFlexibleBox::placeChild):
  • rendering/RenderFlexibleBox.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86217 r86222  
     12011-05-11  Emil A Eklund  <eae@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Convert RenderFlexibleBox to use IntPoint/IntSize instead of x,y/w,h pairs
     6        https://bugs.webkit.org/show_bug.cgi?id=60592
     7
     8        Refactoring, covered by existing tests.
     9
     10        * rendering/RenderFlexibleBox.cpp:
     11        (WebCore::RenderFlexibleBox::layoutBlock):
     12        (WebCore::RenderFlexibleBox::layoutHorizontalBox):
     13        (WebCore::RenderFlexibleBox::layoutVerticalBox):
     14        (WebCore::RenderFlexibleBox::placeChild):
     15        * rendering/RenderFlexibleBox.h:
     16
    1172011-05-10  Ilya Tikhonovsky  <loislo@chromium.org>
    218
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r86098 r86222  
    210210    LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
    211211
    212     int previousWidth = width();
    213     int previousHeight = height();
     212    IntSize previousSize = size();
    214213
    215214    computeLogicalWidth();
     
    218217    m_overflow.clear();
    219218
    220     if (previousWidth != width() || previousHeight != height() ||
    221         (parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL &&
    222         parent()->style()->boxAlign() == BSTRETCH))
     219    if (previousSize != size()
     220        || (parent()->isFlexibleBox() && parent()->style()->boxOrient() == HORIZONTAL
     221        && parent()->style()->boxAlign() == BSTRETCH))
    223222        relayoutChildren = true;
    224223
     
    245244    computeLogicalHeight();
    246245
    247     if (previousHeight != height())
     246    if (previousSize.height() != height())
    248247        relayoutChildren = true;
    249248
     
    443442            }
    444443
    445             placeChild(child, xPos, childY);
     444            placeChild(child, IntPoint(xPos, childY));
    446445
    447446            xPos += child->width() + child->marginRight();
     
    568567                    --totalChildren;
    569568
    570                     placeChild(child, child->x() + offset, child->y());
     569                    placeChild(child, child->location() + IntSize(offset, 0));
    571570                }
    572571            }
     
    580579                    continue;
    581580
    582                 placeChild(child, child->x() + offset, child->y());
     581                placeChild(child, child->location() + IntSize(offset, 0));
    583582            }
    584583        }
     
    673672
    674673            // Place the child.
    675             placeChild(child, childX, height());
     674            placeChild(child, IntPoint(childX, height()));
    676675            setHeight(height() + child->height() + child->marginBottom());
    677676        }
     
    811810                    remainingSpace -= (remainingSpace/totalChildren);
    812811                    --totalChildren;
    813                     placeChild(child, child->x(), child->y() + offset);
     812                    placeChild(child, child->location() + IntSize(0, offset));
    814813                }
    815814            }
     
    822821                if (child->isPositioned())
    823822                    continue;
    824                 placeChild(child, child->x(), child->y() + offset);
     823                placeChild(child, child->location() + IntSize(0, offset));
    825824            }
    826825        }
     
    935934}
    936935
    937 void RenderFlexibleBox::placeChild(RenderBox* child, int x, int y)
    938 {
    939     IntRect oldRect(child->x(), child->y() , child->width(), child->height());
     936void RenderFlexibleBox::placeChild(RenderBox* child, IntPoint location)
     937{
     938    IntRect oldRect = child->frameRect();
    940939
    941940    // Place the child.
    942     child->setLocation(x, y);
     941    child->setLocation(location);
    943942
    944943    // If the child moved, we have to repaint it as well as any floating/positioned
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r68276 r86222  
    5151    virtual bool isStretchingChildren() const { return m_stretchingChildren; }
    5252
    53     void placeChild(RenderBox* child, int x, int y);
     53    void placeChild(RenderBox* child, IntPoint location);
    5454
    5555protected:
Note: See TracChangeset for help on using the changeset viewer.