| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the render object implementation for KHTML. | 2 * This file is part of the render object implementation for KHTML. |
| 3 * | 3 * |
| 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 6 * Copyright (C) 2003 Apple Computer, Inc. | 6 * Copyright (C) 2003 Apple Computer, Inc. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 888 |
| 889 // Get the last line | 889 // Get the last line |
| 890 RootInlineBox* lastLine = blockChild->lineAtIndex(lineCount - 1); | 890 RootInlineBox* lastLine = blockChild->lineAtIndex(lineCount - 1); |
| 891 if (!lastLine) | 891 if (!lastLine) |
| 892 continue; | 892 continue; |
| 893 | 893 |
| 894 RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines
- 1); | 894 RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines
- 1); |
| 895 if (!lastVisibleLine) | 895 if (!lastVisibleLine) |
| 896 continue; | 896 continue; |
| 897 | 897 |
| 898 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' }; | |
| 899 DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace
, 2)); | |
| 900 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1))
; | 898 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1))
; |
| 901 const Font& font = style(numVisibleLines == 1)->font(); | 899 const Font& font = style(numVisibleLines == 1)->font(); |
| 902 | 900 float totalWidth = font.width(constructTextRun(this, font, &horizontalEl
lipsis, 1, styleRef(), style()->direction())); |
| 903 // Get ellipsis width, and if the last child is an anchor, it will go af
ter the ellipsis, so add in a space and the anchor width too | |
| 904 float totalWidth; | |
| 905 InlineBox* anchorBox = lastLine->lastChild(); | |
| 906 if (anchorBox && anchorBox->layoutObject().style()->isLink()) { | |
| 907 totalWidth = anchorBox->logicalWidth() + font.width(constructTextRun
(this, font, ellipsisAndSpace, 2, styleRef(), style()->direction())); | |
| 908 } else { | |
| 909 anchorBox = 0; | |
| 910 totalWidth = font.width(constructTextRun(this, font, &horizontalElli
psis, 1, styleRef(), style()->direction())); | |
| 911 } | |
| 912 | 901 |
| 913 // See if this width can be accommodated on the last visible line | 902 // See if this width can be accommodated on the last visible line |
| 914 LayoutBlockFlow& destBlock = lastVisibleLine->block(); | 903 LayoutBlockFlow& destBlock = lastVisibleLine->block(); |
| 915 LayoutBlockFlow& srcBlock = lastLine->block(); | 904 LayoutBlockFlow& srcBlock = lastLine->block(); |
| 916 | 905 |
| 917 // FIXME: Directions of src/destBlock could be different from our direct
ion and from one another. | 906 // FIXME: Directions of src/destBlock could be different from our direct
ion and from one another. |
| 918 if (!srcBlock.style()->isLeftToRightDirection()) | 907 if (!srcBlock.style()->isLeftToRightDirection()) |
| 919 continue; | 908 continue; |
| 920 | 909 |
| 921 bool leftToRight = destBlock.style()->isLeftToRightDirection(); | 910 bool leftToRight = destBlock.style()->isLeftToRightDirection(); |
| 922 if (!leftToRight) | 911 if (!leftToRight) |
| 923 continue; | 912 continue; |
| 924 | 913 |
| 925 LayoutUnit blockRightEdge = destBlock.logicalRightOffsetForLine(lastVisi
bleLine->y(), false); | 914 LayoutUnit blockRightEdge = destBlock.logicalRightOffsetForLine(lastVisi
bleLine->y(), false); |
| 926 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockRight
Edge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) | 915 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockRight
Edge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) |
| 927 continue; | 916 continue; |
| 928 | 917 |
| 929 // Let the truncation code kick in. | 918 // Let the truncation code kick in. |
| 930 // FIXME: the text alignment should be recomputed after the width change
s due to truncation. | 919 // FIXME: the text alignment should be recomputed after the width change
s due to truncation. |
| 931 LayoutUnit blockLeftEdge = destBlock.logicalLeftOffsetForLine(lastVisibl
eLine->y(), false); | 920 LayoutUnit blockLeftEdge = destBlock.logicalLeftOffsetForLine(lastVisibl
eLine->y(), false); |
| 932 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi
sStr, leftToRight, blockLeftEdge.toFloat(), blockRightEdge.toFloat(), totalWidth
, anchorBox); | 921 lastVisibleLine->placeEllipsis(ellipsisStr, leftToRight, blockLeftEdge.t
oFloat(), blockRightEdge.toFloat(), totalWidth); |
| 933 destBlock.setHasMarkupTruncation(true); | 922 destBlock.setHasMarkupTruncation(true); |
| 934 } | 923 } |
| 935 } | 924 } |
| 936 | 925 |
| 937 void LayoutDeprecatedFlexibleBox::clearLineClamp() | 926 void LayoutDeprecatedFlexibleBox::clearLineClamp() |
| 938 { | 927 { |
| 939 FlexBoxIterator iterator(this); | 928 FlexBoxIterator iterator(this); |
| 940 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) { | 929 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) { |
| 941 if (childDoesNotAffectWidthOrFlexing(child)) | 930 if (childDoesNotAffectWidthOrFlexing(child)) |
| 942 continue; | 931 continue; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 if (isFloating()) | 1013 if (isFloating()) |
| 1025 return "LayoutDeprecatedFlexibleBox (floating)"; | 1014 return "LayoutDeprecatedFlexibleBox (floating)"; |
| 1026 if (isAnonymous()) | 1015 if (isAnonymous()) |
| 1027 return "LayoutDeprecatedFlexibleBox (anonymous)"; | 1016 return "LayoutDeprecatedFlexibleBox (anonymous)"; |
| 1028 if (isRelPositioned()) | 1017 if (isRelPositioned()) |
| 1029 return "LayoutDeprecatedFlexibleBox (relative positioned)"; | 1018 return "LayoutDeprecatedFlexibleBox (relative positioned)"; |
| 1030 return "LayoutDeprecatedFlexibleBox"; | 1019 return "LayoutDeprecatedFlexibleBox"; |
| 1031 } | 1020 } |
| 1032 | 1021 |
| 1033 } // namespace blink | 1022 } // namespace blink |
| OLD | NEW |