diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/editing/ModifySelectionListLevel.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/editing/ModifySelectionListLevel.cpp')
-rw-r--r-- | Source/WebCore/editing/ModifySelectionListLevel.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Source/WebCore/editing/ModifySelectionListLevel.cpp b/Source/WebCore/editing/ModifySelectionListLevel.cpp index 54ae258e4..f3400fda6 100644 --- a/Source/WebCore/editing/ModifySelectionListLevel.cpp +++ b/Source/WebCore/editing/ModifySelectionListLevel.cpp @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -29,7 +29,8 @@ #include "Document.h" #include "Frame.h" #include "FrameSelection.h" -#include "HTMLElement.h" +#include "HTMLOListElement.h" +#include "HTMLUListElement.h" #include "RenderObject.h" #include "htmlediting.h" @@ -79,7 +80,7 @@ static bool getStartEndListChildren(const VisibleSelection& selection, Node*& st // if the selection ends on a list item with a sublist, include the entire sublist if (endListChild->renderer()->isListItem()) { RenderObject* r = endListChild->renderer()->nextSibling(); - if (r && isListElement(r->node())) + if (r && isListHTMLElement(r->node())) endListChild = r->node(); } @@ -176,9 +177,9 @@ void IncreaseSelectionListLevelCommand::doApply() return; Node* previousItem = startListChild->renderer()->previousSibling()->node(); - if (isListElement(previousItem)) { + if (isListHTMLElement(previousItem)) { // move nodes up into preceding list - appendSiblingNodeRange(startListChild, endListChild, toElement(previousItem)); + appendSiblingNodeRange(startListChild, endListChild, downcast<Element>(previousItem)); m_listElement = previousItem; } else { // create a sublist for the preceding element and move nodes there @@ -187,18 +188,18 @@ void IncreaseSelectionListLevelCommand::doApply() case InheritedListType: newParent = startListChild->parentElement(); if (newParent) - newParent = newParent->cloneElementWithoutChildren(); + newParent = newParent->cloneElementWithoutChildren(document()); break; case OrderedList: - newParent = createOrderedListElement(document()); + newParent = HTMLOListElement::create(document()); break; case UnorderedList: - newParent = createUnorderedListElement(document()); + newParent = HTMLUListElement::create(document()); break; } insertNodeBefore(newParent, startListChild); appendSiblingNodeRange(startListChild, endListChild, newParent.get()); - m_listElement = newParent.release(); + m_listElement = WTFMove(newParent); } } @@ -209,13 +210,13 @@ bool IncreaseSelectionListLevelCommand::canIncreaseSelectionListLevel(Document* return canIncreaseListLevel(document->frame()->selection().selection(), startListChild, endListChild); } -PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document, Type type) +RefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document, Type type) { ASSERT(document); ASSERT(document->frame()); - RefPtr<IncreaseSelectionListLevelCommand> command = create(*document, type); + auto command = create(*document, type); command->apply(); - return command->m_listElement.release(); + return WTFMove(command->m_listElement); } PassRefPtr<Node> IncreaseSelectionListLevelCommand::increaseSelectionListLevel(Document* document) @@ -243,11 +244,11 @@ static bool canDecreaseListLevel(const VisibleSelection& selection, Node*& start { if (!getStartEndListChildren(selection, start, end)) return false; - + // there must be a destination list to move the items to - if (!isListElement(start->parentNode()->parentNode())) + if (!isListHTMLElement(start->parentNode()->parentNode())) return false; - + return true; } |