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 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef Position_h | 26 #ifndef Position_h |
27 #define Position_h | 27 #define Position_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/dom/ContainerNode.h" | 30 #include "core/dom/ContainerNode.h" |
31 #include "core/editing/EditingBoundary.h" | 31 #include "core/editing/EditingBoundary.h" |
32 #include "core/editing/EditingStrategy.h" | 32 #include "core/editing/EditingStrategy.h" |
33 #include "core/editing/TextAffinity.h" | |
34 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
35 #include "platform/text/TextDirection.h" | 34 #include "platform/text/TextDirection.h" |
36 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
37 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
38 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
39 | 38 |
40 namespace blink { | 39 namespace blink { |
41 | 40 |
42 class Element; | 41 class Element; |
43 class InlineBox; | 42 class InlineBox; |
44 class Node; | 43 class Node; |
45 class LayoutObject; | 44 class LayoutObject; |
46 class Text; | 45 class Text; |
| 46 enum class TextAffinity; |
47 class TreeScope; | 47 class TreeScope; |
48 | 48 |
49 struct InlineBoxPosition { | 49 struct InlineBoxPosition { |
50 InlineBox* inlineBox; | 50 InlineBox* inlineBox; |
51 int offsetInBox; | 51 int offsetInBox; |
52 | 52 |
53 InlineBoxPosition() | 53 InlineBoxPosition() |
54 : inlineBox(nullptr), offsetInBox(0) | 54 : inlineBox(nullptr), offsetInBox(0) |
55 { | 55 { |
56 } | 56 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 bool atStartOfTree() const; | 189 bool atStartOfTree() const; |
190 bool atEndOfTree() const; | 190 bool atEndOfTree() const; |
191 | 191 |
192 // These return useful visually equivalent positions. | 192 // These return useful visually equivalent positions. |
193 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro
ssEditingBoundary) const; | 193 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro
ssEditingBoundary) const; |
194 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC
rossEditingBoundary) const; | 194 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC
rossEditingBoundary) const; |
195 | 195 |
196 bool isCandidate() const; | 196 bool isCandidate() const; |
197 bool inRenderedText() const; | 197 bool inRenderedText() const; |
198 | 198 |
199 InlineBoxPosition computeInlineBoxPosition(EAffinity) const; | 199 InlineBoxPosition computeInlineBoxPosition(TextAffinity) const; |
200 InlineBoxPosition computeInlineBoxPosition(EAffinity, TextDirection primaryD
irection) const; | 200 InlineBoxPosition computeInlineBoxPosition(TextAffinity, TextDirection prima
ryDirection) const; |
201 | 201 |
202 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*); | 202 static bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject*); |
203 static bool nodeIsUserSelectNone(Node*); | 203 static bool nodeIsUserSelectNone(Node*); |
204 static bool nodeIsUserSelectAll(const Node*); | 204 static bool nodeIsUserSelectAll(const Node*); |
205 static Node* rootUserSelectAllForNode(Node*); | 205 static Node* rootUserSelectAllForNode(Node*); |
206 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode); | 206 static PositionAlgorithm<Strategy> beforeNode(Node* anchorNode); |
207 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode); | 207 static PositionAlgorithm<Strategy> afterNode(Node* anchorNode); |
208 static PositionAlgorithm<Strategy> inParentBeforeNode(const Node& anchorNode
); | 208 static PositionAlgorithm<Strategy> inParentBeforeNode(const Node& anchorNode
); |
209 static PositionAlgorithm<Strategy> inParentAfterNode(const Node& anchorNode)
; | 209 static PositionAlgorithm<Strategy> inParentAfterNode(const Node& anchorNode)
; |
210 static int lastOffsetInNode(Node* anchorNode); | 210 static int lastOffsetInNode(Node* anchorNode); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 } // namespace blink | 448 } // namespace blink |
449 | 449 |
450 #ifndef NDEBUG | 450 #ifndef NDEBUG |
451 // Outside the WebCore namespace for ease of invocation from gdb. | 451 // Outside the WebCore namespace for ease of invocation from gdb. |
452 void showTree(const blink::Position&); | 452 void showTree(const blink::Position&); |
453 void showTree(const blink::Position*); | 453 void showTree(const blink::Position*); |
454 #endif | 454 #endif |
455 | 455 |
456 #endif // Position_h | 456 #endif // Position_h |
OLD | NEW |