| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // FIXME: Is it actually possible to try and paint a dirty InlineTextBox? | 73 // FIXME: Is it actually possible to try and paint a dirty InlineTextBox? |
| 74 InlineTextBoxPainter::removeFromTextBlobCache(*this); | 74 InlineTextBoxPainter::removeFromTextBlobCache(*this); |
| 75 | 75 |
| 76 m_len = 0; | 76 m_len = 0; |
| 77 m_start = 0; | 77 m_start = 0; |
| 78 InlineBox::markDirty(); | 78 InlineBox::markDirty(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 LayoutRect InlineTextBox::logicalOverflowRect() const | 81 LayoutRect InlineTextBox::logicalOverflowRect() const |
| 82 { | 82 { |
| 83 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) { | 83 if (knownToHaveNoOverflow() || !gTextBoxesWithOverflow) |
| 84 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition | 84 return logicalFrameRect(); |
| 85 // to LayoutUnit-based types is complete (crbug.com/321237). The call to
enclosingIntRect() | |
| 86 // should also likely be switched to LayoutUnit pixel-snapping. | |
| 87 return LayoutRect(enclosingIntRect(logicalFrameRect())); | |
| 88 } | |
| 89 | 85 |
| 90 return gTextBoxesWithOverflow->get(this); | 86 return gTextBoxesWithOverflow->get(this); |
| 91 } | 87 } |
| 92 | 88 |
| 93 void InlineTextBox::setLogicalOverflowRect(const LayoutRect& rect) | 89 void InlineTextBox::setLogicalOverflowRect(const LayoutRect& rect) |
| 94 { | 90 { |
| 95 ASSERT(!knownToHaveNoOverflow()); | 91 ASSERT(!knownToHaveNoOverflow()); |
| 96 if (!gTextBoxesWithOverflow) | 92 if (!gTextBoxesWithOverflow) |
| 97 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap; | 93 gTextBoxesWithOverflow = new InlineTextBoxOverflowMap; |
| 98 gTextBoxesWithOverflow->set(this, rect); | 94 gTextBoxesWithOverflow->set(this, rect); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 226 |
| 231 StringBuilder charactersWithHyphen; | 227 StringBuilder charactersWithHyphen; |
| 232 bool respectHyphen = ePos == m_len && hasHyphen(); | 228 bool respectHyphen = ePos == m_len && hasHyphen(); |
| 233 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac
tersWithHyphen : 0); | 229 TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charac
tersWithHyphen : 0); |
| 234 | 230 |
| 235 LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); | 231 LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); |
| 236 LayoutRect r; | 232 LayoutRect r; |
| 237 if (sPos || ePos != static_cast<int>(m_len)) { | 233 if (sPos || ePos != static_cast<int>(m_len)) { |
| 238 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, Float
Point(startingPoint), selHeight, sPos, ePos))); | 234 r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, Float
Point(startingPoint), selHeight, sPos, ePos))); |
| 239 } else { // Avoid computing the font width when the entire line box is selec
ted as an optimization. | 235 } else { // Avoid computing the font width when the entire line box is selec
ted as an optimization. |
| 240 // FIXME: the call to rawValue() below is temporary and should be remove
d once the transition | |
| 241 // to LayoutUnit-based types is complete (crbug.com/321237) | |
| 242 r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_l
ogicalWidth, selHeight)))); | 236 r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_l
ogicalWidth, selHeight)))); |
| 243 } | 237 } |
| 244 | 238 |
| 245 LayoutUnit logicalWidth = r.width(); | 239 LayoutUnit logicalWidth = r.width(); |
| 246 if (r.x() > logicalRight()) | 240 if (r.x() > logicalRight()) |
| 247 logicalWidth = LayoutUnit(); | 241 logicalWidth = LayoutUnit(); |
| 248 else if (r.maxX() > logicalRight()) | 242 else if (r.maxX() > logicalRight()) |
| 249 logicalWidth = logicalRight() - r.x(); | 243 logicalWidth = logicalRight() - r.x(); |
| 250 | 244 |
| 251 LayoutPoint topPoint; | 245 LayoutPoint topPoint; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer(
)); | 620 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer(
)); |
| 627 const int layoutObjectCharacterOffset = 75; | 621 const int layoutObjectCharacterOffset = 75; |
| 628 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) | 622 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) |
| 629 fputc(' ', stderr); | 623 fputc(' ', stderr); |
| 630 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 624 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 631 } | 625 } |
| 632 | 626 |
| 633 #endif | 627 #endif |
| 634 | 628 |
| 635 } // namespace blink | 629 } // namespace blink |
| OLD | NEW |