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 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 InlineBoxPosition computeInlineBoxPosition(const Position& position, TextAffinit
y affinity, TextDirection primaryDirection) | 1706 InlineBoxPosition computeInlineBoxPosition(const Position& position, TextAffinit
y affinity, TextDirection primaryDirection) |
1707 { | 1707 { |
1708 return computeInlineBoxPositionAlgorithm<EditingStrategy>(position, affinity
, primaryDirection); | 1708 return computeInlineBoxPositionAlgorithm<EditingStrategy>(position, affinity
, primaryDirection); |
1709 } | 1709 } |
1710 | 1710 |
1711 InlineBoxPosition computeInlineBoxPosition(const PositionInComposedTree& positio
n, TextAffinity affinity, TextDirection primaryDirection) | 1711 InlineBoxPosition computeInlineBoxPosition(const PositionInComposedTree& positio
n, TextAffinity affinity, TextDirection primaryDirection) |
1712 { | 1712 { |
1713 return computeInlineBoxPositionAlgorithm<EditingInComposedTreeStrategy>(posi
tion, affinity, primaryDirection); | 1713 return computeInlineBoxPositionAlgorithm<EditingInComposedTreeStrategy>(posi
tion, affinity, primaryDirection); |
1714 } | 1714 } |
1715 | 1715 |
1716 LayoutRect localCaretRectOfPosition(const PositionWithAffinity& position, Layout
Object*& layoutObject) | 1716 template <typename Strategy> |
| 1717 LayoutRect localCaretRectOfPositionAlgorithm(const PositionWithAffinityTemplate<
Strategy>& position, LayoutObject*& layoutObject) |
1717 { | 1718 { |
1718 if (position.position().isNull()) { | 1719 if (position.position().isNull()) { |
1719 layoutObject = nullptr; | 1720 layoutObject = nullptr; |
1720 return LayoutRect(); | 1721 return LayoutRect(); |
1721 } | 1722 } |
1722 Node* node = position.position().anchorNode(); | 1723 Node* node = position.position().anchorNode(); |
1723 | 1724 |
1724 layoutObject = node->layoutObject(); | 1725 layoutObject = node->layoutObject(); |
1725 if (!layoutObject) | 1726 if (!layoutObject) |
1726 return LayoutRect(); | 1727 return LayoutRect(); |
1727 | 1728 |
1728 InlineBoxPosition boxPosition = computeInlineBoxPosition(position.position()
, position.affinity()); | 1729 InlineBoxPosition boxPosition = computeInlineBoxPosition(position.position()
, position.affinity()); |
1729 | 1730 |
1730 if (boxPosition.inlineBox) | 1731 if (boxPosition.inlineBox) |
1731 layoutObject = &boxPosition.inlineBox->layoutObject(); | 1732 layoutObject = &boxPosition.inlineBox->layoutObject(); |
1732 | 1733 |
1733 return layoutObject->localCaretRect(boxPosition.inlineBox, boxPosition.offse
tInBox); | 1734 return layoutObject->localCaretRect(boxPosition.inlineBox, boxPosition.offse
tInBox); |
1734 } | 1735 } |
1735 | 1736 |
| 1737 LayoutRect localCaretRectOfPosition(const PositionWithAffinity& position, Layout
Object*& layoutObject) |
| 1738 { |
| 1739 return localCaretRectOfPositionAlgorithm<EditingStrategy>(position, layoutOb
ject); |
| 1740 } |
| 1741 |
| 1742 LayoutRect localCaretRectOfPosition(const PositionInComposedTreeWithAffinity& po
sition, LayoutObject*& layoutObject) |
| 1743 { |
| 1744 return localCaretRectOfPositionAlgorithm<EditingInComposedTreeStrategy>(posi
tion, layoutObject); |
| 1745 } |
| 1746 |
1736 static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect) | 1747 static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect) |
1737 { | 1748 { |
1738 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); | 1749 return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width(); |
1739 } | 1750 } |
1740 | 1751 |
1741 bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* layoutObject) | 1752 bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* layoutObject) |
1742 { | 1753 { |
1743 LayoutObject* stop = layoutObject->nextInPreOrderAfterChildren(); | 1754 LayoutObject* stop = layoutObject->nextInPreOrderAfterChildren(); |
1744 for (LayoutObject *o = layoutObject->slowFirstChild(); o && o != stop; o = o
->nextInPreOrder()) { | 1755 for (LayoutObject *o = layoutObject->slowFirstChild(); o && o != stop; o = o
->nextInPreOrder()) { |
1745 if (o->nonPseudoNode()) { | 1756 if (o->nonPseudoNode()) { |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 { | 2331 { |
2321 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); | 2332 return isVisuallyEquivalentCandidateAlgorithm<EditingStrategy>(position); |
2322 } | 2333 } |
2323 | 2334 |
2324 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) | 2335 bool isVisuallyEquivalentCandidate(const PositionInComposedTree& position) |
2325 { | 2336 { |
2326 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); | 2337 return isVisuallyEquivalentCandidateAlgorithm<EditingInComposedTreeStrategy>
(position); |
2327 } | 2338 } |
2328 | 2339 |
2329 } // namespace blink | 2340 } // namespace blink |
OLD | NEW |