| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 continue; | 937 continue; |
| 938 | 938 |
| 939 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' }; | 939 const UChar ellipsisAndSpace[2] = { horizontalEllipsis, ' ' }; |
| 940 DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace
, 2)); | 940 DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace
, 2)); |
| 941 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1))
; | 941 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1))
; |
| 942 const Font& font = style(numVisibleLines == 1)->font(); | 942 const Font& font = style(numVisibleLines == 1)->font(); |
| 943 | 943 |
| 944 // 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 | 944 // 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 |
| 945 LayoutUnit totalWidth; | 945 LayoutUnit totalWidth; |
| 946 InlineBox* anchorBox = lastLine->lastChild(); | 946 InlineBox* anchorBox = lastLine->lastChild(); |
| 947 if (anchorBox && anchorBox->renderer()->style()->isLink()) | 947 if (anchorBox && anchorBox->renderer().style()->isLink()) |
| 948 totalWidth = anchorBox->logicalWidth() + font.width(RenderBlockFlow:
:constructTextRun(this, font, ellipsisAndSpace, 2, style(), style()->direction()
)); | 948 totalWidth = anchorBox->logicalWidth() + font.width(RenderBlockFlow:
:constructTextRun(this, font, ellipsisAndSpace, 2, style(), style()->direction()
)); |
| 949 else { | 949 else { |
| 950 anchorBox = 0; | 950 anchorBox = 0; |
| 951 totalWidth = font.width(RenderBlockFlow::constructTextRun(this, font
, &horizontalEllipsis, 1, style(), style()->direction())); | 951 totalWidth = font.width(RenderBlockFlow::constructTextRun(this, font
, &horizontalEllipsis, 1, style(), style()->direction())); |
| 952 } | 952 } |
| 953 | 953 |
| 954 // See if this width can be accommodated on the last visible line | 954 // See if this width can be accommodated on the last visible line |
| 955 RenderBlockFlow* destBlock = lastVisibleLine->block(); | 955 RenderBlockFlow& destBlock = lastVisibleLine->block(); |
| 956 RenderBlockFlow* srcBlock = lastLine->block(); | 956 RenderBlockFlow& srcBlock = lastLine->block(); |
| 957 | 957 |
| 958 // FIXME: Directions of src/destBlock could be different from our direct
ion and from one another. | 958 // FIXME: Directions of src/destBlock could be different from our direct
ion and from one another. |
| 959 if (!srcBlock->style()->isLeftToRightDirection()) | 959 if (!srcBlock.style()->isLeftToRightDirection()) |
| 960 continue; | 960 continue; |
| 961 | 961 |
| 962 bool leftToRight = destBlock->style()->isLeftToRightDirection(); | 962 bool leftToRight = destBlock.style()->isLeftToRightDirection(); |
| 963 if (!leftToRight) | 963 if (!leftToRight) |
| 964 continue; | 964 continue; |
| 965 | 965 |
| 966 LayoutUnit blockRightEdge = destBlock->logicalRightOffsetForLine(lastVis
ibleLine->y(), false); | 966 LayoutUnit blockRightEdge = destBlock.logicalRightOffsetForLine(lastVisi
bleLine->y(), false); |
| 967 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockRight
Edge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) | 967 if (!lastVisibleLine->lineCanAccommodateEllipsis(leftToRight, blockRight
Edge, lastVisibleLine->x() + lastVisibleLine->logicalWidth(), totalWidth)) |
| 968 continue; | 968 continue; |
| 969 | 969 |
| 970 // Let the truncation code kick in. | 970 // Let the truncation code kick in. |
| 971 // FIXME: the text alignment should be recomputed after the width change
s due to truncation. | 971 // FIXME: the text alignment should be recomputed after the width change
s due to truncation. |
| 972 LayoutUnit blockLeftEdge = destBlock->logicalLeftOffsetForLine(lastVisib
leLine->y(), false); | 972 LayoutUnit blockLeftEdge = destBlock.logicalLeftOffsetForLine(lastVisibl
eLine->y(), false); |
| 973 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi
sStr, leftToRight, blockLeftEdge, blockRightEdge, totalWidth, anchorBox); | 973 lastVisibleLine->placeEllipsis(anchorBox ? ellipsisAndSpaceStr : ellipsi
sStr, leftToRight, blockLeftEdge, blockRightEdge, totalWidth, anchorBox); |
| 974 destBlock->setHasMarkupTruncation(true); | 974 destBlock.setHasMarkupTruncation(true); |
| 975 } | 975 } |
| 976 } | 976 } |
| 977 | 977 |
| 978 void RenderDeprecatedFlexibleBox::clearLineClamp() | 978 void RenderDeprecatedFlexibleBox::clearLineClamp() |
| 979 { | 979 { |
| 980 FlexBoxIterator iterator(this); | 980 FlexBoxIterator iterator(this); |
| 981 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { | 981 for (RenderBox* child = iterator.first(); child; child = iterator.next()) { |
| 982 if (childDoesNotAffectWidthOrFlexing(child)) | 982 if (childDoesNotAffectWidthOrFlexing(child)) |
| 983 continue; | 983 continue; |
| 984 | 984 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 if (isPseudoElement()) | 1078 if (isPseudoElement()) |
| 1079 return "RenderDeprecatedFlexibleBox (generated)"; | 1079 return "RenderDeprecatedFlexibleBox (generated)"; |
| 1080 if (isAnonymous()) | 1080 if (isAnonymous()) |
| 1081 return "RenderDeprecatedFlexibleBox (generated)"; | 1081 return "RenderDeprecatedFlexibleBox (generated)"; |
| 1082 if (isRelPositioned()) | 1082 if (isRelPositioned()) |
| 1083 return "RenderDeprecatedFlexibleBox (relative positioned)"; | 1083 return "RenderDeprecatedFlexibleBox (relative positioned)"; |
| 1084 return "RenderDeprecatedFlexibleBox"; | 1084 return "RenderDeprecatedFlexibleBox"; |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 } // namespace WebCore | 1087 } // namespace WebCore |
| OLD | NEW |