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

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

Issue 2455083003: Reduce usage of VisibleSelection::setBase() and setExtent() (Closed)
Patch Set: 2016-10-31T10:31:10 Created 4 years, 1 month 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 m_affinity = other.m_affinity; 121 m_affinity = other.m_affinity;
122 m_selectionType = other.m_selectionType; 122 m_selectionType = other.m_selectionType;
123 m_baseIsFirst = other.m_baseIsFirst; 123 m_baseIsFirst = other.m_baseIsFirst;
124 m_isDirectional = other.m_isDirectional; 124 m_isDirectional = other.m_isDirectional;
125 m_granularity = other.m_granularity; 125 m_granularity = other.m_granularity;
126 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace; 126 m_hasTrailingWhitespace = other.m_hasTrailingWhitespace;
127 return *this; 127 return *this;
128 } 128 }
129 129
130 template <typename Strategy> 130 template <typename Strategy>
131 SelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::asSelection()
132 const {
133 typename SelectionTemplate<Strategy>::Builder builder;
134 if (m_base.isNotNull())
135 builder.setBaseAndExtent(m_base, m_extent);
136 return builder.setAffinity(m_affinity)
137 .setGranularity(m_granularity)
138 .setIsDirectional(m_isDirectional)
139 .setHasTrailingWhitespace(m_hasTrailingWhitespace)
140 .build();
141 }
142
143 template <typename Strategy>
131 void VisibleSelectionTemplate<Strategy>::setBase( 144 void VisibleSelectionTemplate<Strategy>::setBase(
132 const PositionTemplate<Strategy>& position) { 145 const PositionTemplate<Strategy>& position) {
133 DCHECK(!needsLayoutTreeUpdate(position)); 146 DCHECK(!needsLayoutTreeUpdate(position));
134 m_base = position; 147 m_base = position;
135 validate(); 148 validate();
136 } 149 }
137 150
138 template <typename Strategy> 151 template <typename Strategy>
139 void VisibleSelectionTemplate<Strategy>::setBase( 152 void VisibleSelectionTemplate<Strategy>::setBase(
140 const VisiblePositionTemplate<Strategy>& visiblePosition) { 153 const VisiblePositionTemplate<Strategy>& visiblePosition) {
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 847
835 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 848 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
836 sel.showTreeForThis(); 849 sel.showTreeForThis();
837 } 850 }
838 851
839 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 852 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
840 if (sel) 853 if (sel)
841 sel->showTreeForThis(); 854 sel->showTreeForThis();
842 } 855 }
843 #endif 856 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698