Changeset 80317 in webkit
- Timestamp:
- Mar 3, 2011 8:58:20 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r80315 r80317 1 2011-03-03 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Kent Tamura. 4 5 Stop calling deprecatedNode and deprecatedEditingOffset in InsertTextCommand 6 https://bugs.webkit.org/show_bug.cgi?id=55352 7 8 Stopped calling deprecatedNode and deprecatedEditingOffset in the following functions: 9 10 * editing/CompositeEditCommand.cpp: 11 (WebCore::CompositeEditCommand::positionOutsideTabSpan): Takes care of all types of positions and 12 no longer calls deprecated functions. 13 * editing/InsertTextCommand.cpp: 14 (WebCore::InsertTextCommand::positionInsideTextNode): Ditto; renamed from prepareForTextInsertion. 15 Check if the text node inside a tab span before checking if the container node is a text node 16 because the position before or after a text node can still be inside a tab span. 17 (WebCore::InsertTextCommand::input): No longer calls deprecated functions. 18 * editing/InsertTextCommand.h: 19 * editing/ModifySelectionListLevel.cpp: 20 (WebCore::getStartEndListChildren): Call anchorNode() instead of deprecatedNode() because the start 21 or the end of selection could be an immediate child of a list node (e.g. br inside ul) 22 1 23 2011-03-03 Hans Wennborg <hans@chromium.org> 2 24 -
trunk/Source/WebCore/editing/CompositeEditCommand.cpp
r79536 r80317 343 343 Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos) 344 344 { 345 if (!isTabSpanTextNode(pos. deprecatedNode()))345 if (!isTabSpanTextNode(pos.anchorNode())) 346 346 return pos; 347 348 Node* tabSpan = tabSpanNode(pos.deprecatedNode()); 349 350 if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.deprecatedNode())) 347 348 if (pos.anchorType() == Position::PositionIsAfterAnchor) 349 return positionInParentAfterNode(pos.anchorNode()); 350 if (pos.anchorType() == Position::PositionIsBeforeAnchor) 351 return positionInParentBeforeNode(pos.anchorNode()); 352 353 Node* tabSpan = tabSpanNode(pos.containerNode()); 354 355 if (pos.offsetInContainerNode() <= caretMinOffset(pos.containerNode())) 351 356 return positionInParentBeforeNode(tabSpan); 352 353 if (pos. deprecatedEditingOffset() >= caretMaxOffset(pos.deprecatedNode()))357 358 if (pos.offsetInContainerNode() >= caretMaxOffset(pos.containerNode())) 354 359 return positionInParentAfterNode(tabSpan); 355 360 356 splitTextNodeContainingElement(static_cast<Text *>(pos. deprecatedNode()), pos.deprecatedEditingOffset());361 splitTextNodeContainingElement(static_cast<Text *>(pos.containerNode()), pos.offsetInContainerNode()); 357 362 return positionInParentBeforeNode(tabSpan); 358 363 } -
trunk/Source/WebCore/editing/InsertTextCommand.cpp
r79976 r80317 48 48 } 49 49 50 Position InsertTextCommand::p repareForTextInsertion(const Position& p)50 Position InsertTextCommand::positionInsideTextNode(const Position& p) 51 51 { 52 52 Position pos = p; 53 if (isTabSpanTextNode(pos.anchorNode())) { 54 RefPtr<Node> textNode = document()->createEditingTextNode(""); 55 insertNodeAtTabSpanPosition(textNode.get(), pos); 56 return firstPositionInNode(textNode.get()); 57 } 58 53 59 // Prepare for text input by looking at the specified position. 54 60 // It may be necessary to insert a text node to receive characters. 55 if (!pos. deprecatedNode()->isTextNode()) {61 if (!pos.containerNode()->isTextNode()) { 56 62 RefPtr<Node> textNode = document()->createEditingTextNode(""); 57 63 insertNodeAt(textNode.get(), pos); 58 return firstPositionInNode(textNode.get());59 }60 61 if (isTabSpanTextNode(pos.deprecatedNode())) {62 RefPtr<Node> textNode = document()->createEditingTextNode("");63 insertNodeAtTabSpanPosition(textNode.get(), pos);64 64 return firstPositionInNode(textNode.get()); 65 65 } … … 142 142 // It is possible for the node that contains startPosition to contain only unrendered whitespace, 143 143 // and so deleteInsignificantText could remove it. Save the position before the node in case that happens. 144 Position positionBeforeStartNode(positionInParentBeforeNode(startPosition. deprecatedNode()));144 Position positionBeforeStartNode(positionInParentBeforeNode(startPosition.containerNode())); 145 145 deleteInsignificantText(startPosition.upstream(), startPosition.downstream()); 146 146 if (!startPosition.anchorNode()->inDocument()) … … 160 160 } else { 161 161 // Make sure the document is set up to receive text 162 startPosition = prepareForTextInsertion(startPosition); 162 startPosition = positionInsideTextNode(startPosition); 163 ASSERT(startPosition.anchorType() == Position::PositionIsOffsetInAnchor); 164 ASSERT(startPosition.containerNode()); 165 ASSERT(startPosition.containerNode()->isTextNode()); 163 166 if (placeholder.isNotNull()) 164 167 removePlaceholderAt(placeholder); 165 Text* textNode = static_cast<Text*>(startPosition. deprecatedNode());166 int offset = startPosition.deprecatedEditingOffset();168 Text* textNode = static_cast<Text*>(startPosition.containerNode()); 169 const unsigned offset = startPosition.offsetInContainerNode(); 167 170 168 171 insertTextIntoNode(textNode, offset, text); … … 178 181 ASSERT(whitespaceRebalance == RebalanceAllWhitespaces); 179 182 if (canRebalance(startPosition) && canRebalance(endPosition)) 180 rebalanceWhitespaceOnTextSubstring(textNode, startPosition. deprecatedEditingOffset(), endPosition.deprecatedEditingOffset());183 rebalanceWhitespaceOnTextSubstring(textNode, startPosition.offsetInContainerNode(), endPosition.offsetInContainerNode()); 181 184 } 182 185 } -
trunk/Source/WebCore/editing/InsertTextCommand.h
r76482 r80317 54 54 virtual bool isInsertTextCommand() const; 55 55 56 Position p repareForTextInsertion(const Position&);56 Position positionInsideTextNode(const Position&); 57 57 Position insertTab(const Position&); 58 58 -
trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp
r79196 r80317 53 53 54 54 // start must be in a list child 55 Node* startListChild = enclosingListChild(selection.start(). deprecatedNode());55 Node* startListChild = enclosingListChild(selection.start().anchorNode()); 56 56 if (!startListChild) 57 57 return false; 58 58 59 59 // end must be in a list child 60 Node* endListChild = selection.isRange() ? enclosingListChild(selection.end(). deprecatedNode()) : startListChild;60 Node* endListChild = selection.isRange() ? enclosingListChild(selection.end().anchorNode()) : startListChild; 61 61 if (!endListChild) 62 62 return false;
Note: See TracChangeset
for help on using the changeset viewer.