| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 Color underline_color, | 162 Color underline_color, |
| 163 bool thick, | 163 bool thick, |
| 164 Color background_color) | 164 Color background_color) |
| 165 : type_(DocumentMarker::kComposition), | 165 : type_(DocumentMarker::kComposition), |
| 166 start_offset_(start_offset), | 166 start_offset_(start_offset), |
| 167 end_offset_(end_offset), | 167 end_offset_(end_offset), |
| 168 details_(TextCompositionMarkerDetails::Create(underline_color, | 168 details_(TextCompositionMarkerDetails::Create(underline_color, |
| 169 thick, | 169 thick, |
| 170 background_color)) {} | 170 background_color)) {} |
| 171 | 171 |
| 172 DocumentMarker::DocumentMarker(const DocumentMarker& marker) | |
| 173 : type_(marker.GetType()), | |
| 174 start_offset_(marker.StartOffset()), | |
| 175 end_offset_(marker.EndOffset()), | |
| 176 details_(marker.Details()) {} | |
| 177 | |
| 178 Optional<DocumentMarker::MarkerOffsets> | 172 Optional<DocumentMarker::MarkerOffsets> |
| 179 DocumentMarker::ComputeOffsetsAfterShift(unsigned offset, | 173 DocumentMarker::ComputeOffsetsAfterShift(unsigned offset, |
| 180 unsigned old_length, | 174 unsigned old_length, |
| 181 unsigned new_length) const { | 175 unsigned new_length) const { |
| 182 MarkerOffsets result; | 176 MarkerOffsets result; |
| 183 result.start_offset = StartOffset(); | 177 result.start_offset = StartOffset(); |
| 184 result.end_offset = EndOffset(); | 178 result.end_offset = EndOffset(); |
| 185 | 179 |
| 186 // algorithm inspired by https://dom.spec.whatwg.org/#concept-cd-replace | 180 // algorithm inspired by https://dom.spec.whatwg.org/#concept-cd-replace |
| 187 // but with some changes | 181 // but with some changes |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 ToTextCompositionMarkerDetails(details_.Get())) | 259 ToTextCompositionMarkerDetails(details_.Get())) |
| 266 return details->BackgroundColor(); | 260 return details->BackgroundColor(); |
| 267 return Color::kTransparent; | 261 return Color::kTransparent; |
| 268 } | 262 } |
| 269 | 263 |
| 270 DEFINE_TRACE(DocumentMarker) { | 264 DEFINE_TRACE(DocumentMarker) { |
| 271 visitor->Trace(details_); | 265 visitor->Trace(details_); |
| 272 } | 266 } |
| 273 | 267 |
| 274 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |