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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2742703002: Make rootEditableElementOrTreeScopeRootNodeOf() to take Position instead of VisibleSeleciton (Closed)
Patch Set: 2017-03-09T14:58:18 Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 Element* FrameSelection::rootEditableElementOrDocumentElement() const { 135 Element* FrameSelection::rootEditableElementOrDocumentElement() const {
136 Element* selectionRoot = 136 Element* selectionRoot =
137 computeVisibleSelectionInDOMTreeDeprecated().rootEditableElement(); 137 computeVisibleSelectionInDOMTreeDeprecated().rootEditableElement();
138 return selectionRoot ? selectionRoot : document().documentElement(); 138 return selectionRoot ? selectionRoot : document().documentElement();
139 } 139 }
140 140
141 // TODO(yosin): We should move |rootEditableElementOrTreeScopeRootNodeOf()| to 141 // TODO(yosin): We should move |rootEditableElementOrTreeScopeRootNodeOf()| to
142 // "EditingUtilities.cpp" 142 // "EditingUtilities.cpp"
143 ContainerNode* rootEditableElementOrTreeScopeRootNodeOf( 143 ContainerNode* rootEditableElementOrTreeScopeRootNodeOf(
144 const VisibleSelection& visibleSelection) { 144 const Position& position) {
145 Element* selectionRoot = visibleSelection.rootEditableElement(); 145 Element* selectionRoot = rootEditableElementOf(position);
146 if (selectionRoot) 146 if (selectionRoot)
147 return selectionRoot; 147 return selectionRoot;
148 148
149 Node* const node = visibleSelection.base().computeContainerNode(); 149 Node* const node = position.computeContainerNode();
150 return node ? &node->treeScope().rootNode() : 0; 150 return node ? &node->treeScope().rootNode() : 0;
151 } 151 }
152 152
153 const VisibleSelection& 153 const VisibleSelection&
154 FrameSelection::computeVisibleSelectionInDOMTreeDeprecated() const { 154 FrameSelection::computeVisibleSelectionInDOMTreeDeprecated() const {
155 // TODO(yosin): We should hoist updateStyleAndLayoutIgnorePendingStylesheets 155 // TODO(yosin): We should hoist updateStyleAndLayoutIgnorePendingStylesheets
156 // to caller. See http://crbug.com/590369 for more details. 156 // to caller. See http://crbug.com/590369 for more details.
157 document().updateStyleAndLayoutIgnorePendingStylesheets(); 157 document().updateStyleAndLayoutIgnorePendingStylesheets();
158 return computeVisibleSelectionInDOMTree(); 158 return computeVisibleSelectionInDOMTree();
159 } 159 }
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1158 }
1159 1159
1160 void showTree(const blink::FrameSelection* sel) { 1160 void showTree(const blink::FrameSelection* sel) {
1161 if (sel) 1161 if (sel)
1162 sel->showTreeForThis(); 1162 sel->showTreeForThis();
1163 else 1163 else
1164 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1164 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1165 } 1165 }
1166 1166
1167 #endif 1167 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698