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

Side by Side Diff: Source/core/editing/VisibleSelection.cpp

Issue 1318943002: Move global function lowestEditableAncestor() to local function in VisibleSelection.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-27T17:01:49 Created 5 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
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 m_startInComposedTree = adjustPositionInComposedTreeForStart(m_startInCo mposedTree, shadowHost); 898 m_startInComposedTree = adjustPositionInComposedTreeForStart(m_startInCo mposedTree, shadowHost);
899 m_extentInComposedTree = m_startInComposedTree; 899 m_extentInComposedTree = m_startInComposedTree;
900 } 900 }
901 } 901 }
902 902
903 bool VisibleSelection::isBaseFirstInComposedTree() const 903 bool VisibleSelection::isBaseFirstInComposedTree() const
904 { 904 {
905 return m_baseInComposedTree.isNotNull() && m_baseInComposedTree.compareTo(m_ extentInComposedTree) <= 0; 905 return m_baseInComposedTree.isNotNull() && m_baseInComposedTree.compareTo(m_ extentInComposedTree) <= 0;
906 } 906 }
907 907
908 static Element* lowestEditableAncestor(Node* node)
909 {
910 while (node) {
911 if (node->hasEditableStyle())
912 return node->rootEditableElement();
913 if (isHTMLBodyElement(*node))
914 break;
915 node = node->parentNode();
916 }
917
918 return nullptr;
919 }
920
908 void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries() 921 void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
909 { 922 {
910 if (m_base.isNull() || m_start.isNull() || m_end.isNull()) 923 if (m_base.isNull() || m_start.isNull() || m_end.isNull())
911 return; 924 return;
912 925
913 ContainerNode* baseRoot = highestEditableRoot(m_base); 926 ContainerNode* baseRoot = highestEditableRoot(m_base);
914 ContainerNode* startRoot = highestEditableRoot(m_start); 927 ContainerNode* startRoot = highestEditableRoot(m_start);
915 ContainerNode* endRoot = highestEditableRoot(m_end); 928 ContainerNode* endRoot = highestEditableRoot(m_end);
916 929
917 Element* baseEditableAncestor = lowestEditableAncestor(m_base.computeContain erNode()); 930 Element* baseEditableAncestor = lowestEditableAncestor(m_base.computeContain erNode());
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 sel.showTreeForThis(); 1257 sel.showTreeForThis();
1245 } 1258 }
1246 1259
1247 void showTree(const blink::VisibleSelection* sel) 1260 void showTree(const blink::VisibleSelection* sel)
1248 { 1261 {
1249 if (sel) 1262 if (sel)
1250 sel->showTreeForThis(); 1263 sel->showTreeForThis();
1251 } 1264 }
1252 1265
1253 #endif 1266 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698