| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (result.start_offset >= result.end_offset) | 175 if (result.start_offset >= result.end_offset) |
| 176 return WTF::nullopt; | 176 return WTF::nullopt; |
| 177 | 177 |
| 178 return result; | 178 return result; |
| 179 } | 179 } |
| 180 | 180 |
| 181 void DocumentMarker::ShiftOffsets(int delta) { | 181 void DocumentMarker::ShiftOffsets(int delta) { |
| 182 start_offset_ += delta; | 182 start_offset_ += delta; |
| 183 end_offset_ += delta; | 183 end_offset_ += delta; |
| 184 } | 184 } |
| 185 void DocumentMarker::SetIsActiveMatch(bool active) { | |
| 186 if (GetType() != DocumentMarker::kTextMatch) | |
| 187 return; | |
| 188 ToTextMatchMarker(this)->SetIsActiveMatch(active); | |
| 189 } | |
| 190 | 185 |
| 191 const String& DocumentMarker::Description() const { | 186 const String& DocumentMarker::Description() const { |
| 192 if (DocumentMarkerDescription* details = | 187 if (DocumentMarkerDescription* details = |
| 193 ToDocumentMarkerDescription(details_.Get())) | 188 ToDocumentMarkerDescription(details_.Get())) |
| 194 return details->Description(); | 189 return details->Description(); |
| 195 return g_empty_string; | 190 return g_empty_string; |
| 196 } | 191 } |
| 197 | 192 |
| 198 bool DocumentMarker::IsActiveMatch() const { | |
| 199 if (GetType() != DocumentMarker::kTextMatch) | |
| 200 return false; | |
| 201 return ToTextMatchMarker(this)->IsActiveMatch(); | |
| 202 } | |
| 203 | |
| 204 Color DocumentMarker::UnderlineColor() const { | 193 Color DocumentMarker::UnderlineColor() const { |
| 205 if (TextCompositionMarkerDetails* details = | 194 if (TextCompositionMarkerDetails* details = |
| 206 ToTextCompositionMarkerDetails(details_.Get())) | 195 ToTextCompositionMarkerDetails(details_.Get())) |
| 207 return details->UnderlineColor(); | 196 return details->UnderlineColor(); |
| 208 return Color::kTransparent; | 197 return Color::kTransparent; |
| 209 } | 198 } |
| 210 | 199 |
| 211 bool DocumentMarker::Thick() const { | 200 bool DocumentMarker::Thick() const { |
| 212 if (TextCompositionMarkerDetails* details = | 201 if (TextCompositionMarkerDetails* details = |
| 213 ToTextCompositionMarkerDetails(details_.Get())) | 202 ToTextCompositionMarkerDetails(details_.Get())) |
| 214 return details->Thick(); | 203 return details->Thick(); |
| 215 return false; | 204 return false; |
| 216 } | 205 } |
| 217 | 206 |
| 218 Color DocumentMarker::BackgroundColor() const { | 207 Color DocumentMarker::BackgroundColor() const { |
| 219 if (TextCompositionMarkerDetails* details = | 208 if (TextCompositionMarkerDetails* details = |
| 220 ToTextCompositionMarkerDetails(details_.Get())) | 209 ToTextCompositionMarkerDetails(details_.Get())) |
| 221 return details->BackgroundColor(); | 210 return details->BackgroundColor(); |
| 222 return Color::kTransparent; | 211 return Color::kTransparent; |
| 223 } | 212 } |
| 224 | 213 |
| 225 DEFINE_TRACE(DocumentMarker) { | 214 DEFINE_TRACE(DocumentMarker) { |
| 226 visitor->Trace(details_); | 215 visitor->Trace(details_); |
| 227 } | 216 } |
| 228 | 217 |
| 229 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |