OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 LayoutUnit selTop = root().selectionTop(); | 198 LayoutUnit selTop = root().selectionTop(); |
199 LayoutUnit selHeight = root().selectionHeight(); | 199 LayoutUnit selHeight = root().selectionHeight(); |
200 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle()
); | 200 const ComputedStyle& styleToUse = layoutObject().styleRef(isFirstLineStyle()
); |
201 const Font& font = styleToUse.font(); | 201 const Font& font = styleToUse.font(); |
202 | 202 |
203 StringBuilder charactersWithHyphen; | 203 StringBuilder charactersWithHyphen; |
204 bool respectHyphen = ePos == m_len && hasHyphen(); | 204 bool respectHyphen = ePos == m_len && hasHyphen(); |
205 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac
tersWithHyphen : 0); | 205 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac
tersWithHyphen : 0); |
206 | 206 |
207 LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop.toFloat()); | 207 LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); |
208 LayoutRect r; | 208 LayoutRect r; |
209 if (sPos || ePos != static_cast<int>(m_len)) { | 209 if (sPos || ePos != static_cast<int>(m_len)) { |
210 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, Float
Point(startingPoint), selHeight, sPos, ePos))); | 210 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, Float
Point(startingPoint), selHeight, sPos, ePos))); |
211 } else { // Avoid computing the font width when the entire line box is selec
ted as an optimization. | 211 } else { // Avoid computing the font width when the entire line box is selec
ted as an optimization. |
212 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition | 212 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition |
213 // to LayoutUnit-based types is complete (crbug.com/321237) | 213 // to LayoutUnit-based types is complete (crbug.com/321237) |
214 r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_l
ogicalWidth, selHeight.toFloat())))); | 214 r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_l
ogicalWidth, selHeight)))); |
215 } | 215 } |
216 | 216 |
217 LayoutUnit logicalWidth = r.width(); | 217 LayoutUnit logicalWidth = r.width(); |
218 if (r.x() > logicalRight()) | 218 if (r.x() > logicalRight()) |
219 logicalWidth = 0; | 219 logicalWidth = 0; |
220 else if (r.maxX() > logicalRight()) | 220 else if (r.maxX() > logicalRight()) |
221 logicalWidth = logicalRight() - r.x(); | 221 logicalWidth = logicalRight() - r.x(); |
222 | 222 |
223 LayoutPoint topPoint = isHorizontal() ? LayoutPoint(r.x(), selTop) : LayoutP
oint(selTop, r.x()); | 223 LayoutPoint topPoint = isHorizontal() ? LayoutPoint(r.x(), selTop) : LayoutP
oint(selTop, r.x()); |
224 LayoutUnit width = isHorizontal() ? logicalWidth : selHeight; | 224 LayoutUnit width = isHorizontal() ? logicalWidth : selHeight; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj); | 562 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), &obj); |
563 const int layoutObjectCharacterOffset = 75; | 563 const int layoutObjectCharacterOffset = 75; |
564 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 564 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) |
565 fputc(' ', stderr); | 565 fputc(' ', stderr); |
566 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 566 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
567 } | 567 } |
568 | 568 |
569 #endif | 569 #endif |
570 | 570 |
571 } // namespace blink | 571 } // namespace blink |
OLD | NEW |