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

Side by Side Diff: Source/core/dom/Node.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 #ifndef NDEBUG 1136 #ifndef NDEBUG
1137 detachingNode = 0; 1137 detachingNode = 0;
1138 #endif 1138 #endif
1139 } 1139 }
1140 1140
1141 // FIXME: This code is used by editing. Seems like it could move over there and not pollute Node. 1141 // FIXME: This code is used by editing. Seems like it could move over there and not pollute Node.
1142 Node* Node::previousNodeConsideringAtomicNodes() const 1142 Node* Node::previousNodeConsideringAtomicNodes() const
1143 { 1143 {
1144 if (previousSibling()) { 1144 if (previousSibling()) {
1145 Handle<Node> n = previousSibling(); 1145 Handle<Node> n = previousSibling();
1146 while (!isAtomicNode(n.raw()) && n->lastChild()) { 1146 while (!isAtomicNode(n) && n->lastChild()) {
1147 HandleScope scope; 1147 HandleScope scope;
1148 n = n->lastChild(); 1148 n = n->lastChild();
1149 } 1149 }
1150 return n.raw(); 1150 return n.raw();
1151 } 1151 }
1152 else if (parentNode()) { 1152 else if (parentNode()) {
1153 return parentNode().handle().raw(); 1153 return parentNode().handle().raw();
1154 } 1154 }
1155 else { 1155 else {
1156 return 0; 1156 return 0;
1157 } 1157 }
1158 } 1158 }
1159 1159
1160 Node* Node::nextNodeConsideringAtomicNodes() const 1160 Node* Node::nextNodeConsideringAtomicNodes() const
1161 { 1161 {
1162 if (!isAtomicNode(this) && firstChild()) 1162 if (!isAtomicNode(selfHandle()) && firstChild())
1163 return firstChild().handle().raw(); 1163 return firstChild().handle().raw();
1164 if (nextSibling()) 1164 if (nextSibling())
1165 return nextSibling().handle().raw(); 1165 return nextSibling().handle().raw();
1166 Handle<const Node> n = selfHandle(); 1166 Handle<const Node> n = selfHandle();
1167 while (n && !n->nextSibling()) { 1167 while (n && !n->nextSibling()) {
1168 HandleScope scope; 1168 HandleScope scope;
1169 n = n->parentNode(); 1169 n = n->parentNode();
1170 } 1170 }
1171 if (n) 1171 if (n)
1172 return n->nextSibling().handle().raw(); 1172 return n->nextSibling().handle().raw();
1173 return 0; 1173 return 0;
1174 } 1174 }
1175 1175
1176 Result<Node> Node::previousLeafNode() const 1176 Result<Node> Node::previousLeafNode() const
1177 { 1177 {
1178 Handle<Node> node = adoptRawResult(previousNodeConsideringAtomicNodes()); 1178 Handle<Node> node = adoptRawResult(previousNodeConsideringAtomicNodes());
1179 while (node) { 1179 while (node) {
1180 HandleScope scope; 1180 HandleScope scope;
1181 if (isAtomicNode(node.raw())) 1181 if (isAtomicNode(node))
1182 return node; 1182 return node;
1183 node = adoptRawResult(node->previousNodeConsideringAtomicNodes()); 1183 node = adoptRawResult(node->previousNodeConsideringAtomicNodes());
1184 } 1184 }
1185 return nullptr; 1185 return nullptr;
1186 } 1186 }
1187 1187
1188 Result<Node> Node::nextLeafNode() const 1188 Result<Node> Node::nextLeafNode() const
1189 { 1189 {
1190 Handle<Node> node = adoptRawResult(nextNodeConsideringAtomicNodes()); 1190 Handle<Node> node = adoptRawResult(nextNodeConsideringAtomicNodes());
1191 while (node) { 1191 while (node) {
1192 HandleScope scope; 1192 HandleScope scope;
1193 if (isAtomicNode(node.raw())) 1193 if (isAtomicNode(node))
1194 return node; 1194 return node;
1195 node = adoptRawResult(node->nextNodeConsideringAtomicNodes()); 1195 node = adoptRawResult(node->nextNodeConsideringAtomicNodes());
1196 } 1196 }
1197 return nullptr; 1197 return nullptr;
1198 } 1198 }
1199 1199
1200 Result<ContainerNode> Node::parentNodeForRenderingAndStyle() 1200 Result<ContainerNode> Node::parentNodeForRenderingAndStyle()
1201 { 1201 {
1202 return NodeRenderingContext(selfHandle()).parentNodeForRenderingAndStyle(); 1202 return NodeRenderingContext(selfHandle()).parentNodeForRenderingAndStyle();
1203 } 1203 }
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 node->showTreeForThis(); 2768 node->showTreeForThis();
2769 } 2769 }
2770 2770
2771 void showNodePath(const WebCore::Node* node) 2771 void showNodePath(const WebCore::Node* node)
2772 { 2772 {
2773 if (node) 2773 if (node)
2774 node->showNodePathForThis(); 2774 node->showNodePathForThis();
2775 } 2775 }
2776 2776
2777 #endif 2777 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698