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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2023793002: Move VisibleSelection::nonBoundaryShadowTreeRootNode() to FrameSelection.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-05-30T17:24:37 Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 0a2138367e08782e4c98e35d6f156429ce0656a2..f558ccd64342b5a67f8f8cf4cbda09aac5d88868 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -798,6 +798,13 @@ void FrameSelection::selectFrameElementInParentIfFullySelected()
toLocalFrame(parent)->selection().setSelection(newSelection);
}
+// Returns a shadow tree node for legacy shadow trees, a child of the
+// ShadowRoot node for new shadow trees, or 0 for non-shadow trees.
+static Node* nonBoundaryShadowTreeRootNode(const Position& position)
+{
+ return position.anchorNode() && !position.anchorNode()->isShadowRoot() ? position.anchorNode()->nonBoundaryShadowTreeRootNode() : nullptr;
+}
+
void FrameSelection::selectAll()
{
Document* document = m_frame->document();
@@ -814,12 +821,12 @@ void FrameSelection::selectAll()
Node* selectStartTarget = nullptr;
if (isContentEditable()) {
root = highestEditableRoot(selection().start());
- if (Node* shadowRoot = selection().nonBoundaryShadowTreeRootNode())
+ if (Node* shadowRoot = nonBoundaryShadowTreeRootNode(selection().start()))
selectStartTarget = shadowRoot->shadowHost();
else
selectStartTarget = root;
} else {
- root = selection().nonBoundaryShadowTreeRootNode();
+ root = nonBoundaryShadowTreeRootNode(selection().start());
if (root) {
selectStartTarget = root->shadowHost();
} else {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698