| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 457 } |
| 458 quads.append(localToAbsoluteQuad(r, 0, wasFixed)); | 458 quads.append(localToAbsoluteQuad(r, 0, wasFixed)); |
| 459 } else { | 459 } else { |
| 460 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHe
ight); | 460 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHe
ight); |
| 461 if (!rect.isZero()) | 461 if (!rect.isZero()) |
| 462 quads.append(localToAbsoluteQuad(rect, 0, wasFixed)); | 462 quads.append(localToAbsoluteQuad(rect, 0, wasFixed)); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 InlineTextBox* RenderText::findNextInlineTextBox(int offset, int& pos) const | |
| 468 { | |
| 469 // The text runs point to parts of the RenderText's m_text | |
| 470 // (they don't include '\n') | |
| 471 // Find the text run that includes the character at offset | |
| 472 // and return pos, which is the position of the char in the run. | |
| 473 | |
| 474 if (!m_firstTextBox) | |
| 475 return 0; | |
| 476 | |
| 477 InlineTextBox* s = m_firstTextBox; | |
| 478 int off = s->len(); | |
| 479 while (offset > off && s->nextTextBox()) { | |
| 480 s = s->nextTextBox(); | |
| 481 off = s->start() + s->len(); | |
| 482 } | |
| 483 // we are now in the correct text run | |
| 484 pos = (offset > off ? s->len() : s->len() - (off - offset) ); | |
| 485 return s; | |
| 486 } | |
| 487 | |
| 488 enum ShouldAffinityBeDownstream { AlwaysDownstream, AlwaysUpstream, UpstreamIfPo
sitionIsNotAtStart }; | 467 enum ShouldAffinityBeDownstream { AlwaysDownstream, AlwaysUpstream, UpstreamIfPo
sitionIsNotAtStart }; |
| 489 | 468 |
| 490 static bool lineDirectionPointFitsInBox(int pointLineDirection, InlineTextBox* b
ox, ShouldAffinityBeDownstream& shouldAffinityBeDownstream) | 469 static bool lineDirectionPointFitsInBox(int pointLineDirection, InlineTextBox* b
ox, ShouldAffinityBeDownstream& shouldAffinityBeDownstream) |
| 491 { | 470 { |
| 492 shouldAffinityBeDownstream = AlwaysDownstream; | 471 shouldAffinityBeDownstream = AlwaysDownstream; |
| 493 | 472 |
| 494 // the x coordinate is equal to the left edge of this box | 473 // the x coordinate is equal to the left edge of this box |
| 495 // the affinity must be downstream so the position doesn't jump back to the
previous line | 474 // the affinity must be downstream so the position doesn't jump back to the
previous line |
| 496 // except when box is the first box in the line | 475 // except when box is the first box in the line |
| 497 if (pointLineDirection <= box->logicalLeft()) { | 476 if (pointLineDirection <= box->logicalLeft()) { |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 } | 1863 } |
| 1885 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); | 1864 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); |
| 1886 } | 1865 } |
| 1887 | 1866 |
| 1888 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() | 1867 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() |
| 1889 { | 1868 { |
| 1890 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); | 1869 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); |
| 1891 } | 1870 } |
| 1892 | 1871 |
| 1893 } // namespace WebCore | 1872 } // namespace WebCore |
| OLD | NEW |