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

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

Issue 2764783004: Add DocumentMarker::createTextMatchMarker() (Closed)
Patch Set: Rebase Created 3 years, 9 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 unsigned startOffset, 133 unsigned startOffset,
134 unsigned endOffset, 134 unsigned endOffset,
135 const String& description) 135 const String& description)
136 : m_type(type), 136 : m_type(type),
137 m_startOffset(startOffset), 137 m_startOffset(startOffset),
138 m_endOffset(endOffset), 138 m_endOffset(endOffset),
139 m_details(description.isEmpty() 139 m_details(description.isEmpty()
140 ? nullptr 140 ? nullptr
141 : DocumentMarkerDescription::create(description)) {} 141 : DocumentMarkerDescription::create(description)) {}
142 142
143 DocumentMarker::DocumentMarker(unsigned startOffset,
144 unsigned endOffset,
145 bool activeMatch)
146 : m_type(DocumentMarker::TextMatch),
147 m_startOffset(startOffset),
148 m_endOffset(endOffset),
149 m_details(DocumentMarkerTextMatch::create(activeMatch)) {}
150
151 DocumentMarker::DocumentMarker(MarkerType type, 143 DocumentMarker::DocumentMarker(MarkerType type,
152 unsigned startOffset, 144 unsigned startOffset,
153 unsigned endOffset, 145 unsigned endOffset,
154 DocumentMarkerDetails* details) 146 DocumentMarkerDetails* details)
155 : m_type(type), 147 : m_type(type),
156 m_startOffset(startOffset), 148 m_startOffset(startOffset),
157 m_endOffset(endOffset), 149 m_endOffset(endOffset),
158 m_details(details) {} 150 m_details(details) {}
159 151
160 DocumentMarker* DocumentMarker::createCompositionMarker(unsigned startOffset, 152 DocumentMarker* DocumentMarker::createCompositionMarker(unsigned startOffset,
161 unsigned endOffset, 153 unsigned endOffset,
162 Color underlineColor, 154 Color underlineColor,
163 bool thick, 155 bool thick,
164 Color backgroundColor) { 156 Color backgroundColor) {
165 return new DocumentMarker(Composition, startOffset, endOffset, 157 return new DocumentMarker(Composition, startOffset, endOffset,
166 TextCompositionMarkerDetails::create( 158 TextCompositionMarkerDetails::create(
167 underlineColor, thick, backgroundColor)); 159 underlineColor, thick, backgroundColor));
168 } 160 }
169 161
162 DocumentMarker* DocumentMarker::createTextMatchMarker(unsigned startOffset,
163 unsigned endOffset,
164 bool activeMatch) {
165 return new DocumentMarker(TextMatch, startOffset, endOffset,
166 DocumentMarkerTextMatch::create(activeMatch));
167 }
168
170 DocumentMarker::DocumentMarker(const DocumentMarker& marker) 169 DocumentMarker::DocumentMarker(const DocumentMarker& marker)
171 : m_type(marker.type()), 170 : m_type(marker.type()),
172 m_startOffset(marker.startOffset()), 171 m_startOffset(marker.startOffset()),
173 m_endOffset(marker.endOffset()), 172 m_endOffset(marker.endOffset()),
174 m_details(marker.details()) {} 173 m_details(marker.details()) {}
175 174
176 DocumentMarker::ShiftMarkerResult DocumentMarker::getShiftedMarkerPosition( 175 DocumentMarker::ShiftMarkerResult DocumentMarker::getShiftedMarkerPosition(
177 unsigned offset, 176 unsigned offset,
178 unsigned oldLength, 177 unsigned oldLength,
179 unsigned newLength) const { 178 unsigned newLength) const {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 toTextCompositionMarkerDetails(m_details.get())) 258 toTextCompositionMarkerDetails(m_details.get()))
260 return details->backgroundColor(); 259 return details->backgroundColor();
261 return Color::transparent; 260 return Color::transparent;
262 } 261 }
263 262
264 DEFINE_TRACE(DocumentMarker) { 263 DEFINE_TRACE(DocumentMarker) {
265 visitor->trace(m_details); 264 visitor->trace(m_details);
266 } 265 }
267 266
268 } // namespace blink 267 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698