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

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

Issue 2781623010: Add DocumentMarker::clone() (Closed)
Patch Set: Rebase Created 3 years, 8 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 backgroundColor); 122 backgroundColor);
123 } 123 }
124 124
125 inline TextCompositionMarkerDetails* toTextCompositionMarkerDetails( 125 inline TextCompositionMarkerDetails* toTextCompositionMarkerDetails(
126 DocumentMarkerDetails* details) { 126 DocumentMarkerDetails* details) {
127 if (details && details->isComposition()) 127 if (details && details->isComposition())
128 return static_cast<TextCompositionMarkerDetails*>(details); 128 return static_cast<TextCompositionMarkerDetails*>(details);
129 return nullptr; 129 return nullptr;
130 } 130 }
131 131
132 DocumentMarker* DocumentMarker::clone() const {
133 return new DocumentMarker(*this);
134 }
135
132 DocumentMarker::DocumentMarker(MarkerType type, 136 DocumentMarker::DocumentMarker(MarkerType type,
133 unsigned startOffset, 137 unsigned startOffset,
134 unsigned endOffset, 138 unsigned endOffset,
135 const String& description) 139 const String& description)
136 : m_type(type), 140 : m_type(type),
137 m_startOffset(startOffset), 141 m_startOffset(startOffset),
138 m_endOffset(endOffset), 142 m_endOffset(endOffset),
139 m_details(description.isEmpty() 143 m_details(description.isEmpty()
140 ? nullptr 144 ? nullptr
141 : DocumentMarkerDescription::create(description)) {} 145 : DocumentMarkerDescription::create(description)) {}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 toTextCompositionMarkerDetails(m_details.get())) 212 toTextCompositionMarkerDetails(m_details.get()))
209 return details->backgroundColor(); 213 return details->backgroundColor();
210 return Color::transparent; 214 return Color::transparent;
211 } 215 }
212 216
213 DEFINE_TRACE(DocumentMarker) { 217 DEFINE_TRACE(DocumentMarker) {
214 visitor->trace(m_details); 218 visitor->trace(m_details);
215 } 219 }
216 220
217 } // namespace blink 221 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698