OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 return false; | 1416 return false; |
1417 } | 1417 } |
1418 return true; | 1418 return true; |
1419 } | 1419 } |
1420 | 1420 |
1421 LayoutUnit InlineFlowBox::placeEllipsisBox(bool ltr, | 1421 LayoutUnit InlineFlowBox::placeEllipsisBox(bool ltr, |
1422 LayoutUnit blockLeftEdge, | 1422 LayoutUnit blockLeftEdge, |
1423 LayoutUnit blockRightEdge, | 1423 LayoutUnit blockRightEdge, |
1424 LayoutUnit ellipsisWidth, | 1424 LayoutUnit ellipsisWidth, |
1425 LayoutUnit& truncatedWidth, | 1425 LayoutUnit& truncatedWidth, |
1426 bool& foundBox) { | 1426 bool& foundBox, |
| 1427 LayoutUnit logicalLeftOffset) { |
1427 LayoutUnit result(-1); | 1428 LayoutUnit result(-1); |
1428 // We iterate over all children, the foundBox variable tells us when we've | 1429 // We iterate over all children, the foundBox variable tells us when we've |
1429 // found the box containing the ellipsis. All boxes after that one in the | 1430 // found the box containing the ellipsis. All boxes after that one in the |
1430 // flow are hidden. | 1431 // flow are hidden. |
1431 // If our flow is ltr then iterate over the boxes from left to right, | 1432 // If our flow is ltr then iterate over the boxes from left to right, |
1432 // otherwise iterate from right to left. Varying the order allows us to | 1433 // otherwise iterate from right to left. Varying the order allows us to |
1433 // correctly hide the boxes following the ellipsis. | 1434 // correctly hide the boxes following the ellipsis. |
1434 InlineBox* box = ltr ? firstChild() : lastChild(); | 1435 InlineBox* box = ltr ? firstChild() : lastChild(); |
1435 | 1436 |
1436 // NOTE: these will cross after foundBox = true. | 1437 // NOTE: these will cross after foundBox = true. |
1437 LayoutUnit visibleLeftEdge = blockLeftEdge; | 1438 LayoutUnit visibleLeftEdge = blockLeftEdge; |
1438 LayoutUnit visibleRightEdge = blockRightEdge; | 1439 LayoutUnit visibleRightEdge = blockRightEdge; |
1439 | 1440 |
1440 while (box) { | 1441 while (box) { |
1441 LayoutUnit currResult = box->placeEllipsisBox( | 1442 LayoutUnit currResult = box->placeEllipsisBox( |
1442 ltr, LayoutUnit(visibleLeftEdge), LayoutUnit(visibleRightEdge), | 1443 ltr, visibleLeftEdge, visibleRightEdge, ellipsisWidth, truncatedWidth, |
1443 ellipsisWidth, truncatedWidth, foundBox); | 1444 foundBox, logicalLeftOffset); |
1444 if (currResult != -1 && result == -1) | 1445 if (currResult != -1 && result == -1) |
1445 result = currResult; | 1446 result = currResult; |
1446 | 1447 |
1447 // List markers will sit outside the box so don't let them contribute | 1448 // List markers will sit outside the box so don't let them contribute |
1448 // width. | 1449 // width. |
1449 LayoutUnit boxWidth = box->getLineLayoutItem().isListMarker() | 1450 LayoutUnit boxWidth = box->getLineLayoutItem().isListMarker() |
1450 ? LayoutUnit() | 1451 ? LayoutUnit() |
1451 : box->logicalWidth(); | 1452 : box->logicalWidth(); |
1452 if (ltr) { | 1453 if (ltr) { |
1453 visibleLeftEdge += boxWidth; | 1454 visibleLeftEdge += boxWidth; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 ASSERT(child->prevOnLine() == prev); | 1688 ASSERT(child->prevOnLine() == prev); |
1688 prev = child; | 1689 prev = child; |
1689 } | 1690 } |
1690 ASSERT(prev == m_lastChild); | 1691 ASSERT(prev == m_lastChild); |
1691 #endif | 1692 #endif |
1692 } | 1693 } |
1693 | 1694 |
1694 #endif | 1695 #endif |
1695 | 1696 |
1696 } // namespace blink | 1697 } // namespace blink |
OLD | NEW |