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

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

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed 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 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 725
726 template <typename Strategy> 726 template <typename Strategy>
727 Element* VisibleSelectionTemplate<Strategy>::rootEditableElement() const 727 Element* VisibleSelectionTemplate<Strategy>::rootEditableElement() const
728 { 728 {
729 return rootEditableElementOf(start()); 729 return rootEditableElementOf(start());
730 } 730 }
731 731
732 template <typename Strategy> 732 template <typename Strategy>
733 static bool isValidPosition(const PositionTemplate<Strategy>& position) 733 static bool isValidPosition(const PositionTemplate<Strategy>& position)
734 { 734 {
735 if (!position.inShadowIncludingDocument()) 735 if (!position.isConnected())
736 return false; 736 return false;
737 737
738 if (!position.isOffsetInAnchor()) 738 if (!position.isOffsetInAnchor())
739 return true; 739 return true;
740 740
741 if (position.offsetInContainerNode() < 0) 741 if (position.offsetInContainerNode() < 0)
742 return false; 742 return false;
743 743
744 const unsigned offset = static_cast<unsigned>(position.offsetInContainerNode ()); 744 const unsigned offset = static_cast<unsigned>(position.offsetInContainerNode ());
745 const unsigned nodeLength = position.anchorNode()->lengthOfContents(); 745 const unsigned nodeLength = position.anchorNode()->lengthOfContents();
(...skipping 10 matching lines...) Expand all
756 const bool hasTrailingWhitespace = m_hasTrailingWhitespace; 756 const bool hasTrailingWhitespace = m_hasTrailingWhitespace;
757 validate(m_granularity); 757 validate(m_granularity);
758 if (!hasTrailingWhitespace) 758 if (!hasTrailingWhitespace)
759 return; 759 return;
760 appendTrailingWhitespace(); 760 appendTrailingWhitespace();
761 } 761 }
762 762
763 template <typename Strategy> 763 template <typename Strategy>
764 void VisibleSelectionTemplate<Strategy>::validatePositionsIfNeeded() 764 void VisibleSelectionTemplate<Strategy>::validatePositionsIfNeeded()
765 { 765 {
766 if (!m_base.inShadowIncludingDocument() || !m_extent.inShadowIncludingDocume nt()) { 766 if (!m_base.isConnected() || !m_extent.isConnected()) {
767 *this = VisibleSelectionTemplate(); 767 *this = VisibleSelectionTemplate();
768 return; 768 return;
769 } 769 }
770 if (isValidPosition(m_base) && isValidPosition(m_extent) && isValidPosition( m_start) && isValidPosition(m_end)) 770 if (isValidPosition(m_base) && isValidPosition(m_extent) && isValidPosition( m_start) && isValidPosition(m_end))
771 return; 771 return;
772 validate(); 772 validate();
773 } 773 }
774 774
775 template <typename Strategy> 775 template <typename Strategy>
776 static bool equalSelectionsAlgorithm(const VisibleSelectionTemplate<Strategy>& s election1, const VisibleSelectionTemplate<Strategy>& selection2) 776 static bool equalSelectionsAlgorithm(const VisibleSelectionTemplate<Strategy>& s election1, const VisibleSelectionTemplate<Strategy>& selection2)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 { 908 {
909 sel.showTreeForThis(); 909 sel.showTreeForThis();
910 } 910 }
911 911
912 void showTree(const blink::VisibleSelectionInFlatTree* sel) 912 void showTree(const blink::VisibleSelectionInFlatTree* sel)
913 { 913 {
914 if (sel) 914 if (sel)
915 sel->showTreeForThis(); 915 sel->showTreeForThis();
916 } 916 }
917 #endif 917 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698