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

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

Issue 2715913002: Introduce rootEditableElementOrTreeScopeRootNodeOf() as replacement of FrameSelection member (Closed)
Patch Set: 2017-02-24T16:18:33 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const SelectionInDOMTree& FrameSelection::selectionInDOMTree() const { 132 const SelectionInDOMTree& FrameSelection::selectionInDOMTree() const {
133 return m_selectionEditor->selectionInDOMTree(); 133 return m_selectionEditor->selectionInDOMTree();
134 } 134 }
135 135
136 Element* FrameSelection::rootEditableElementOrDocumentElement() const { 136 Element* FrameSelection::rootEditableElementOrDocumentElement() const {
137 Element* selectionRoot = 137 Element* selectionRoot =
138 computeVisibleSelectionInDOMTreeDeprecated().rootEditableElement(); 138 computeVisibleSelectionInDOMTreeDeprecated().rootEditableElement();
139 return selectionRoot ? selectionRoot : document().documentElement(); 139 return selectionRoot ? selectionRoot : document().documentElement();
140 } 140 }
141 141
142 ContainerNode* FrameSelection::rootEditableElementOrTreeScopeRootNode() const { 142 // TODO(yosin): We should move |rootEditableElementOrTreeScopeRootNodeOf()| to
143 Element* selectionRoot = 143 // "EditingUtilities.cpp"
144 computeVisibleSelectionInDOMTreeDeprecated().rootEditableElement(); 144 ContainerNode* rootEditableElementOrTreeScopeRootNodeOf(
145 const VisibleSelection& visibleSelection) {
146 Element* selectionRoot = visibleSelection.rootEditableElement();
145 if (selectionRoot) 147 if (selectionRoot)
146 return selectionRoot; 148 return selectionRoot;
147 149
148 Node* node = computeVisibleSelectionInDOMTreeDeprecated() 150 Node* const node = visibleSelection.base().computeContainerNode();
149 .base()
150 .computeContainerNode();
151 return node ? &node->treeScope().rootNode() : 0; 151 return node ? &node->treeScope().rootNode() : 0;
152 } 152 }
153 153
154 const VisibleSelection& 154 const VisibleSelection&
155 FrameSelection::computeVisibleSelectionInDOMTreeDeprecated() const { 155 FrameSelection::computeVisibleSelectionInDOMTreeDeprecated() const {
156 // TODO(yosin): We should hoist updateStyleAndLayoutIgnorePendingStylesheets 156 // TODO(yosin): We should hoist updateStyleAndLayoutIgnorePendingStylesheets
157 // to caller. See http://crbug.com/590369 for more details. 157 // to caller. See http://crbug.com/590369 for more details.
158 document().updateStyleAndLayoutIgnorePendingStylesheets(); 158 document().updateStyleAndLayoutIgnorePendingStylesheets();
159 return computeVisibleSelectionInDOMTree(); 159 return computeVisibleSelectionInDOMTree();
160 } 160 }
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1177 }
1178 1178
1179 void showTree(const blink::FrameSelection* sel) { 1179 void showTree(const blink::FrameSelection* sel) {
1180 if (sel) 1180 if (sel)
1181 sel->showTreeForThis(); 1181 sel->showTreeForThis();
1182 else 1182 else
1183 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1183 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1184 } 1184 }
1185 1185
1186 #endif 1186 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698