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

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

Issue 1319753004: Introduce composed tree version of VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-07T14:06:02 Rebase for VisibleSelectionChangeObserver and PendingSelection::commit 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 static EphemeralRangeInComposedTree asRange(const VisibleSelection&); 90 static EphemeralRangeInComposedTree asRange(const VisibleSelection&);
91 static bool equalSelections(const VisibleSelection&, const VisibleSelect ion&); 91 static bool equalSelections(const VisibleSelection&, const VisibleSelect ion&);
92 static bool isRange(const VisibleSelection& selection) { return selectio nType(selection) == RangeSelection; } 92 static bool isRange(const VisibleSelection& selection) { return selectio nType(selection) == RangeSelection; }
93 static PositionType selectionBase(const VisibleSelection& selection) { r eturn selection.baseInComposedTree(); } 93 static PositionType selectionBase(const VisibleSelection& selection) { r eturn selection.baseInComposedTree(); }
94 static PositionType selectionExtent(const VisibleSelection& selection) { return selection.extentInComposedTree(); } 94 static PositionType selectionExtent(const VisibleSelection& selection) { return selection.extentInComposedTree(); }
95 static PositionType selectionStart(const VisibleSelection& selection) { return selection.startInComposedTree(); } 95 static PositionType selectionStart(const VisibleSelection& selection) { return selection.startInComposedTree(); }
96 static PositionType selectionEnd(const VisibleSelection& selection) { re turn selection.endInComposedTree(); } 96 static PositionType selectionEnd(const VisibleSelection& selection) { re turn selection.endInComposedTree(); }
97 static SelectionType selectionType(const VisibleSelection& selection) { return selection.selectionTypeInComposedTree(); } 97 static SelectionType selectionType(const VisibleSelection& selection) { return selection.selectionTypeInComposedTree(); }
98 static VisiblePosition selectionVisibleStart(const VisibleSelection& sel ection) 98 static VisiblePosition selectionVisibleStart(const VisibleSelection& sel ection)
99 { 99 {
100 return createVisiblePosition(selectionStart(selection), isRange(sele ction) ? TextAffinity::Downstream : selection.affinity()); 100 return createVisiblePositionInDOMTree(selectionStart(selection), isR ange(selection) ? TextAffinity::Downstream : selection.affinity());
101 } 101 }
102 static VisiblePosition selectionVisibleEnd(const VisibleSelection& selec tion) 102 static VisiblePosition selectionVisibleEnd(const VisibleSelection& selec tion)
103 { 103 {
104 return createVisiblePosition(selectionEnd(selection), isRange(select ion) ? TextAffinity::Upstream : selection.affinity()); 104 return createVisiblePositionInDOMTree(selectionEnd(selection), isRan ge(selection) ? TextAffinity::Upstream : selection.affinity());
105 } 105 }
106 static PositionType toPositionType(const Position& position) { return to PositionInComposedTree(position); } 106 static PositionType toPositionType(const Position& position) { return to PositionInComposedTree(position); }
107 }; 107 };
108 108
109 VisibleSelection(); 109 VisibleSelection();
110 110
111 VisibleSelection(const Position&, TextAffinity, bool isDirectional = false); 111 VisibleSelection(const Position&, TextAffinity, bool isDirectional = false);
112 VisibleSelection(const Position& base, const Position& extent, TextAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false); 112 VisibleSelection(const Position& base, const Position& extent, TextAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false);
113 VisibleSelection(const PositionInComposedTree& base, const PositionInCompose dTree& extent, TextAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false); 113 VisibleSelection(const PositionInComposedTree& base, const PositionInCompose dTree& extent, TextAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false);
114 114
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 } // namespace blink 259 } // namespace blink
260 260
261 #ifndef NDEBUG 261 #ifndef NDEBUG
262 // Outside the WebCore namespace for ease of invocation from gdb. 262 // Outside the WebCore namespace for ease of invocation from gdb.
263 void showTree(const blink::VisibleSelection&); 263 void showTree(const blink::VisibleSelection&);
264 void showTree(const blink::VisibleSelection*); 264 void showTree(const blink::VisibleSelection*);
265 #endif 265 #endif
266 266
267 #endif // VisibleSelection_h 267 #endif // VisibleSelection_h
OLDNEW
« no previous file with comments | « Source/core/editing/VisiblePositionTest.cpp ('k') | Source/core/editing/serializers/StyledMarkupSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698