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

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

Issue 307353002: Use Position instead of VisiblePosition for SurroundingText. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix crash Created 6 years, 6 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 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 m_deepPosition.showTreeForThis(); 718 m_deepPosition.showTreeForThis();
719 } 719 }
720 720
721 #endif 721 #endif
722 722
723 PassRefPtrWillBeRawPtr<Range> makeRange(const VisiblePosition &start, const Visi blePosition &end) 723 PassRefPtrWillBeRawPtr<Range> makeRange(const VisiblePosition &start, const Visi blePosition &end)
724 { 724 {
725 if (start.isNull() || end.isNull()) 725 if (start.isNull() || end.isNull())
726 return nullptr; 726 return nullptr;
727 727
728 Position s = start.deepEquivalent().parentAnchoredEquivalent(); 728 return makeRange(start.deepEquivalent(), end.deepEquivalent());
729 Position e = end.deepEquivalent().parentAnchoredEquivalent();
730 if (s.isNull() || e.isNull())
731 return nullptr;
732
733 return Range::create(s.containerNode()->document(), s.containerNode(), s.off setInContainerNode(), e.containerNode(), e.offsetInContainerNode());
734 } 729 }
735 730
736 VisiblePosition startVisiblePosition(const Range *r, EAffinity affinity) 731 VisiblePosition startVisiblePosition(const Range *r, EAffinity affinity)
737 { 732 {
738 return VisiblePosition(r->startPosition(), affinity); 733 return VisiblePosition(r->startPosition(), affinity);
739 } 734 }
740 735
741 bool setStart(Range *r, const VisiblePosition &visiblePosition) 736 bool setStart(Range *r, const VisiblePosition &visiblePosition)
742 { 737 {
743 if (!r) 738 if (!r)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 if (vpos) 799 if (vpos)
805 vpos->showTreeForThis(); 800 vpos->showTreeForThis();
806 } 801 }
807 802
808 void showTree(const WebCore::VisiblePosition& vpos) 803 void showTree(const WebCore::VisiblePosition& vpos)
809 { 804 {
810 vpos.showTreeForThis(); 805 vpos.showTreeForThis();
811 } 806 }
812 807
813 #endif 808 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698