| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
| 30 #include "core/editing/EditingBoundary.h" | 30 #include "core/editing/EditingBoundary.h" |
| 31 #include "core/editing/Position.h" | 31 #include "core/editing/Position.h" |
| 32 #include "core/editing/PositionWithAffinity.h" | 32 #include "core/editing/PositionWithAffinity.h" |
| 33 #include "platform/text/TextDirection.h" | 33 #include "platform/text/TextDirection.h" |
| 34 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
| 35 #include "wtf/text/CharacterNames.h" | 35 #include "wtf/text/CharacterNames.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 enum class PositionMoveType { |
| 40 CodePoint, // Move by a single code point. |
| 41 Character, // Move to the next Unicode character break. |
| 42 BackwardDeletion // Subject to platform conventions. |
| 43 }; |
| 44 |
| 39 class Document; | 45 class Document; |
| 40 class Element; | 46 class Element; |
| 41 class HTMLBRElement; | 47 class HTMLBRElement; |
| 42 class HTMLElement; | 48 class HTMLElement; |
| 43 class HTMLLIElement; | 49 class HTMLLIElement; |
| 44 class HTMLSpanElement; | 50 class HTMLSpanElement; |
| 45 class HTMLUListElement; | 51 class HTMLUListElement; |
| 46 class Node; | 52 class Node; |
| 47 class Range; | 53 class Range; |
| 48 class VisiblePosition; | 54 class VisiblePosition; |
| 49 class VisibleSelection; | 55 class VisibleSelection; |
| 50 | 56 |
| 51 | |
| 52 // This file contains a set of helper functions used by the editing commands | 57 // This file contains a set of helper functions used by the editing commands |
| 53 | 58 |
| 54 // ------------------------------------------------------------------------- | 59 // ------------------------------------------------------------------------- |
| 55 // Node | 60 // Node |
| 56 // ------------------------------------------------------------------------- | 61 // ------------------------------------------------------------------------- |
| 57 | 62 |
| 58 // Functions returning Node | 63 // Functions returning Node |
| 59 | 64 |
| 60 CORE_EXPORT ContainerNode* highestEditableRoot(const Position&, EditableType = C
ontentIsEditable); | 65 CORE_EXPORT ContainerNode* highestEditableRoot(const Position&, EditableType = C
ontentIsEditable); |
| 61 ContainerNode* highestEditableRoot(const PositionInComposedTree&, EditableType =
ContentIsEditable); | 66 ContainerNode* highestEditableRoot(const PositionInComposedTree&, EditableType =
ContentIsEditable); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 175 } |
| 171 | 176 |
| 172 inline Position lastPositionInOrAfterNode(Node* node) | 177 inline Position lastPositionInOrAfterNode(Node* node) |
| 173 { | 178 { |
| 174 return Position::lastPositionInOrAfterNode(node); | 179 return Position::lastPositionInOrAfterNode(node); |
| 175 } | 180 } |
| 176 | 181 |
| 177 Position lastEditablePositionBeforePositionInRoot(const Position&, Node*); | 182 Position lastEditablePositionBeforePositionInRoot(const Position&, Node*); |
| 178 PositionInComposedTree lastEditablePositionBeforePositionInRoot(const PositionIn
ComposedTree&, Node*); | 183 PositionInComposedTree lastEditablePositionBeforePositionInRoot(const PositionIn
ComposedTree&, Node*); |
| 179 | 184 |
| 185 // Move up or down the DOM by one position. |
| 186 // Offsets are computed using layout text for nodes that have layoutObjects - |
| 187 // but note that even when using composed characters, the result may be inside |
| 188 // a single user-visible character if a ligature is formed. |
| 189 CORE_EXPORT Position previousPositionOf(const Position&, PositionMoveType); |
| 190 CORE_EXPORT Position nextPositionOf(const Position&, PositionMoveType); |
| 191 CORE_EXPORT PositionInComposedTree previousPositionOf(const PositionInComposedTr
ee&, PositionMoveType); |
| 192 CORE_EXPORT PositionInComposedTree nextPositionOf(const PositionInComposedTree&,
PositionMoveType); |
| 193 |
| 194 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current); |
| 195 CORE_EXPORT int uncheckedNextOffset(const Node*, int current); |
| 196 |
| 180 // comparision functions on Position | 197 // comparision functions on Position |
| 181 | 198 |
| 182 // |disconnected| is optional output parameter having true if specified | 199 // |disconnected| is optional output parameter having true if specified |
| 183 // positions don't have common ancestor. | 200 // positions don't have common ancestor. |
| 184 int comparePositionsInDOMTree(Node* containerA, int offsetA, Node* containerB, i
nt offsetB, bool* disconnected = nullptr); | 201 int comparePositionsInDOMTree(Node* containerA, int offsetA, Node* containerB, i
nt offsetB, bool* disconnected = nullptr); |
| 185 int comparePositionsInComposedTree(Node* containerA, int offsetA, Node* containe
rB, int offsetB, bool* disconnected = nullptr); | 202 int comparePositionsInComposedTree(Node* containerA, int offsetA, Node* containe
rB, int offsetB, bool* disconnected = nullptr); |
| 186 int comparePositions(const Position&, const Position&); | 203 int comparePositions(const Position&, const Position&); |
| 187 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&); | 204 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&); |
| 188 | 205 |
| 189 // boolean functions on Position | 206 // boolean functions on Position |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // FIXME: this is required until 6853027 is fixed and text checking can do t
his for us. | 305 // FIXME: this is required until 6853027 is fixed and text checking can do t
his for us. |
| 289 return character == '\'' || character == rightSingleQuotationMarkCharacter |
| character == hebrewPunctuationGershayimCharacter; | 306 return character == '\'' || character == rightSingleQuotationMarkCharacter |
| character == hebrewPunctuationGershayimCharacter; |
| 290 } | 307 } |
| 291 | 308 |
| 292 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap
h, bool endIsEndOfParagraph); | 309 String stringWithRebalancedWhitespace(const String&, bool startIsStartOfParagrap
h, bool endIsEndOfParagraph); |
| 293 const String& nonBreakingSpaceString(); | 310 const String& nonBreakingSpaceString(); |
| 294 | 311 |
| 295 } | 312 } |
| 296 | 313 |
| 297 #endif | 314 #endif |
| OLD | NEW |