| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 CORE_EXPORT Node* enclosingNodeOfType( | 127 CORE_EXPORT Node* enclosingNodeOfType( |
| 128 const PositionInFlatTree&, | 128 const PositionInFlatTree&, |
| 129 bool (*nodeIsOfType)(const Node*), | 129 bool (*nodeIsOfType)(const Node*), |
| 130 EditingBoundaryCrossingRule = CannotCrossEditingBoundary); | 130 EditingBoundaryCrossingRule = CannotCrossEditingBoundary); |
| 131 | 131 |
| 132 HTMLSpanElement* tabSpanElement(const Node*); | 132 HTMLSpanElement* tabSpanElement(const Node*); |
| 133 Element* tableElementJustAfter(const VisiblePosition&); | 133 Element* tableElementJustAfter(const VisiblePosition&); |
| 134 CORE_EXPORT Element* tableElementJustBefore(const VisiblePosition&); | 134 CORE_EXPORT Element* tableElementJustBefore(const VisiblePosition&); |
| 135 CORE_EXPORT Element* tableElementJustBefore(const VisiblePositionInFlatTree&); | 135 CORE_EXPORT Element* tableElementJustBefore(const VisiblePositionInFlatTree&); |
| 136 | 136 |
| 137 // Returns the next leaf node or nullptr if there are no more. | 137 // Returns the next leaf node or nullptr if there are no more. Delivers leaf |
| 138 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its leaf
nodes. | 138 // nodes as if the whole DOM tree were a linear chain of its leaf nodes. |
| 139 Node* nextAtomicLeafNode(const Node& start); | 139 Node* nextAtomicLeafNode(const Node& start); |
| 140 | 140 |
| 141 // Returns the previous leaf node or nullptr if there are no more. | 141 // Returns the previous leaf node or nullptr if there are no more. Delivers leaf |
| 142 // Delivers leaf nodes as if the whole DOM tree were a linear chain of its leaf
nodes. | 142 // nodes as if the whole DOM tree were a linear chain of its leaf nodes. |
| 143 Node* previousAtomicLeafNode(const Node& start); | 143 Node* previousAtomicLeafNode(const Node& start); |
| 144 | 144 |
| 145 template <typename Strategy> | 145 template <typename Strategy> |
| 146 ContainerNode* parentCrossingShadowBoundaries(const Node&); | 146 ContainerNode* parentCrossingShadowBoundaries(const Node&); |
| 147 template <> | 147 template <> |
| 148 inline ContainerNode* parentCrossingShadowBoundaries<EditingStrategy>( | 148 inline ContainerNode* parentCrossingShadowBoundaries<EditingStrategy>( |
| 149 const Node& node) { | 149 const Node& node) { |
| 150 return NodeTraversal::parentOrShadowHostNode(node); | 150 return NodeTraversal::parentOrShadowHostNode(node); |
| 151 } | 151 } |
| 152 template <> | 152 template <> |
| 153 inline ContainerNode* parentCrossingShadowBoundaries<EditingInFlatTreeStrategy>( | 153 inline ContainerNode* parentCrossingShadowBoundaries<EditingInFlatTreeStrategy>( |
| 154 const Node& node) { | 154 const Node& node) { |
| 155 return FlatTreeTraversal::parent(node); | 155 return FlatTreeTraversal::parent(node); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // boolean functions on Node | 158 // boolean functions on Node |
| 159 | 159 |
| 160 // FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode | 160 // FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode |
| 161 // should be renamed to reflect its usage. | 161 // should be renamed to reflect its usage. |
| 162 | 162 |
| 163 // Returns true for nodes that either have no content, or have content that is i
gnored (skipped over) while editing. | 163 // Returns true for nodes that either have no content, or have content that is |
| 164 // There are no VisiblePositions inside these nodes. | 164 // ignored (skipped over) while editing. There are no VisiblePositions inside |
| 165 // these nodes. |
| 165 inline bool editingIgnoresContent(const Node* node) { | 166 inline bool editingIgnoresContent(const Node* node) { |
| 166 return EditingStrategy::editingIgnoresContent(node); | 167 return EditingStrategy::editingIgnoresContent(node); |
| 167 } | 168 } |
| 168 | 169 |
| 169 inline bool canHaveChildrenForEditing(const Node* node) { | 170 inline bool canHaveChildrenForEditing(const Node* node) { |
| 170 return !node->isTextNode() && node->canContainRangeEndPoint(); | 171 return !node->isTextNode() && node->canContainRangeEndPoint(); |
| 171 } | 172 } |
| 172 | 173 |
| 173 bool isAtomicNode(const Node*); | 174 bool isAtomicNode(const Node*); |
| 174 CORE_EXPORT bool isEnclosingBlock(const Node*); | 175 CORE_EXPORT bool isEnclosingBlock(const Node*); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 Node* containerB, | 268 Node* containerB, |
| 268 int offsetB, | 269 int offsetB, |
| 269 bool* disconnected = nullptr); | 270 bool* disconnected = nullptr); |
| 270 // TODO(yosin): We replace |comparePositions()| by |Position::opeator<()| to | 271 // TODO(yosin): We replace |comparePositions()| by |Position::opeator<()| to |
| 271 // utilize |DCHECK_XX()|. | 272 // utilize |DCHECK_XX()|. |
| 272 int comparePositions(const Position&, const Position&); | 273 int comparePositions(const Position&, const Position&); |
| 273 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&); | 274 int comparePositions(const PositionWithAffinity&, const PositionWithAffinity&); |
| 274 | 275 |
| 275 // boolean functions on Position | 276 // boolean functions on Position |
| 276 | 277 |
| 277 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on up-to-dat
e | 278 // FIXME: Both isEditablePosition and isRichlyEditablePosition rely on |
| 278 // style to give proper results. They shouldn't update style by default, but | 279 // up-to-date style to give proper results. They shouldn't update style by |
| 279 // should make it clear that that is the contract. | 280 // default, but should make it clear that that is the contract. |
| 280 CORE_EXPORT bool isEditablePosition(const Position&); | 281 CORE_EXPORT bool isEditablePosition(const Position&); |
| 281 bool isEditablePosition(const PositionInFlatTree&); | 282 bool isEditablePosition(const PositionInFlatTree&); |
| 282 bool isRichlyEditablePosition(const Position&); | 283 bool isRichlyEditablePosition(const Position&); |
| 283 bool lineBreakExistsAtPosition(const Position&); | 284 bool lineBreakExistsAtPosition(const Position&); |
| 284 | 285 |
| 285 // miscellaneous functions on Position | 286 // miscellaneous functions on Position |
| 286 | 287 |
| 287 enum WhitespacePositionOption { | 288 enum WhitespacePositionOption { |
| 288 NotConsiderNonCollapsibleWhitespace, | 289 NotConsiderNonCollapsibleWhitespace, |
| 289 ConsiderNonCollapsibleWhitespace | 290 ConsiderNonCollapsibleWhitespace |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // Functions returning VisibleSelection | 386 // Functions returning VisibleSelection |
| 386 VisibleSelection selectionForParagraphIteration(const VisibleSelection&); | 387 VisibleSelection selectionForParagraphIteration(const VisibleSelection&); |
| 387 | 388 |
| 388 Position adjustedSelectionStartForStyleComputation(const VisibleSelection&); | 389 Position adjustedSelectionStartForStyleComputation(const VisibleSelection&); |
| 389 | 390 |
| 390 // Miscellaneous functions on Text | 391 // Miscellaneous functions on Text |
| 391 inline bool isWhitespace(UChar c) { | 392 inline bool isWhitespace(UChar c) { |
| 392 return c == noBreakSpaceCharacter || c == ' ' || c == '\n' || c == '\t'; | 393 return c == noBreakSpaceCharacter || c == ' ' || c == '\n' || c == '\t'; |
| 393 } | 394 } |
| 394 | 395 |
| 395 // FIXME: Can't really answer this question correctly without knowing the white-
space mode. | 396 // FIXME: Can't really answer this question correctly without knowing the |
| 397 // white-space mode. |
| 396 inline bool isCollapsibleWhitespace(UChar c) { | 398 inline bool isCollapsibleWhitespace(UChar c) { |
| 397 return c == ' ' || c == '\n'; | 399 return c == ' ' || c == '\n'; |
| 398 } | 400 } |
| 399 | 401 |
| 400 inline bool isAmbiguousBoundaryCharacter(UChar character) { | 402 inline bool isAmbiguousBoundaryCharacter(UChar character) { |
| 401 // These are characters that can behave as word boundaries, but can appear wit
hin words. | 403 // These are characters that can behave as word boundaries, but can appear |
| 402 // If they are just typed, i.e. if they are immediately followed by a caret, w
e want to delay text checking until the next character has been typed. | 404 // within words. If they are just typed, i.e. if they are immediately followed |
| 403 // FIXME: this is required until 6853027 is fixed and text checking can do thi
s for us. | 405 // by a caret, we want to delay text checking until the next character has |
| 406 // been typed. |
| 407 // FIXME: this is required until 6853027 is fixed and text checking can do |
| 408 // this for us. |
| 404 return character == '\'' || character == rightSingleQuotationMarkCharacter || | 409 return character == '\'' || character == rightSingleQuotationMarkCharacter || |
| 405 character == hebrewPunctuationGershayimCharacter; | 410 character == hebrewPunctuationGershayimCharacter; |
| 406 } | 411 } |
| 407 | 412 |
| 408 String stringWithRebalancedWhitespace(const String&, | 413 String stringWithRebalancedWhitespace(const String&, |
| 409 bool startIsStartOfParagraph, | 414 bool startIsStartOfParagraph, |
| 410 bool shouldEmitNBSPbeforeEnd); | 415 bool shouldEmitNBSPbeforeEnd); |
| 411 const String& nonBreakingSpaceString(); | 416 const String& nonBreakingSpaceString(); |
| 412 | 417 |
| 413 // ------------------------------------------------------------------------- | 418 // ------------------------------------------------------------------------- |
| (...skipping 15 matching lines...) Expand all Loading... |
| 429 InputEvent::InputType, | 434 InputEvent::InputType, |
| 430 DataTransfer*, | 435 DataTransfer*, |
| 431 const RangeVector*); | 436 const RangeVector*); |
| 432 | 437 |
| 433 InputEvent::InputType deletionInputTypeFromTextGranularity(DeleteDirection, | 438 InputEvent::InputType deletionInputTypeFromTextGranularity(DeleteDirection, |
| 434 TextGranularity); | 439 TextGranularity); |
| 435 | 440 |
| 436 } // namespace blink | 441 } // namespace blink |
| 437 | 442 |
| 438 #endif | 443 #endif |
| OLD | NEW |