OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 | 1530 |
1531 minLogicalWidth = std::max(minLogicalWidth, inlineMin); | 1531 minLogicalWidth = std::max(minLogicalWidth, inlineMin); |
1532 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); | 1532 maxLogicalWidth = std::max(maxLogicalWidth, inlineMax); |
1533 } | 1533 } |
1534 | 1534 |
1535 static bool isInlineWithOutlineAndContinuation(const LayoutObject& o) | 1535 static bool isInlineWithOutlineAndContinuation(const LayoutObject& o) |
1536 { | 1536 { |
1537 return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContin
uation() && toLayoutInline(o).continuation(); | 1537 return o.isLayoutInline() && o.styleRef().hasOutline() && !o.isElementContin
uation() && toLayoutInline(o).continuation(); |
1538 } | 1538 } |
1539 | 1539 |
| 1540 static inline bool shouldTruncateOverflowingText(const LayoutBlockFlow* block) |
| 1541 { |
| 1542 const LayoutObject* objectToCheck = block; |
| 1543 if (block->isAnonymousBlock()) { |
| 1544 const LayoutObject* parent = block->parent(); |
| 1545 if (!parent || !parent->behavesLikeBlockContainer()) |
| 1546 return false; |
| 1547 objectToCheck = parent; |
| 1548 } |
| 1549 return objectToCheck->hasOverflowClip() && objectToCheck->style()->getTextOv
erflow(); |
| 1550 } |
| 1551 |
1540 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni
t afterEdge) | 1552 void LayoutBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& pa
intInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUni
t afterEdge) |
1541 { | 1553 { |
1542 // Figure out if we should clear out our line boxes. | 1554 // Figure out if we should clear out our line boxes. |
1543 // FIXME: Handle resize eventually! | 1555 // FIXME: Handle resize eventually! |
1544 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
; | 1556 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
; |
1545 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint
InvalidationLogicalBottom); | 1557 LineLayoutState layoutState(isFullLayout, paintInvalidationLogicalTop, paint
InvalidationLogicalBottom); |
1546 | 1558 |
1547 if (isFullLayout) { | 1559 if (isFullLayout) { |
1548 // Ensure the old line boxes will be erased. | 1560 // Ensure the old line boxes will be erased. |
1549 if (firstLineBox()) | 1561 if (firstLineBox()) |
1550 setShouldDoFullPaintInvalidation(); | 1562 setShouldDoFullPaintInvalidation(); |
1551 lineBoxes()->deleteLineBoxes(); | 1563 lineBoxes()->deleteLineBoxes(); |
1552 } | 1564 } |
1553 | 1565 |
1554 // Text truncation kicks in in two cases: | 1566 // Text truncation kicks in if overflow isn't visible and text-overflow isn'
t 'clip'. If this is |
1555 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. | 1567 // an anonymous block, we have to examine the parent. |
1556 // 2) If you're an anonymous block with a block parent that satisfies #1
that was created | |
1557 // to accommodate a block that has inline and block children. This ex
cludes parents where | |
1558 // canCollapseAnonymousBlockChild is false, notably flex items and gr
id items. | |
1559 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely | 1568 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely |
1560 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the | 1569 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the |
1561 // simple case of an anonymous block truncating when it's parent is clipped. | 1570 // simple case of an anonymous block truncating when its parent is clipped. |
1562 bool hasTextOverflow = (style()->getTextOverflow() && hasOverflowClip()) | 1571 bool hasTextOverflow = shouldTruncateOverflowingText(this); |
1563 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay
outBlock(parent())->canCollapseAnonymousBlockChild() | |
1564 && parent()->style()->getTextOverflow() && parent()->hasOverflowClip
()); | |
1565 | 1572 |
1566 // Walk all the lines and delete our ellipsis line boxes if they exist. | 1573 // Walk all the lines and delete our ellipsis line boxes if they exist. |
1567 if (hasTextOverflow) | 1574 if (hasTextOverflow) |
1568 deleteEllipsisLineBoxes(); | 1575 deleteEllipsisLineBoxes(); |
1569 | 1576 |
1570 if (firstChild()) { | 1577 if (firstChild()) { |
1571 for (InlineWalker walker(LineLayoutBlockFlow(this)); !walker.atEnd(); wa
lker.advance()) { | 1578 for (InlineWalker walker(LineLayoutBlockFlow(this)); !walker.atEnd(); wa
lker.advance()) { |
1572 LayoutObject* o = walker.current().layoutObject(); | 1579 LayoutObject* o = walker.current().layoutObject(); |
1573 | 1580 |
1574 if (!layoutState.hasInlineChild() && o->isInline()) | 1581 if (!layoutState.hasInlineChild() && o->isInline()) |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 if (!line || !line->isFirstLineStyle()) | 2088 if (!line || !line->isFirstLineStyle()) |
2082 return reason; | 2089 return reason; |
2083 // It's the RootInlineBox that paints the ::first-line background. Note that
since it may be | 2090 // It's the RootInlineBox that paints the ::first-line background. Note that
since it may be |
2084 // expensive to figure out if the first line is affected by any ::first-line
selectors at all, | 2091 // expensive to figure out if the first line is affected by any ::first-line
selectors at all, |
2085 // we just invalidate it unconditionally, since that's typically cheaper. | 2092 // we just invalidate it unconditionally, since that's typically cheaper. |
2086 invalidateDisplayItemClient(*line); | 2093 invalidateDisplayItemClient(*line); |
2087 return reason; | 2094 return reason; |
2088 } | 2095 } |
2089 | 2096 |
2090 } // namespace blink | 2097 } // namespace blink |
OLD | NEW |