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 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 } | 1939 } |
1940 firstLine = false; | 1940 firstLine = false; |
1941 } | 1941 } |
1942 } | 1942 } |
1943 | 1943 |
1944 void LayoutBlockFlow::checkLinesForTextOverflow() | 1944 void LayoutBlockFlow::checkLinesForTextOverflow() |
1945 { | 1945 { |
1946 // Determine the width of the ellipsis using the current font. | 1946 // Determine the width of the ellipsis using the current font. |
1947 // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP
) if horizontal ellipsis is "not renderable" | 1947 // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP
) if horizontal ellipsis is "not renderable" |
1948 const Font& font = style()->font(); | 1948 const Font& font = style()->font(); |
1949 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1)); | 1949 DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsisCharacter
, 1)); |
1950 const Font& firstLineFont = firstLineStyle()->font(); | 1950 const Font& firstLineFont = firstLineStyle()->font(); |
1951 // FIXME: We should probably not hard-code the direction here. https://crbug
.com/333004 | 1951 // FIXME: We should probably not hard-code the direction here. https://crbug
.com/333004 |
1952 TextDirection ellipsisDirection = LTR; | 1952 TextDirection ellipsisDirection = LTR; |
1953 float firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, fi
rstLineFont, &horizontalEllipsis, 1, *firstLineStyle(), ellipsisDirection)); | 1953 float firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, fi
rstLineFont, &horizontalEllipsisCharacter, 1, *firstLineStyle(), ellipsisDirecti
on)); |
1954 float ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : fon
t.width(constructTextRun(this, font, &horizontalEllipsis, 1, styleRef(), ellipsi
sDirection)); | 1954 float ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : fon
t.width(constructTextRun(this, font, &horizontalEllipsisCharacter, 1, styleRef()
, ellipsisDirection)); |
1955 | 1955 |
1956 // For LTR text truncation, we want to get the right edge of our padding box
, and then we want to see | 1956 // For LTR text truncation, we want to get the right edge of our padding box
, and then we want to see |
1957 // if the right edge of a line box exceeds that. For RTL, we use the left e
dge of the padding box and | 1957 // if the right edge of a line box exceeds that. For RTL, we use the left e
dge of the padding box and |
1958 // check the left edge of the line box to see if it is less | 1958 // check the left edge of the line box to see if it is less |
1959 // Include the scrollbar for overflow blocks, which means we want to use "co
ntentWidth()" | 1959 // Include the scrollbar for overflow blocks, which means we want to use "co
ntentWidth()" |
1960 bool ltr = style()->isLeftToRightDirection(); | 1960 bool ltr = style()->isLeftToRightDirection(); |
1961 ETextAlign textAlign = style()->textAlign(); | 1961 ETextAlign textAlign = style()->textAlign(); |
1962 bool firstLine = true; | 1962 bool firstLine = true; |
1963 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ | 1963 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox())
{ |
1964 float currLogicalLeft = curr->logicalLeft(); | 1964 float currLogicalLeft = curr->logicalLeft(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); | 2052 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat
(); |
2053 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; | 2053 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal
se) - logicalLeft; |
2054 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); | 2054 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid
th, availableLogicalWidth, 0); |
2055 | 2055 |
2056 if (!style()->isLeftToRightDirection()) | 2056 if (!style()->isLeftToRightDirection()) |
2057 return logicalWidth() - logicalLeft; | 2057 return logicalWidth() - logicalLeft; |
2058 return logicalLeft; | 2058 return logicalLeft; |
2059 } | 2059 } |
2060 | 2060 |
2061 } | 2061 } |
OLD | NEW |