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

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

Issue 2140733003: [Editing][CodeHealth] Make Node::rootEditableElement static (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 LineLayoutItem lineLayoutItem = root->closestLeafChildForPoint(pointInLi ne, isEditablePosition(p, ContentIsEditable))->getLineLayoutItem(); 1329 LineLayoutItem lineLayoutItem = root->closestLeafChildForPoint(pointInLi ne, isEditablePosition(p, ContentIsEditable))->getLineLayoutItem();
1330 Node* node = lineLayoutItem.node(); 1330 Node* node = lineLayoutItem.node();
1331 if (node && editingIgnoresContent(node)) 1331 if (node && editingIgnoresContent(node))
1332 return VisiblePosition::inParentBeforeNode(*node); 1332 return VisiblePosition::inParentBeforeNode(*node);
1333 return createVisiblePosition(lineLayoutItem.positionForPoint(pointInLine )); 1333 return createVisiblePosition(lineLayoutItem.positionForPoint(pointInLine ));
1334 } 1334 }
1335 1335
1336 // Could not find a previous line. This means we must already be on the firs t line. 1336 // Could not find a previous line. This means we must already be on the firs t line.
1337 // Move to the start of the content in this block, which effectively moves u s 1337 // Move to the start of the content in this block, which effectively moves u s
1338 // to the start of the line we're on. 1338 // to the start of the line we're on.
1339 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit ableElement(editableType) : node->document().documentElement(); 1339 Element* rootElement = node->hasEditableStyle(editableType) ? rootEditableEl ement(*node, editableType) : node->document().documentElement();
1340 if (!rootElement) 1340 if (!rootElement)
1341 return VisiblePosition(); 1341 return VisiblePosition();
1342 return VisiblePosition::firstPositionInNode(rootElement); 1342 return VisiblePosition::firstPositionInNode(rootElement);
1343 } 1343 }
1344 1344
1345 VisiblePosition nextLinePosition(const VisiblePosition& visiblePosition, LayoutU nit lineDirectionPoint, EditableType editableType) 1345 VisiblePosition nextLinePosition(const VisiblePosition& visiblePosition, LayoutU nit lineDirectionPoint, EditableType editableType)
1346 { 1346 {
1347 Position p = visiblePosition.deepEquivalent(); 1347 Position p = visiblePosition.deepEquivalent();
1348 Node* node = p.anchorNode(); 1348 Node* node = p.anchorNode();
1349 1349
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 LineLayoutItem lineLayoutItem = root->closestLeafChildForPoint(pointInLi ne, isEditablePosition(p))->getLineLayoutItem(); 1385 LineLayoutItem lineLayoutItem = root->closestLeafChildForPoint(pointInLi ne, isEditablePosition(p))->getLineLayoutItem();
1386 Node* node = lineLayoutItem.node(); 1386 Node* node = lineLayoutItem.node();
1387 if (node && editingIgnoresContent(node)) 1387 if (node && editingIgnoresContent(node))
1388 return VisiblePosition::inParentBeforeNode(*node); 1388 return VisiblePosition::inParentBeforeNode(*node);
1389 return createVisiblePosition(lineLayoutItem.positionForPoint(pointInLine )); 1389 return createVisiblePosition(lineLayoutItem.positionForPoint(pointInLine ));
1390 } 1390 }
1391 1391
1392 // Could not find a next line. This means we must already be on the last lin e. 1392 // Could not find a next line. This means we must already be on the last lin e.
1393 // Move to the end of the content in this block, which effectively moves us 1393 // Move to the end of the content in this block, which effectively moves us
1394 // to the end of the line we're on. 1394 // to the end of the line we're on.
1395 Element* rootElement = node->hasEditableStyle(editableType) ? node->rootEdit ableElement(editableType) : node->document().documentElement(); 1395 Element* rootElement = node->hasEditableStyle(editableType) ? rootEditableEl ement(*node, editableType) : node->document().documentElement();
1396 if (!rootElement) 1396 if (!rootElement)
1397 return VisiblePosition(); 1397 return VisiblePosition();
1398 return VisiblePosition::lastPositionInNode(rootElement); 1398 return VisiblePosition::lastPositionInNode(rootElement);
1399 } 1399 }
1400 1400
1401 // --------- 1401 // ---------
1402 1402
1403 static unsigned startSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&) 1403 static unsigned startSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
1404 { 1404 {
1405 TextBreakIterator* iterator = sentenceBreakIterator(characters, length); 1405 TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 { 3252 {
3253 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); 3253 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule);
3254 } 3254 }
3255 3255
3256 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) 3256 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule)
3257 { 3257 {
3258 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); 3258 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule);
3259 } 3259 }
3260 3260
3261 } // namespace blink 3261 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698