| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool atStartOfTree() const; | 182 bool atStartOfTree() const; |
| 183 bool atEndOfTree() const; | 183 bool atEndOfTree() const; |
| 184 | 184 |
| 185 // These return useful visually equivalent positions. | 185 // These return useful visually equivalent positions. |
| 186 // FIXME: We should use mostForwardCaretPosition and mostBackwardPosition. | 186 // FIXME: We should use mostForwardCaretPosition and mostBackwardPosition. |
| 187 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro
ssEditingBoundary) const; | 187 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro
ssEditingBoundary) const; |
| 188 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC
rossEditingBoundary) const; | 188 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC
rossEditingBoundary) const; |
| 189 | 189 |
| 190 bool isCandidate() const; | 190 bool isCandidate() const; |
| 191 | 191 |
| 192 InlineBoxPosition computeInlineBoxPosition(TextAffinity) const; | |
| 193 InlineBoxPosition computeInlineBoxPosition(TextAffinity, TextDirection prima
ryDirection) const; | |
| 194 | |
| 195 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode); | 192 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode); |
| 196 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode); | 193 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode); |
| 197 static PositionAlgorithm<Strategy> inParentBeforeNode(const Node& anchorNode
); | 194 static PositionAlgorithm<Strategy> inParentBeforeNode(const Node& anchorNode
); |
| 198 static PositionAlgorithm<Strategy> inParentAfterNode(const Node& anchorNode)
; | 195 static PositionAlgorithm<Strategy> inParentAfterNode(const Node& anchorNode)
; |
| 199 static int lastOffsetInNode(Node* anchorNode); | 196 static int lastOffsetInNode(Node* anchorNode); |
| 200 static PositionAlgorithm<Strategy> firstPositionInNode(Node* anchorNode); | 197 static PositionAlgorithm<Strategy> firstPositionInNode(Node* anchorNode); |
| 201 static PositionAlgorithm<Strategy> lastPositionInNode(Node* anchorNode); | 198 static PositionAlgorithm<Strategy> lastPositionInNode(Node* anchorNode); |
| 202 static int minOffsetForNode(Node* anchorNode, int offset); | 199 static int minOffsetForNode(Node* anchorNode, int offset); |
| 203 static bool offsetIsBeforeLastNodeOffset(int offset, Node* anchorNode); | 200 static bool offsetIsBeforeLastNodeOffset(int offset, Node* anchorNode); |
| 204 static PositionAlgorithm<Strategy> firstPositionInOrBeforeNode(Node* anchorN
ode); | 201 static PositionAlgorithm<Strategy> firstPositionInOrBeforeNode(Node* anchorN
ode); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 { | 423 { |
| 427 return position; | 424 return position; |
| 428 } | 425 } |
| 429 | 426 |
| 430 template <> | 427 template <> |
| 431 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg
y>(const Position& position) | 428 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg
y>(const Position& position) |
| 432 { | 429 { |
| 433 return toPositionInComposedTree(position); | 430 return toPositionInComposedTree(position); |
| 434 } | 431 } |
| 435 | 432 |
| 433 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use |
| 434 // |VisiblePosition::characterAfter()| and |VisiblePosition::characterBefore()|. |
| 435 // TODO(yosin) We should move |isRenderedCharacter()| to "VisibleUnits.cpp", |
| 436 // since it is used only in "editing/commands/" |
| 437 CORE_EXPORT bool isRenderedCharacter(const Position&); |
| 438 // TODO(yosin) We should move |computeInlineBoxPosition()| to "VisibleUnits.cpp" |
| 439 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const Position&, TextAffi
nity); |
| 440 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const Position&, TextAffi
nity, TextDirection primaryDirection); |
| 441 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const PositionInComposedT
ree&, TextAffinity); |
| 442 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const PositionInComposedT
ree&, TextAffinity, TextDirection primaryDirection); |
| 443 |
| 436 // TODO(yosin) We should move |inRenderedText()| to "VisibleUnits.h" for | 444 // TODO(yosin) We should move |inRenderedText()| to "VisibleUnits.h" for |
| 437 // reduce dependency of |LayoutObject| in |Position| class. | 445 // reduce dependency of |LayoutObject| in |Position| class. |
| 438 CORE_EXPORT bool inRenderedText(const Position&); | 446 CORE_EXPORT bool inRenderedText(const Position&); |
| 439 CORE_EXPORT bool inRenderedText(const PositionInComposedTree&); | 447 CORE_EXPORT bool inRenderedText(const PositionInComposedTree&); |
| 440 | 448 |
| 441 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current); | 449 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current); |
| 442 CORE_EXPORT int uncheckedNextOffset(const Node*, int current); | 450 CORE_EXPORT int uncheckedNextOffset(const Node*, int current); |
| 443 | 451 |
| 444 } // namespace blink | 452 } // namespace blink |
| 445 | 453 |
| 446 #ifndef NDEBUG | 454 #ifndef NDEBUG |
| 447 // Outside the WebCore namespace for ease of invocation from gdb. | 455 // Outside the WebCore namespace for ease of invocation from gdb. |
| 448 void showTree(const blink::Position&); | 456 void showTree(const blink::Position&); |
| 449 void showTree(const blink::Position*); | 457 void showTree(const blink::Position*); |
| 450 #endif | 458 #endif |
| 451 | 459 |
| 452 #endif // Position_h | 460 #endif // Position_h |
| OLD | NEW |