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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 147 } |
148 | 148 |
149 DocumentMarker::DocumentMarker(unsigned startOffset, | 149 DocumentMarker::DocumentMarker(unsigned startOffset, |
150 unsigned endOffset, | 150 unsigned endOffset, |
151 bool activeMatch) | 151 bool activeMatch) |
152 : m_type(DocumentMarker::TextMatch), | 152 : m_type(DocumentMarker::TextMatch), |
153 m_startOffset(startOffset), | 153 m_startOffset(startOffset), |
154 m_endOffset(endOffset), | 154 m_endOffset(endOffset), |
155 m_details(DocumentMarkerTextMatch::create(activeMatch)) {} | 155 m_details(DocumentMarkerTextMatch::create(activeMatch)) {} |
156 | 156 |
157 DocumentMarker::DocumentMarker(unsigned startOffset, | 157 DocumentMarker::DocumentMarker(MarkerType type, |
| 158 unsigned startOffset, |
158 unsigned endOffset, | 159 unsigned endOffset, |
159 Color underlineColor, | 160 DocumentMarkerDetails* details) |
160 bool thick, | 161 : m_type(type), |
161 Color backgroundColor) | |
162 : m_type(DocumentMarker::Composition), | |
163 m_startOffset(startOffset), | 162 m_startOffset(startOffset), |
164 m_endOffset(endOffset), | 163 m_endOffset(endOffset), |
165 m_details(TextCompositionMarkerDetails::create(underlineColor, | 164 m_details(details) {} |
166 thick, | 165 |
167 backgroundColor)) {} | 166 DocumentMarker* DocumentMarker::createCompositionMarker(unsigned startOffset, |
| 167 unsigned endOffset, |
| 168 Color underlineColor, |
| 169 bool thick, |
| 170 Color backgroundColor) { |
| 171 return new DocumentMarker(Composition, startOffset, endOffset, |
| 172 TextCompositionMarkerDetails::create( |
| 173 underlineColor, thick, backgroundColor)); |
| 174 } |
168 | 175 |
169 DocumentMarker::DocumentMarker(const DocumentMarker& marker) | 176 DocumentMarker::DocumentMarker(const DocumentMarker& marker) |
170 : m_type(marker.type()), | 177 : m_type(marker.type()), |
171 m_startOffset(marker.startOffset()), | 178 m_startOffset(marker.startOffset()), |
172 m_endOffset(marker.endOffset()), | 179 m_endOffset(marker.endOffset()), |
173 m_details(marker.details()) {} | 180 m_details(marker.details()) {} |
174 | 181 |
175 DocumentMarker::ShiftMarkerResult DocumentMarker::getShiftedMarkerPosition( | 182 DocumentMarker::ShiftMarkerResult DocumentMarker::getShiftedMarkerPosition( |
176 unsigned offset, | 183 unsigned offset, |
177 unsigned oldLength, | 184 unsigned oldLength, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 toTextCompositionMarkerDetails(m_details.get())) | 268 toTextCompositionMarkerDetails(m_details.get())) |
262 return details->backgroundColor(); | 269 return details->backgroundColor(); |
263 return Color::transparent; | 270 return Color::transparent; |
264 } | 271 } |
265 | 272 |
266 DEFINE_TRACE(DocumentMarker) { | 273 DEFINE_TRACE(DocumentMarker) { |
267 visitor->trace(m_details); | 274 visitor->trace(m_details); |
268 } | 275 } |
269 | 276 |
270 } // namespace blink | 277 } // namespace blink |
OLD | NEW |