Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Unified Diff: Source/core/editing/InsertListCommand.cpp

Issue 24278008: [oilpan] Handlify Nodes in htmlediting (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/InsertListCommand.cpp
diff --git a/Source/core/editing/InsertListCommand.cpp b/Source/core/editing/InsertListCommand.cpp
index 0507ab640fe0ee9b9368edd76da9757874c703bd..e52f1ab2ca2d75f324e1388f6ab90cb81c63393a 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -40,12 +40,12 @@ using namespace HTMLNames;
static Node* enclosingListChild(Node* node, Node* listNode)
{
- Node* listChild = enclosingListChild(node);
+ Handle<Node> listChild = enclosingListChild(adoptRawResult(node));
while (listChild && enclosingList(listChild) != listNode) {
HandleScope scope;
- listChild = enclosingListChild(listChild->parentNode().handle().raw());
+ listChild = enclosingListChild(listChild->parentNode());
}
- return listChild;
+ return listChild.raw();
}
Result<HTMLElement> InsertListCommand::insertList(const Handle<Document>& document, Type type)
@@ -86,13 +86,13 @@ bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection
{
VisiblePosition start = selection.visibleStart();
- if (!enclosingList(start.deepEquivalent().deprecatedNode().handle().raw()))
+ if (!enclosingList(start.deepEquivalent().deprecatedNode()))
return false;
VisiblePosition end = startOfParagraph(selection.visibleEnd());
while (start.isNotNull() && start != end) {
HandleScope scope;
- Handle<Element> listNode = enclosingList(start.deepEquivalent().deprecatedNode().handle().raw());
+ Handle<Element> listNode = enclosingList(start.deepEquivalent().deprecatedNode());
if (!listNode || !listNode->hasTagName(listTag))
return false;
start = startOfNextParagraph(start);
@@ -196,13 +196,13 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
// table and ends inside the first cell, selectionForParagraphIteration should probably
// be renamed and deployed inside setEndingSelection().
Handle<Node> selectionNode = endingSelection().start().deprecatedNode();
- Node* listChildNode = enclosingListChild(selectionNode.raw());
+ Handle<Node> listChildNode = enclosingListChild(selectionNode);
bool switchListType = false;
if (listChildNode) {
// Remove the list chlild.
Handle<HTMLElement> listNode = enclosingList(listChildNode);
if (!listNode) {
- listNode = fixOrphanedListChild(listChildNode);
+ listNode = fixOrphanedListChild(listChildNode.raw());
listNode = mergeWithNeighboringLists(listNode);
}
if (!listNode->hasTagName(listTag))
@@ -214,9 +214,9 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
return;
// If the entire list is selected, then convert the whole list.
- if (switchListType && isNodeVisiblyContainedWithin(listNode.raw(), currentSelection)) {
- bool rangeStartIsInList = visiblePositionBeforeNode(listNode.raw()) == currentSelection->startPosition();
- bool rangeEndIsInList = visiblePositionAfterNode(listNode.raw()) == currentSelection->endPosition();
+ if (switchListType && isNodeVisiblyContainedWithin(listNode, currentSelection)) {
+ bool rangeStartIsInList = visiblePositionBeforeNode(listNode) == currentSelection->startPosition();
+ bool rangeEndIsInList = visiblePositionAfterNode(listNode) == currentSelection->endPosition();
Handle<HTMLElement> newList = createHTMLElement(document(), listTag);
insertNodeBefore(newList, listNode);
@@ -245,7 +245,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
return;
}
- unlistifyParagraph(endingSelection().visibleStart(), listNode, listChildNode);
+ unlistifyParagraph(endingSelection().visibleStart(), listNode, listChildNode.raw());
}
if (!listChildNode || switchListType || forceCreateList)
@@ -278,7 +278,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
Handle<Element> nodeToInsert = placeholder;
// If the content of the list item will be moved into another list, put it in a list item
// so that we don't create an orphaned list child.
- if (enclosingList(listNode.raw())) {
+ if (enclosingList(listNode)) {
nodeToInsert = createListItemElement(document());
appendNode(placeholder, nodeToInsert);
}
@@ -310,17 +310,17 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
static Result<Element> adjacentEnclosingList(const VisiblePosition& pos, const VisiblePosition& adjacentPos, const QualifiedName& listTag)
{
- Handle<Element> listNode = outermostEnclosingList(adjacentPos.deepEquivalent().deprecatedNode().handle().raw());
+ Handle<Element> listNode = outermostEnclosingList(adjacentPos.deepEquivalent().deprecatedNode());
if (!listNode)
return nullptr;
- Node* previousCell = enclosingTableCell(pos.deepEquivalent());
- Node* currentCell = enclosingTableCell(adjacentPos.deepEquivalent());
+ Handle<Node> previousCell = enclosingTableCell(pos.deepEquivalent());
+ Handle<Node> currentCell = enclosingTableCell(adjacentPos.deepEquivalent());
if (!listNode->hasTagName(listTag)
|| listNode->contains(pos.deepEquivalent().deprecatedNode())
|| previousCell != currentCell
- || enclosingList(listNode.raw()) != enclosingList(pos.deepEquivalent().deprecatedNode().handle().raw()))
+ || enclosingList(listNode) != enclosingList(pos.deepEquivalent().deprecatedNode()))
return nullptr;
return listNode;
@@ -352,7 +352,7 @@ Result<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePosition& o
listElement = createHTMLElement(document(), listTag);
appendNode(listItemElement, listElement);
- if (start == end && isBlock(start.deepEquivalent().deprecatedNode().handle().raw())) {
+ if (start == end && isBlock(start.deepEquivalent().deprecatedNode())) {
// Inserting the list into an empty paragraph that isn't held open
// by a br or a '\n', will invalidate start and end. Insert
// a placeholder and then recompute start and end.
@@ -368,7 +368,7 @@ Result<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePosition& o
// clean markup when inline elements are pushed down as far as possible.
Position insertionPos(start.deepEquivalent().upstream());
// Also avoid the containing list item.
- Handle<Node> listChild = adoptRawResult(enclosingListChild(insertionPos.deprecatedNode().handle().raw()));
+ Handle<Node> listChild = enclosingListChild(insertionPos.deprecatedNode());
if (listChild && listChild->hasTagName(liTag))
insertionPos = positionInParentBeforeNode(listChild);

Powered by Google App Engine
This is Rietveld 408576698