diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/editing/InsertLineBreakCommand.cpp | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/editing/InsertLineBreakCommand.cpp')
-rw-r--r-- | Source/WebCore/editing/InsertLineBreakCommand.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Source/WebCore/editing/InsertLineBreakCommand.cpp b/Source/WebCore/editing/InsertLineBreakCommand.cpp index af8f2fc..2260a00 100644 --- a/Source/WebCore/editing/InsertLineBreakCommand.cpp +++ b/Source/WebCore/editing/InsertLineBreakCommand.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "InsertLineBreakCommand.h" -#include "CSSMutableStyleDeclaration.h" #include "Document.h" #include "Frame.h" #include "HTMLElement.h" @@ -57,11 +56,11 @@ void InsertLineBreakCommand::insertNodeAfterPosition(Node* node, const Position& // Insert the BR after the caret position. In the case the // position is a block, do an append. We don't want to insert // the BR *after* the block. - Element* cb = pos.node()->enclosingBlockFlowElement(); - if (cb == pos.node()) + Element* cb = pos.deprecatedNode()->enclosingBlockFlowElement(); + if (cb == pos.deprecatedNode()) appendNode(node, cb); else - insertNodeAfter(node, pos.node()); + insertNodeAfter(node, pos.deprecatedNode()); } void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position& pos) @@ -69,11 +68,11 @@ void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position // Insert the BR after the caret position. In the case the // position is a block, do an append. We don't want to insert // the BR *before* the block. - Element* cb = pos.node()->enclosingBlockFlowElement(); - if (cb == pos.node()) + Element* cb = pos.deprecatedNode()->enclosingBlockFlowElement(); + if (cb == pos.deprecatedNode()) appendNode(node, cb); else - insertNodeBefore(node, pos.node()); + insertNodeBefore(node, pos.deprecatedNode()); } // Whether we should insert a break element or a '\n'. @@ -83,7 +82,7 @@ bool InsertLineBreakCommand::shouldUseBreakElement(const Position& insertionPos) // the input element, and in that case we need to check the input element's // parent's renderer. Position p(insertionPos.parentAnchoredEquivalent()); - return p.node()->renderer() && !p.node()->renderer()->style()->preserveNewline(); + return p.deprecatedNode()->renderer() && !p.deprecatedNode()->renderer()->style()->preserveNewline(); } void InsertLineBreakCommand::doApply() @@ -114,7 +113,7 @@ void InsertLineBreakCommand::doApply() // FIXME: Need to merge text nodes when inserting just after or before text. if (isEndOfParagraph(caret) && !lineBreakExistsAtVisiblePosition(caret)) { - bool needExtraLineBreak = !pos.node()->hasTagName(hrTag) && !pos.node()->hasTagName(tableTag); + bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !pos.deprecatedNode()->hasTagName(tableTag); insertNodeAt(nodeToInsert.get(), pos); @@ -123,7 +122,7 @@ void InsertLineBreakCommand::doApply() VisiblePosition endingPosition(positionBeforeNode(nodeToInsert.get())); setEndingSelection(VisibleSelection(endingPosition)); - } else if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.node())) { + } else if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.deprecatedNode())) { insertNodeAt(nodeToInsert.get(), pos); // Insert an extra br or '\n' if the just inserted one collapsed. @@ -133,12 +132,12 @@ void InsertLineBreakCommand::doApply() setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM)); // If we're inserting after all of the rendered text in a text node, or into a non-text node, // a simple insertion is sufficient. - } else if (pos.deprecatedEditingOffset() >= caretMaxOffset(pos.node()) || !pos.node()->isTextNode()) { + } else if (pos.deprecatedEditingOffset() >= caretMaxOffset(pos.deprecatedNode()) || !pos.deprecatedNode()->isTextNode()) { insertNodeAt(nodeToInsert.get(), pos); setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM)); - } else if (pos.node()->isTextNode()) { + } else if (pos.deprecatedNode()->isTextNode()) { // Split a text node - Text* textNode = static_cast<Text*>(pos.node()); + Text* textNode = static_cast<Text*>(pos.deprecatedNode()); splitTextNode(textNode, pos.deprecatedEditingOffset()); insertNodeBefore(nodeToInsert, textNode); Position endingPosition = firstPositionInNode(textNode); |