OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |