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 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // Work around signed/unsigned issues. This function takes unsigneds, and is
often passed UINT_MAX | 437 // Work around signed/unsigned issues. This function takes unsigneds, and is
often passed UINT_MAX |
438 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds
, so changing this | 438 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds
, so changing this |
439 // function to take ints causes various internal mismatches. But selectionRe
ct takes ints, and | 439 // function to take ints causes various internal mismatches. But selectionRe
ct takes ints, and |
440 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect
to take unsigneds, but | 440 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect
to take unsigneds, but |
441 // that would cause many ripple effects, so for now we'll just clamp our uns
igned parameters to INT_MAX. | 441 // that would cause many ripple effects, so for now we'll just clamp our uns
igned parameters to INT_MAX. |
442 ASSERT(end == UINT_MAX || end <= INT_MAX); | 442 ASSERT(end == UINT_MAX || end <= INT_MAX); |
443 ASSERT(start <= INT_MAX); | 443 ASSERT(start <= INT_MAX); |
444 start = std::min(start, static_cast<unsigned>(INT_MAX)); | 444 start = std::min(start, static_cast<unsigned>(INT_MAX)); |
445 end = std::min(end, static_cast<unsigned>(INT_MAX)); | 445 end = std::min(end, static_cast<unsigned>(INT_MAX)); |
446 | 446 |
| 447 const unsigned caretMinOffset = static_cast<unsigned>(this->caretMinOffset()
); |
| 448 const unsigned caretMaxOffset = static_cast<unsigned>(this->caretMaxOffset()
); |
| 449 |
| 450 // Skip leading and trailing unrendered whitespaces |
| 451 start = std::min(std::max(caretMinOffset, start), caretMaxOffset); |
| 452 end = std::min(std::max(caretMinOffset, end), caretMaxOffset); |
| 453 |
447 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 454 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
448 // Note: box->end() returns the index of the last character, not the ind
ex past it | 455 // Note: box->end() returns the index of the last character, not the ind
ex past it |
449 if (start <= box->start() && box->end() < end) { | 456 if (start <= box->start() && box->end() < end) { |
450 FloatRect r = box->calculateBoundaries(); | 457 FloatRect r = box->calculateBoundaries(); |
451 if (useSelectionHeight) { | 458 if (useSelectionHeight) { |
452 LayoutRect selectionRect = box->localSelectionRect(start, end); | 459 LayoutRect selectionRect = box->localSelectionRect(start, end); |
453 if (box->isHorizontal()) { | 460 if (box->isHorizontal()) { |
454 r.setHeight(selectionRect.height().toFloat()); | 461 r.setHeight(selectionRect.height().toFloat()); |
455 r.setY(selectionRect.y().toFloat()); | 462 r.setY(selectionRect.y().toFloat()); |
456 } else { | 463 } else { |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 } | 1875 } |
1869 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1876 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
1870 } | 1877 } |
1871 | 1878 |
1872 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() | 1879 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() |
1873 { | 1880 { |
1874 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); | 1881 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); |
1875 } | 1882 } |
1876 | 1883 |
1877 } // namespace WebCore | 1884 } // namespace WebCore |
OLD | NEW |