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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 return createPositionWithAffinityForBox(leftmostBox, | 588 return createPositionWithAffinityForBox(leftmostBox, |
589 box->isLeftToRightDirection() ? leftmostBox->caretMinOffset() : left
mostBox->caretMaxOffset(), shouldAffinityBeDownstream); | 589 box->isLeftToRightDirection() ? leftmostBox->caretMinOffset() : left
mostBox->caretMaxOffset(), shouldAffinityBeDownstream); |
590 } | 590 } |
591 | 591 |
592 return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), sho
uldAffinityBeDownstream); | 592 return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), sho
uldAffinityBeDownstream); |
593 } | 593 } |
594 | 594 |
595 PositionWithAffinity LayoutText::positionForPoint(const LayoutPoint& point) | 595 PositionWithAffinity LayoutText::positionForPoint(const LayoutPoint& point) |
596 { | 596 { |
597 if (!firstTextBox() || textLength() == 0) | 597 if (!firstTextBox() || textLength() == 0) |
598 return createPositionWithAffinity(0, DOWNSTREAM); | 598 return createPositionWithAffinity(0); |
599 | 599 |
600 LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() :
point.y(); | 600 LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() :
point.y(); |
601 LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y()
: point.x(); | 601 LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y()
: point.x(); |
602 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); | 602 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); |
603 | 603 |
604 InlineTextBox* lastBox = nullptr; | 604 InlineTextBox* lastBox = nullptr; |
605 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 605 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
606 if (box->isLineBreak() && !box->prevLeafChild() && box->nextLeafChild()
&& !box->nextLeafChild()->isLineBreak()) | 606 if (box->isLineBreak() && !box->prevLeafChild() && box->nextLeafChild()
&& !box->nextLeafChild()->isLineBreak()) |
607 box = box->nextTextBox(); | 607 box = box->nextTextBox(); |
608 | 608 |
(...skipping 11 matching lines...) Expand all Loading... |
620 } | 620 } |
621 } | 621 } |
622 lastBox = box; | 622 lastBox = box; |
623 } | 623 } |
624 | 624 |
625 if (lastBox) { | 625 if (lastBox) { |
626 ShouldAffinityBeDownstream shouldAffinityBeDownstream; | 626 ShouldAffinityBeDownstream shouldAffinityBeDownstream; |
627 lineDirectionPointFitsInBox(pointLineDirection, lastBox, shouldAffinityB
eDownstream); | 627 lineDirectionPointFitsInBox(pointLineDirection, lastBox, shouldAffinityB
eDownstream); |
628 return createPositionWithAffinityForBoxAfterAdjustingOffsetForBiDi(lastB
ox, lastBox->offsetForPosition(pointLineDirection.toFloat()) + lastBox->start(),
shouldAffinityBeDownstream); | 628 return createPositionWithAffinityForBoxAfterAdjustingOffsetForBiDi(lastB
ox, lastBox->offsetForPosition(pointLineDirection.toFloat()) + lastBox->start(),
shouldAffinityBeDownstream); |
629 } | 629 } |
630 return createPositionWithAffinity(0, DOWNSTREAM); | 630 return createPositionWithAffinity(0); |
631 } | 631 } |
632 | 632 |
633 LayoutRect LayoutText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay
outUnit* extraWidthToEndOfLine) | 633 LayoutRect LayoutText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay
outUnit* extraWidthToEndOfLine) |
634 { | 634 { |
635 if (!inlineBox) | 635 if (!inlineBox) |
636 return LayoutRect(); | 636 return LayoutRect(); |
637 | 637 |
638 ASSERT(inlineBox->isInlineTextBox()); | 638 ASSERT(inlineBox->isInlineTextBox()); |
639 if (!inlineBox->isInlineTextBox()) | 639 if (!inlineBox->isInlineTextBox()) |
640 return LayoutRect(); | 640 return LayoutRect(); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 1876 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
1877 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); | 1877 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box); |
1878 if (box->truncation() != cNoTruncation) { | 1878 if (box->truncation() != cNoTruncation) { |
1879 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) | 1879 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) |
1880 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(
*ellipsisBox); | 1880 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(
*ellipsisBox); |
1881 } | 1881 } |
1882 } | 1882 } |
1883 } | 1883 } |
1884 | 1884 |
1885 } // namespace blink | 1885 } // namespace blink |
OLD | NEW |