| 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 13 matching lines...) Expand all Loading... |
| 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" | 33 #include "core/editing/TextAffinity.h" |
| 34 #include "platform/heap/Handle.h" |
| 34 #include "platform/text/TextDirection.h" | 35 #include "platform/text/TextDirection.h" |
| 35 #include "wtf/Assertions.h" | 36 #include "wtf/Assertions.h" |
| 36 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 37 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 class CSSComputedStyleDeclaration; | 42 class CSSComputedStyleDeclaration; |
| 42 class Element; | 43 class Element; |
| 43 class InlineBox; | 44 class InlineBox; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 static PositionType lastPositionInOrAfterNode(Node* anchorNode); | 226 static PositionType lastPositionInOrAfterNode(Node* anchorNode); |
| 226 | 227 |
| 227 void debugPosition(const char* msg = "") const; | 228 void debugPosition(const char* msg = "") const; |
| 228 | 229 |
| 229 #ifndef NDEBUG | 230 #ifndef NDEBUG |
| 230 void formatForDebugger(char* buffer, unsigned length) const; | 231 void formatForDebugger(char* buffer, unsigned length) const; |
| 231 void showAnchorTypeAndOffset() const; | 232 void showAnchorTypeAndOffset() const; |
| 232 void showTreeForThis() const; | 233 void showTreeForThis() const; |
| 233 #endif | 234 #endif |
| 234 | 235 |
| 236 DEFINE_INLINE_TRACE() |
| 237 { |
| 238 visitor->trace(m_anchorNode); |
| 239 } |
| 240 |
| 235 protected: | 241 protected: |
| 236 PositionAlgorithm(const PositionAlgorithm&); | 242 PositionAlgorithm(const PositionAlgorithm&); |
| 237 | 243 |
| 238 int offsetForPositionAfterAnchor() const; | 244 int offsetForPositionAfterAnchor() const; |
| 239 | 245 |
| 240 int renderedOffset() const; | 246 int renderedOffset() const; |
| 241 | 247 |
| 242 static AnchorType anchorTypeForLegacyEditingPosition(Node* anchorNode, int o
ffset); | 248 static AnchorType anchorTypeForLegacyEditingPosition(Node* anchorNode, int o
ffset); |
| 243 | 249 |
| 244 RefPtrWillBeMember<Node> m_anchorNode; | 250 RefPtrWillBeMember<Node> m_anchorNode; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 267 Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType); | 273 Position(PassRefPtrWillBeRawPtr<Node> anchorNode, AnchorType); |
| 268 Position(PassRefPtrWillBeRawPtr<Text> textNode, unsigned offset); | 274 Position(PassRefPtrWillBeRawPtr<Text> textNode, unsigned offset); |
| 269 | 275 |
| 270 // For creating offset positions: | 276 // For creating offset positions: |
| 271 // FIXME: This constructor should eventually go away. See bug 63040. | 277 // FIXME: This constructor should eventually go away. See bug 63040. |
| 272 Position(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset, AnchorType); | 278 Position(PassRefPtrWillBeRawPtr<Node> anchorNode, int offset, AnchorType); |
| 273 explicit Position(const PositionAlgorithm&); | 279 explicit Position(const PositionAlgorithm&); |
| 274 | 280 |
| 275 int compareTo(const Position&) const; | 281 int compareTo(const Position&) const; |
| 276 | 282 |
| 277 DECLARE_TRACE(); | |
| 278 | |
| 279 #ifndef NDEBUG | 283 #ifndef NDEBUG |
| 280 Node* nodeAsSelectionStart() const; | 284 Node* nodeAsSelectionStart() const; |
| 281 Node* nodeAsSelectionEnd() const; | 285 Node* nodeAsSelectionEnd() const; |
| 282 bool equivalentTo(const Position&) const; | 286 bool equivalentTo(const Position&) const; |
| 283 Position toPositionForEquality() const; | 287 Position toPositionForEquality() const; |
| 284 #endif | 288 #endif |
| 285 }; | 289 }; |
| 286 | 290 |
| 287 template <typename Strategy> | 291 template <typename Strategy> |
| 288 typename Strategy::PositionType PositionAlgorithm<Strategy>::createLegacyEditing
Position(PassRefPtrWillBeRawPtr<Node> node, int offset) | 292 typename Strategy::PositionType PositionAlgorithm<Strategy>::createLegacyEditing
Position(PassRefPtrWillBeRawPtr<Node> node, int offset) |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 464 |
| 461 } // namespace blink | 465 } // namespace blink |
| 462 | 466 |
| 463 #ifndef NDEBUG | 467 #ifndef NDEBUG |
| 464 // Outside the WebCore namespace for ease of invocation from gdb. | 468 // Outside the WebCore namespace for ease of invocation from gdb. |
| 465 void showTree(const blink::Position&); | 469 void showTree(const blink::Position&); |
| 466 void showTree(const blink::Position*); | 470 void showTree(const blink::Position*); |
| 467 #endif | 471 #endif |
| 468 | 472 |
| 469 #endif // Position_h | 473 #endif // Position_h |
| OLD | NEW |