Changeset 150642 in webkit


Ignore:
Timestamp:
May 24, 2013 9:18:16 AM (11 years ago)
Author:
robert@webkit.org
Message:

Refactor shouldAddBorderPaddingMargin()
https://bugs.webkit.org/show_bug.cgi?id=98803

Reviewed by Ryosuke Niwa.

Make this helper function less clever-stupid in its misguided sacrifice of intelligibility
for the sake of concision.

No new tests, refactoring.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::shouldAddBorderPaddingMargin):
(WebCore::inlineLogicalWidth):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150635 r150642  
     12013-05-24  Robert Hogan  <robert@webkit.org>
     2
     3        Refactor shouldAddBorderPaddingMargin()
     4        https://bugs.webkit.org/show_bug.cgi?id=98803
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Make this helper function less clever-stupid in its misguided sacrifice of intelligibility
     9        for the sake of concision.
     10
     11        No new tests, refactoring.
     12
     13        * rendering/RenderBlockLineLayout.cpp:
     14        (WebCore::shouldAddBorderPaddingMargin):
     15        (WebCore::inlineLogicalWidth):
     16
    1172013-05-24  Xiaobo Wang  <xiaobwang@blackberry.com>
    218
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r150602 r150642  
    349349}
    350350
    351 static bool shouldAddBorderPaddingMargin(RenderObject* child, bool &checkSide)
    352 {
    353     if (!child || (child->isText() && !toRenderText(child)->textLength()))
    354         return true;
    355     checkSide = false;
    356     return checkSide;
     351static inline bool shouldAddBorderPaddingMargin(RenderObject* child)
     352{
     353    // When deciding whether we're at the edge of an inline, adjacent collapsed whitespace is the same as no sibling at all.
     354    return !child || (child->isText() && !toRenderText(child)->textLength());
    357355}
    358356
     
    365363}
    366364
    367 static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, bool end = true)
     365static LayoutUnit inlineLogicalWidth(RenderObject* child, bool checkStartEdge = true, bool checkEndEdge = true)
    368366{
    369367    unsigned lineDepth = 1;
     
    373371        RenderInline* parentAsRenderInline = toRenderInline(parent);
    374372        if (!isEmptyInline(parentAsRenderInline)) {
    375             if (start && shouldAddBorderPaddingMargin(previousInFlowSibling(child), start))
     373            checkStartEdge = checkStartEdge && shouldAddBorderPaddingMargin(previousInFlowSibling(child));
     374            if (checkStartEdge)
    376375                extraWidth += borderPaddingMarginStart(parentAsRenderInline);
    377             if (end && shouldAddBorderPaddingMargin(child->nextSibling(), end))
     376            checkEndEdge = checkEndEdge && shouldAddBorderPaddingMargin(child->nextSibling());
     377            if (checkEndEdge)
    378378                extraWidth += borderPaddingMarginEnd(parentAsRenderInline);
    379             if (!start && !end)
     379            if (!checkStartEdge && !checkEndEdge)
    380380                return extraWidth;
    381381        }
Note: See TracChangeset for help on using the changeset viewer.