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