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 if (isFullLayout) { | 1530 if (isFullLayout) { |
1531 // Ensure the old line boxes will be erased. | 1531 // Ensure the old line boxes will be erased. |
1532 if (firstLineBox()) | 1532 if (firstLineBox()) |
1533 setShouldDoFullPaintInvalidation(); | 1533 setShouldDoFullPaintInvalidation(); |
1534 lineBoxes()->deleteLineBoxes(); | 1534 lineBoxes()->deleteLineBoxes(); |
1535 } | 1535 } |
1536 | 1536 |
1537 // Text truncation kicks in in two cases: | 1537 // Text truncation kicks in in two cases: |
1538 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. | 1538 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. |
1539 // 2) If you're an anonymous block with a block parent that satisfies #1
that was created | 1539 // 2) If you're an anonymous block with a block parent that satisfies #1
that was created |
1540 // to accomodate a block that has inline and block children. This exc
ludes parents where | 1540 // to accommodate a block that has inline and block children. This ex
cludes parents where |
1541 // canCollapseAnonymousBlockChild is false, notabley flex items and g
rid items. | 1541 // canCollapseAnonymousBlockChild is false, notably flex items and gr
id items. |
1542 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely | 1542 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely |
1543 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the | 1543 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the |
1544 // simple case of an anonymous block truncating when it's parent is clipped. | 1544 // simple case of an anonymous block truncating when it's parent is clipped. |
1545 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) | 1545 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) |
1546 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay
outBlock(parent())->canCollapseAnonymousBlockChild() | 1546 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay
outBlock(parent())->canCollapseAnonymousBlockChild() |
1547 && parent()->style()->textOverflow() && parent()->hasOverflowClip())
; | 1547 && parent()->style()->textOverflow() && parent()->hasOverflowClip())
; |
1548 | 1548 |
1549 // Walk all the lines and delete our ellipsis line boxes if they exist. | 1549 // Walk all the lines and delete our ellipsis line boxes if they exist. |
1550 if (hasTextOverflow) | 1550 if (hasTextOverflow) |
1551 deleteEllipsisLineBoxes(); | 1551 deleteEllipsisLineBoxes(); |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 } | 1910 } |
1911 | 1911 |
1912 void LayoutBlockFlow::deleteEllipsisLineBoxes() | 1912 void LayoutBlockFlow::deleteEllipsisLineBoxes() |
1913 { | 1913 { |
1914 ETextAlign textAlign = style()->textAlign(); | 1914 ETextAlign textAlign = style()->textAlign(); |
1915 bool firstLine = true; | 1915 bool firstLine = true; |
1916 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ | 1916 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ |
1917 if (curr->hasEllipsisBox()) { | 1917 if (curr->hasEllipsisBox()) { |
1918 curr->clearTruncation(); | 1918 curr->clearTruncation(); |
1919 | 1919 |
1920 // Shift the line back where it belongs if we cannot accomodate an e
llipsis. | 1920 // Shift the line back where it belongs if we cannot accommodate an
ellipsis. |
1921 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), f
irstLine); | 1921 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), f
irstLine); |
1922 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l
ineTop(), false) - logicalLeft; | 1922 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l
ineTop(), false) - logicalLeft; |
1923 LayoutUnit totalLogicalWidth = curr->logicalWidth(); | 1923 LayoutUnit totalLogicalWidth = curr->logicalWidth(); |
1924 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota
lLogicalWidth, availableLogicalWidth, 0); | 1924 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota
lLogicalWidth, availableLogicalWidth, 0); |
1925 | 1925 |
1926 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft()); | 1926 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft()); |
1927 } | 1927 } |
1928 firstLine = false; | 1928 firstLine = false; |
1929 } | 1929 } |
1930 } | 1930 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2066 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2066 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2067 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; | 2067 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; |
2068 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2068 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2069 | 2069 |
2070 if (!style()->isLeftToRightDirection()) | 2070 if (!style()->isLeftToRightDirection()) |
2071 return logicalWidth() - logicalLeft; | 2071 return logicalWidth() - logicalLeft; |
2072 return logicalLeft; | 2072 return logicalLeft; |
2073 } | 2073 } |
2074 | 2074 |
2075 } | 2075 } |
OLD | NEW |