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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 if (isFullLayout) { | 1523 if (isFullLayout) { |
1524 // Ensure the old line boxes will be erased. | 1524 // Ensure the old line boxes will be erased. |
1525 if (firstLineBox()) | 1525 if (firstLineBox()) |
1526 setShouldDoFullPaintInvalidation(); | 1526 setShouldDoFullPaintInvalidation(); |
1527 lineBoxes()->deleteLineBoxes(); | 1527 lineBoxes()->deleteLineBoxes(); |
1528 } | 1528 } |
1529 | 1529 |
1530 // Text truncation kicks in in two cases: | 1530 // Text truncation kicks in in two cases: |
1531 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. | 1531 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. |
1532 // 2) If you're an anonymous block with a block parent that satisfies #1
that was created | 1532 // 2) If you're an anonymous block with a block parent that satisfies #1
that was created |
1533 // to accomodate a block that has inline and block children. This exc
ludes parents where | 1533 // to accommodate a block that has inline and block children. This ex
cludes parents where |
1534 // canCollapseAnonymousBlockChild is false, notabley flex items and g
rid items. | 1534 // canCollapseAnonymousBlockChild is false, notably flex items and gr
id items. |
1535 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely | 1535 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely |
1536 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the | 1536 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the |
1537 // simple case of an anonymous block truncating when it's parent is clipped. | 1537 // simple case of an anonymous block truncating when it's parent is clipped. |
1538 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) | 1538 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) |
1539 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay
outBlock(parent())->canCollapseAnonymousBlockChild() | 1539 || (isAnonymousBlock() && parent() && parent()->isLayoutBlock() && toLay
outBlock(parent())->canCollapseAnonymousBlockChild() |
1540 && parent()->style()->textOverflow() && parent()->hasOverflowClip())
; | 1540 && parent()->style()->textOverflow() && parent()->hasOverflowClip())
; |
1541 | 1541 |
1542 // Walk all the lines and delete our ellipsis line boxes if they exist. | 1542 // Walk all the lines and delete our ellipsis line boxes if they exist. |
1543 if (hasTextOverflow) | 1543 if (hasTextOverflow) |
1544 deleteEllipsisLineBoxes(); | 1544 deleteEllipsisLineBoxes(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 } | 1898 } |
1899 | 1899 |
1900 void LayoutBlockFlow::deleteEllipsisLineBoxes() | 1900 void LayoutBlockFlow::deleteEllipsisLineBoxes() |
1901 { | 1901 { |
1902 ETextAlign textAlign = style()->textAlign(); | 1902 ETextAlign textAlign = style()->textAlign(); |
1903 bool firstLine = true; | 1903 bool firstLine = true; |
1904 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ | 1904 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ |
1905 if (curr->hasEllipsisBox()) { | 1905 if (curr->hasEllipsisBox()) { |
1906 curr->clearTruncation(); | 1906 curr->clearTruncation(); |
1907 | 1907 |
1908 // Shift the line back where it belongs if we cannot accomodate an e
llipsis. | 1908 // Shift the line back where it belongs if we cannot accommodate an
ellipsis. |
1909 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), f
irstLine); | 1909 LayoutUnit logicalLeft = logicalLeftOffsetForLine(curr->lineTop(), f
irstLine); |
1910 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l
ineTop(), false) - logicalLeft; | 1910 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(curr->l
ineTop(), false) - logicalLeft; |
1911 LayoutUnit totalLogicalWidth = curr->logicalWidth(); | 1911 LayoutUnit totalLogicalWidth = curr->logicalWidth(); |
1912 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota
lLogicalWidth, availableLogicalWidth, 0); | 1912 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, tota
lLogicalWidth, availableLogicalWidth, 0); |
1913 | 1913 |
1914 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft()); | 1914 curr->moveInInlineDirection(logicalLeft - curr->logicalLeft()); |
1915 } | 1915 } |
1916 firstLine = false; | 1916 firstLine = false; |
1917 } | 1917 } |
1918 } | 1918 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); | 2054 LayoutUnit logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); |
2055 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; | 2055 LayoutUnit availableLogicalWidth = logicalRightOffsetForLine(logicalHeight()
, false) - logicalLeft; |
2056 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2056 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2057 | 2057 |
2058 if (!style()->isLeftToRightDirection()) | 2058 if (!style()->isLeftToRightDirection()) |
2059 return logicalWidth() - logicalLeft; | 2059 return logicalWidth() - logicalLeft; |
2060 return logicalLeft; | 2060 return logicalLeft; |
2061 } | 2061 } |
2062 | 2062 |
2063 } | 2063 } |
OLD | NEW |