| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 bool InlineTextBox::isSelected(int startPos, int endPos) const | 142 bool InlineTextBox::isSelected(int startPos, int endPos) const |
| 143 { | 143 { |
| 144 int sPos = std::max(startPos - m_start, 0); | 144 int sPos = std::max(startPos - m_start, 0); |
| 145 // The position after a hard line break is considered to be past its end. | 145 // The position after a hard line break is considered to be past its end. |
| 146 // See the corresponding code in InlineTextBox::selectionState. | 146 // See the corresponding code in InlineTextBox::selectionState. |
| 147 int ePos = std::min(endPos - m_start, int(m_len) + (isLineBreak() ? 0 : 1)); | 147 int ePos = std::min(endPos - m_start, int(m_len) + (isLineBreak() ? 0 : 1)); |
| 148 return (sPos < ePos); | 148 return (sPos < ePos); |
| 149 } | 149 } |
| 150 | 150 |
| 151 RenderObject::SelectionState InlineTextBox::selectionState() | 151 RenderObject::SelectionState InlineTextBox::selectionState() const |
| 152 { | 152 { |
| 153 RenderObject::SelectionState state = renderer().selectionState(); | 153 RenderObject::SelectionState state = renderer().selectionState(); |
| 154 if (state == RenderObject::SelectionStart || state == RenderObject::Selectio
nEnd || state == RenderObject::SelectionBoth) { | 154 if (state == RenderObject::SelectionStart || state == RenderObject::Selectio
nEnd || state == RenderObject::SelectionBoth) { |
| 155 int startPos, endPos; | 155 int startPos, endPos; |
| 156 renderer().selectionStartEnd(startPos, endPos); | 156 renderer().selectionStartEnd(startPos, endPos); |
| 157 // The position after a hard line break is considered to be past its end
. | 157 // The position after a hard line break is considered to be past its end
. |
| 158 // See the corresponding code in InlineTextBox::isSelected. | 158 // See the corresponding code in InlineTextBox::isSelected. |
| 159 int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0); | 159 int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0); |
| 160 | 160 |
| 161 // FIXME: Remove -webkit-line-break: LineBreakAfterWhiteSpace. | 161 // FIXME: Remove -webkit-line-break: LineBreakAfterWhiteSpace. |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 continue; | 620 continue; |
| 621 paintCompositionUnderline(context, boxOrigin, *it); | 621 paintCompositionUnderline(context, boxOrigin, *it); |
| 622 } | 622 } |
| 623 } | 623 } |
| 624 } | 624 } |
| 625 | 625 |
| 626 if (shouldRotate) | 626 if (shouldRotate) |
| 627 context->concatCTM(rotation(boxRect, Counterclockwise)); | 627 context->concatCTM(rotation(boxRect, Counterclockwise)); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) | 630 void InlineTextBox::selectionStartEnd(int& sPos, int& ePos) const |
| 631 { | 631 { |
| 632 int startPos, endPos; | 632 int startPos, endPos; |
| 633 if (renderer().selectionState() == RenderObject::SelectionInside) { | 633 if (renderer().selectionState() == RenderObject::SelectionInside) { |
| 634 startPos = 0; | 634 startPos = 0; |
| 635 endPos = renderer().textLength(); | 635 endPos = renderer().textLength(); |
| 636 } else { | 636 } else { |
| 637 renderer().selectionStartEnd(startPos, endPos); | 637 renderer().selectionStartEnd(startPos, endPos); |
| 638 if (renderer().selectionState() == RenderObject::SelectionStart) | 638 if (renderer().selectionState() == RenderObject::SelectionStart) |
| 639 endPos = renderer().textLength(); | 639 endPos = renderer().textLength(); |
| 640 else if (renderer().selectionState() == RenderObject::SelectionEnd) | 640 else if (renderer().selectionState() == RenderObject::SelectionEnd) |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); | 1369 printedCharacters = fprintf(stderr, "\t%s %p", obj.renderName(), &obj); |
| 1370 const int rendererCharacterOffset = 24; | 1370 const int rendererCharacterOffset = 24; |
| 1371 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) | 1371 for (; printedCharacters < rendererCharacterOffset; printedCharacters++) |
| 1372 fputc(' ', stderr); | 1372 fputc(' ', stderr); |
| 1373 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); | 1373 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d
ata()); |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 #endif | 1376 #endif |
| 1377 | 1377 |
| 1378 } // namespace blink | 1378 } // namespace blink |
| OLD | NEW |