OLD | NEW |
---|---|
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(MarkerType type, | 132 DocumentMarker::DocumentMarker(MarkerType type, |
133 unsigned startOffset, | 133 unsigned startOffset, |
134 unsigned endOffset, | 134 unsigned endOffset, |
135 const String& description) | |
136 : m_type(type), | |
137 m_startOffset(startOffset), | |
138 m_endOffset(endOffset), | |
139 m_details(description.isEmpty() | |
140 ? nullptr | |
141 : DocumentMarkerDescription::create(description)) {} | |
142 | |
143 DocumentMarker::DocumentMarker(MarkerType type, | |
144 unsigned startOffset, | |
145 unsigned endOffset, | |
146 DocumentMarkerDetails* details) | 135 DocumentMarkerDetails* details) |
147 : m_type(type), | 136 : m_type(type), |
148 m_startOffset(startOffset), | 137 m_startOffset(startOffset), |
149 m_endOffset(endOffset), | 138 m_endOffset(endOffset), |
150 m_details(details) {} | 139 m_details(details) {} |
151 | 140 |
152 DocumentMarker* DocumentMarker::createCompositionMarker(unsigned startOffset, | 141 DocumentMarker* DocumentMarker::createCompositionMarker(unsigned startOffset, |
153 unsigned endOffset, | 142 unsigned endOffset, |
154 Color underlineColor, | 143 Color underlineColor, |
155 bool thick, | 144 bool thick, |
156 Color backgroundColor) { | 145 Color backgroundColor) { |
157 return new DocumentMarker(Composition, startOffset, endOffset, | 146 return new DocumentMarker(Composition, startOffset, endOffset, |
158 TextCompositionMarkerDetails::create( | 147 TextCompositionMarkerDetails::create( |
159 underlineColor, thick, backgroundColor)); | 148 underlineColor, thick, backgroundColor)); |
160 } | 149 } |
161 | 150 |
151 DocumentMarker* DocumentMarker::createGrammarMarker(unsigned startOffset, | |
152 unsigned endOffset, | |
153 const String& description) { | |
154 return new DocumentMarker(Grammar, startOffset, endOffset, | |
yosin_UTC9
2017/03/23 04:01:27
Could you add TODO that we should have DCHECK_LT(s
rlanday
2017/03/23 04:38:21
Just to clarify, why do you want me to add a TODO
| |
155 DocumentMarkerDescription::create(description)); | |
156 } | |
157 | |
158 DocumentMarker* DocumentMarker::createSpellingMarker( | |
159 unsigned startOffset, | |
160 unsigned endOffset, | |
161 const String& description) { | |
162 return new DocumentMarker(Spelling, startOffset, endOffset, | |
yosin_UTC9
2017/03/23 04:01:27
Could you add TODO that we should have DCHECK_LT(s
| |
163 DocumentMarkerDescription::create(description)); | |
164 } | |
165 | |
162 DocumentMarker* DocumentMarker::createTextMatchMarker(unsigned startOffset, | 166 DocumentMarker* DocumentMarker::createTextMatchMarker(unsigned startOffset, |
163 unsigned endOffset, | 167 unsigned endOffset, |
164 bool activeMatch) { | 168 bool activeMatch) { |
165 return new DocumentMarker(TextMatch, startOffset, endOffset, | 169 return new DocumentMarker(TextMatch, startOffset, endOffset, |
166 DocumentMarkerTextMatch::create(activeMatch)); | 170 DocumentMarkerTextMatch::create(activeMatch)); |
167 } | 171 } |
168 | 172 |
169 DocumentMarker::DocumentMarker(const DocumentMarker& marker) | 173 DocumentMarker::DocumentMarker(const DocumentMarker& marker) |
170 : m_type(marker.type()), | 174 : m_type(marker.type()), |
171 m_startOffset(marker.startOffset()), | 175 m_startOffset(marker.startOffset()), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 toTextCompositionMarkerDetails(m_details.get())) | 262 toTextCompositionMarkerDetails(m_details.get())) |
259 return details->backgroundColor(); | 263 return details->backgroundColor(); |
260 return Color::transparent; | 264 return Color::transparent; |
261 } | 265 } |
262 | 266 |
263 DEFINE_TRACE(DocumentMarker) { | 267 DEFINE_TRACE(DocumentMarker) { |
264 visitor->trace(m_details); | 268 visitor->trace(m_details); |
265 } | 269 } |
266 | 270 |
267 } // namespace blink | 271 } // namespace blink |
OLD | NEW |