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

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

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 480
481 template <typename Strategy> 481 template <typename Strategy>
482 PositionTemplate<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(con st PositionTemplate<Strategy>& position, Node& highestRoot) 482 PositionTemplate<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(con st PositionTemplate<Strategy>& position, Node& highestRoot)
483 { 483 {
484 // position falls before highestRoot. 484 // position falls before highestRoot.
485 if (position.compareTo(PositionTemplate<Strategy>::firstPositionInNode(&high estRoot)) == -1 && highestRoot.hasEditableStyle()) 485 if (position.compareTo(PositionTemplate<Strategy>::firstPositionInNode(&high estRoot)) == -1 && highestRoot.hasEditableStyle())
486 return PositionTemplate<Strategy>::firstPositionInNode(&highestRoot); 486 return PositionTemplate<Strategy>::firstPositionInNode(&highestRoot);
487 487
488 PositionTemplate<Strategy> editablePosition = position; 488 PositionTemplate<Strategy> editablePosition = position;
489 489
490 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { 490 if (position.anchorNode()->treeScopeOrDocument() != highestRoot.treeScopeOrD ocument()) {
491 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita blePosition.anchorNode()); 491 Node* shadowAncestor = highestRoot.treeScopeOrDocument().ancestorInThisS cope(editablePosition.anchorNode());
492 if (!shadowAncestor) 492 if (!shadowAncestor)
493 return PositionTemplate<Strategy>(); 493 return PositionTemplate<Strategy>();
494 494
495 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor) ; 495 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor) ;
496 } 496 }
497 497
498 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition ) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) 498 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition ) && editablePosition.anchorNode()->isDescendantOf(&highestRoot))
499 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis uallyDistinctCandidate(editablePosition); 499 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis uallyDistinctCandidate(editablePosition);
500 500
501 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) 501 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot))
(...skipping 24 matching lines...) Expand all
526 526
527 template <typename Strategy> 527 template <typename Strategy>
528 PositionTemplate<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(con st PositionTemplate<Strategy>& position, Node& highestRoot) 528 PositionTemplate<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(con st PositionTemplate<Strategy>& position, Node& highestRoot)
529 { 529 {
530 // When position falls after highestRoot, the result is easy to compute. 530 // When position falls after highestRoot, the result is easy to compute.
531 if (position.compareTo(PositionTemplate<Strategy>::lastPositionInNode(&highe stRoot)) == 1) 531 if (position.compareTo(PositionTemplate<Strategy>::lastPositionInNode(&highe stRoot)) == 1)
532 return PositionTemplate<Strategy>::lastPositionInNode(&highestRoot); 532 return PositionTemplate<Strategy>::lastPositionInNode(&highestRoot);
533 533
534 PositionTemplate<Strategy> editablePosition = position; 534 PositionTemplate<Strategy> editablePosition = position;
535 535
536 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { 536 if (position.anchorNode()->treeScopeOrDocument() != highestRoot.treeScopeOrD ocument()) {
537 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita blePosition.anchorNode()); 537 Node* shadowAncestor = highestRoot.treeScopeOrDocument().ancestorInThisS cope(editablePosition.anchorNode());
538 if (!shadowAncestor) 538 if (!shadowAncestor)
539 return PositionTemplate<Strategy>(); 539 return PositionTemplate<Strategy>();
540 540
541 editablePosition = PositionTemplate<Strategy>::firstPositionInOrBeforeNo de(shadowAncestor); 541 editablePosition = PositionTemplate<Strategy>::firstPositionInOrBeforeNo de(shadowAncestor);
542 } 542 }
543 543
544 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition ) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) 544 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition ) && editablePosition.anchorNode()->isDescendantOf(&highestRoot))
545 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio nTemplate<Strategy>::inParentBeforeNode(*editablePosition.anchorNode()) : previo usVisuallyDistinctCandidate(editablePosition); 545 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio nTemplate<Strategy>::inParentBeforeNode(*editablePosition.anchorNode()) : previo usVisuallyDistinctCandidate(editablePosition);
546 546
547 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) 547 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot))
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // instead of possibly at the end of the last node before the selection 1725 // instead of possibly at the end of the last node before the selection
1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); 1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent());
1727 } 1727 }
1728 1728
1729 bool isTextSecurityNode(const Node* node) 1729 bool isTextSecurityNode(const Node* node)
1730 { 1730 {
1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; 1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE;
1732 } 1732 }
1733 1733
1734 } // namespace blink 1734 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/DOMSelection.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698