Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1583783002: Use IndentTextOrNot instead of a bool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@568851-2
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 if (offset > contentSideWithMargin) 1545 if (offset > contentSideWithMargin)
1546 return childMargin; 1546 return childMargin;
1547 return offset - contentSide; 1547 return offset - contentSide;
1548 } 1548 }
1549 1549
1550 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar t, LayoutUnit childMarginEnd, const LayoutBlockFlow* cb) const 1550 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar t, LayoutUnit childMarginEnd, const LayoutBlockFlow* cb) const
1551 { 1551 {
1552 LayoutUnit logicalTopPosition = logicalTop(); 1552 LayoutUnit logicalTopPosition = logicalTop();
1553 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); 1553 LayoutUnit startOffsetForContent = cb->startOffsetForContent();
1554 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); 1554 LayoutUnit endOffsetForContent = cb->endOffsetForContent();
1555 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f alse); 1555 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, D oNotIndentText);
1556 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false ); 1556 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, DoNot IndentText);
1557 1557
1558 // If there aren't any floats constraining us then allow the margins to shri nk/expand the width as much as they want. 1558 // If there aren't any floats constraining us then allow the margins to shri nk/expand the width as much as they want.
1559 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en dOffsetForLine) 1559 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en dOffsetForLine)
1560 return cb->availableLogicalWidthForLine(logicalTopPosition, false) - chi ldMarginStart - childMarginEnd; 1560 return cb->availableLogicalWidthForLine(logicalTopPosition, DoNotIndentT ext) - childMarginStart - childMarginEnd;
1561 1561
1562 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals e) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUnit(), childMarg inEnd); 1562 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, DoNo tIndentText) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUnit(), childMarginEnd);
1563 // We need to see if margins on either the start side or the end side can co ntain the floats in question. If they can, 1563 // We need to see if margins on either the start side or the end side can co ntain the floats in question. If they can,
1564 // then just using the line width is inaccurate. In the case where a float c ompletely fits, we don't need to use the line 1564 // then just using the line width is inaccurate. In the case where a float c ompletely fits, we don't need to use the line
1565 // offset at all, but can instead push all the way to the content edge of th e containing block. In the case where the float 1565 // offset at all, but can instead push all the way to the content edge of th e containing block. In the case where the float
1566 // doesn't fit, we can use the line offset, but we need to grow it by the ma rgin to reflect the fact that the margin was 1566 // doesn't fit, we can use the line offset, but we need to grow it by the ma rgin to reflect the fact that the margin was
1567 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them. 1567 // "consumed" by the float. Negative margins aren't consumed by the float, a nd so we ignore them.
1568 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine); 1568 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC ontent, startOffsetForLine);
1569 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine); 1569 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte nt, endOffsetForLine);
1570 return width; 1570 return width;
1571 } 1571 }
1572 1572
(...skipping 27 matching lines...) Expand all
1600 return overrideContainingBlockContentLogicalHeight(); 1600 return overrideContainingBlockContentLogicalHeight();
1601 1601
1602 LayoutBlock* cb = containingBlock(); 1602 LayoutBlock* cb = containingBlock();
1603 return cb->availableLogicalHeight(heightType); 1603 return cb->availableLogicalHeight(heightType);
1604 } 1604 }
1605 1605
1606 LayoutUnit LayoutBox::containingBlockAvailableLineWidth() const 1606 LayoutUnit LayoutBox::containingBlockAvailableLineWidth() const
1607 { 1607 {
1608 LayoutBlock* cb = containingBlock(); 1608 LayoutBlock* cb = containingBlock();
1609 if (cb->isLayoutBlockFlow()) 1609 if (cb->isLayoutBlockFlow())
1610 return toLayoutBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), false, availableLogicalHeight(IncludeMarginBorderPadding)); 1610 return toLayoutBlockFlow(cb)->availableLogicalWidthForLine(logicalTop(), DoNotIndentText, availableLogicalHeight(IncludeMarginBorderPadding));
1611 return LayoutUnit(); 1611 return LayoutUnit();
1612 } 1612 }
1613 1613
1614 LayoutUnit LayoutBox::perpendicularContainingBlockLogicalHeight() const 1614 LayoutUnit LayoutBox::perpendicularContainingBlockLogicalHeight() const
1615 { 1615 {
1616 if (hasOverrideContainingBlockLogicalHeight()) 1616 if (hasOverrideContainingBlockLogicalHeight())
1617 return overrideContainingBlockContentLogicalHeight(); 1617 return overrideContainingBlockContentLogicalHeight();
1618 1618
1619 LayoutBlock* cb = containingBlock(); 1619 LayoutBlock* cb = containingBlock();
1620 if (cb->hasOverrideLogicalContentHeight()) 1620 if (cb->hasOverrideLogicalContentHeight())
(...skipping 3264 matching lines...) Expand 10 before | Expand all | Expand 10 after
4885 } 4885 }
4886 4886
4887 void LayoutBox::clearPreviousPaintInvalidationRects() 4887 void LayoutBox::clearPreviousPaintInvalidationRects()
4888 { 4888 {
4889 LayoutBoxModelObject::clearPreviousPaintInvalidationRects(); 4889 LayoutBoxModelObject::clearPreviousPaintInvalidationRects();
4890 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea()) 4890 if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea())
4891 scrollableArea->clearPreviousPaintInvalidationRects(); 4891 scrollableArea->clearPreviousPaintInvalidationRects();
4892 } 4892 }
4893 4893
4894 } // namespace blink 4894 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698