OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 TextBreakIterator* iter = 0; | 370 TextBreakIterator* iter = 0; |
371 | 371 |
372 CachedLogicallyOrderedLeafBoxes leafBoxes; | 372 CachedLogicallyOrderedLeafBoxes leafBoxes; |
373 Vector<UChar, 1024> string; | 373 Vector<UChar, 1024> string; |
374 | 374 |
375 while (1) { | 375 while (1) { |
376 VisiblePosition adjacentCharacterPosition = direction == MoveRight ? cur
rent.right() : current.left(); | 376 VisiblePosition adjacentCharacterPosition = direction == MoveRight ? cur
rent.right() : current.left(); |
377 if (adjacentCharacterPosition.deepEquivalent() == current.deepEquivalent
() || adjacentCharacterPosition.isNull()) | 377 if (adjacentCharacterPosition.deepEquivalent() == current.deepEquivalent
() || adjacentCharacterPosition.isNull()) |
378 return VisiblePosition(); | 378 return VisiblePosition(); |
379 | 379 |
380 InlineBoxPosition boxPosition = adjacentCharacterPosition.deepEquivalent
().computeInlineBoxPosition(TextAffinity::Upstream); | 380 InlineBoxPosition boxPosition = computeInlineBoxPosition(adjacentCharact
erPosition.deepEquivalent(), TextAffinity::Upstream); |
381 InlineBox* box = boxPosition.inlineBox; | 381 InlineBox* box = boxPosition.inlineBox; |
382 int offsetInBox = boxPosition.offsetInBox; | 382 int offsetInBox = boxPosition.offsetInBox; |
383 | 383 |
384 if (!box) | 384 if (!box) |
385 break; | 385 break; |
386 if (!box->isInlineTextBox()) { | 386 if (!box->isInlineTextBox()) { |
387 current = adjacentCharacterPosition; | 387 current = adjacentCharacterPosition; |
388 continue; | 388 continue; |
389 } | 389 } |
390 | 390 |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 if (position.position().isNull()) { | 1437 if (position.position().isNull()) { |
1438 layoutObject = nullptr; | 1438 layoutObject = nullptr; |
1439 return LayoutRect(); | 1439 return LayoutRect(); |
1440 } | 1440 } |
1441 Node* node = position.position().anchorNode(); | 1441 Node* node = position.position().anchorNode(); |
1442 | 1442 |
1443 layoutObject = node->layoutObject(); | 1443 layoutObject = node->layoutObject(); |
1444 if (!layoutObject) | 1444 if (!layoutObject) |
1445 return LayoutRect(); | 1445 return LayoutRect(); |
1446 | 1446 |
1447 InlineBoxPosition boxPosition = position.position().computeInlineBoxPosition
(position.affinity()); | 1447 InlineBoxPosition boxPosition = computeInlineBoxPosition(position.position()
, position.affinity()); |
1448 | 1448 |
1449 if (boxPosition.inlineBox) | 1449 if (boxPosition.inlineBox) |
1450 layoutObject = &boxPosition.inlineBox->layoutObject(); | 1450 layoutObject = &boxPosition.inlineBox->layoutObject(); |
1451 | 1451 |
1452 return layoutObject->localCaretRect(boxPosition.inlineBox, boxPosition.offse
tInBox); | 1452 return layoutObject->localCaretRect(boxPosition.inlineBox, boxPosition.offse
tInBox); |
1453 } | 1453 } |
1454 | 1454 |
1455 static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect) | 1455 static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect) |
1456 { | 1456 { |
1457 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); | 1457 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 | 1585 |
1586 if (position2.anchorNode()->isTextNode() && !inRenderedText(position2)) | 1586 if (position2.anchorNode()->isTextNode() && !inRenderedText(position2)) |
1587 return false; | 1587 return false; |
1588 | 1588 |
1589 const int renderedOffset1 = renderedOffsetOf(position1); | 1589 const int renderedOffset1 = renderedOffsetOf(position1); |
1590 const int renderedOffset2 = renderedOffsetOf(position2); | 1590 const int renderedOffset2 = renderedOffsetOf(position2); |
1591 | 1591 |
1592 if (layoutObject == posLayoutObject && renderedOffset1 == renderedOffset2) | 1592 if (layoutObject == posLayoutObject && renderedOffset1 == renderedOffset2) |
1593 return false; | 1593 return false; |
1594 | 1594 |
1595 InlineBoxPosition boxPosition1 = position1.computeInlineBoxPosition(TextAffi
nity::Downstream); | 1595 InlineBoxPosition boxPosition1 = computeInlineBoxPosition(position1, TextAff
inity::Downstream); |
1596 InlineBoxPosition boxPosition2 = position2.computeInlineBoxPosition(TextAffi
nity::Downstream); | 1596 InlineBoxPosition boxPosition2 = computeInlineBoxPosition(position2, TextAff
inity::Downstream); |
1597 | 1597 |
1598 WTF_LOG(Editing, "layoutObject1: %p [%p]\n", layoutObject, boxPosition1.in
lineBox); | 1598 WTF_LOG(Editing, "layoutObject1: %p [%p]\n", layoutObject, boxPosition1.in
lineBox); |
1599 WTF_LOG(Editing, "renderedOffset1: %d\n", renderedOffset1); | 1599 WTF_LOG(Editing, "renderedOffset1: %d\n", renderedOffset1); |
1600 WTF_LOG(Editing, "layoutObject2: %p [%p]\n", posLayoutObject, boxPosition2
.inlineBox); | 1600 WTF_LOG(Editing, "layoutObject2: %p [%p]\n", posLayoutObject, boxPosition2
.inlineBox); |
1601 WTF_LOG(Editing, "renderedOffset2: %d\n", renderedOffset2); | 1601 WTF_LOG(Editing, "renderedOffset2: %d\n", renderedOffset2); |
1602 WTF_LOG(Editing, "node1 min/max: %d:%d\n", caretMinOffset(position1.anchor
Node()), caretMaxOffset(position1.anchorNode())); | 1602 WTF_LOG(Editing, "node1 min/max: %d:%d\n", caretMinOffset(position1.anchor
Node()), caretMaxOffset(position1.anchorNode())); |
1603 WTF_LOG(Editing, "node2 min/max: %d:%d\n", caretMinOffset(position2.anchor
Node()), caretMaxOffset(position2.anchorNode())); | 1603 WTF_LOG(Editing, "node2 min/max: %d:%d\n", caretMinOffset(position2.anchor
Node()), caretMaxOffset(position2.anchorNode())); |
1604 WTF_LOG(Editing, "----------------------------------------------------------
------------\n"); | 1604 WTF_LOG(Editing, "----------------------------------------------------------
------------\n"); |
1605 | 1605 |
1606 if (!boxPosition1.inlineBox || !boxPosition2.inlineBox) { | 1606 if (!boxPosition1.inlineBox || !boxPosition2.inlineBox) { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 { | 1922 { |
1923 return mostBackwardCaretPosition<EditingStrategy>(position, rule); | 1923 return mostBackwardCaretPosition<EditingStrategy>(position, rule); |
1924 } | 1924 } |
1925 | 1925 |
1926 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) | 1926 PositionInComposedTree mostBackwardCaretPosition(const PositionInComposedTree& p
osition, EditingBoundaryCrossingRule rule) |
1927 { | 1927 { |
1928 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); | 1928 return mostBackwardCaretPosition<EditingInComposedTreeStrategy>(position, ru
le); |
1929 } | 1929 } |
1930 | 1930 |
1931 } | 1931 } |
OLD | NEW |