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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/editing/markers/DocumentMarker.h" | 31 #include "core/editing/markers/DocumentMarker.h" |
32 | 32 |
| 33 #include "core/editing/markers/RenderedTextMatchMarker.h" |
33 #include "wtf/StdLibExtras.h" | 34 #include "wtf/StdLibExtras.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 DocumentMarkerDetails::~DocumentMarkerDetails() {} | 38 DocumentMarkerDetails::~DocumentMarkerDetails() {} |
38 | 39 |
39 class DocumentMarkerDescription final : public DocumentMarkerDetails { | 40 class DocumentMarkerDescription final : public DocumentMarkerDetails { |
40 public: | 41 public: |
41 static DocumentMarkerDescription* create(const String&); | 42 static DocumentMarkerDescription* create(const String&); |
42 | 43 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 : m_type(marker.type()), | 165 : m_type(marker.type()), |
165 m_startOffset(marker.startOffset()), | 166 m_startOffset(marker.startOffset()), |
166 m_endOffset(marker.endOffset()), | 167 m_endOffset(marker.endOffset()), |
167 m_details(marker.details()) {} | 168 m_details(marker.details()) {} |
168 | 169 |
169 void DocumentMarker::shiftOffsets(int delta) { | 170 void DocumentMarker::shiftOffsets(int delta) { |
170 m_startOffset += delta; | 171 m_startOffset += delta; |
171 m_endOffset += delta; | 172 m_endOffset += delta; |
172 } | 173 } |
173 | 174 |
| 175 bool DocumentMarker::isRenderedTextMatch() const { |
| 176 return false; |
| 177 } |
| 178 |
| 179 RenderedTextMatchMarker* DocumentMarker::asRenderedTextMatchMarker() { |
| 180 if (!this->isRenderedTextMatch()) |
| 181 return nullptr; |
| 182 |
| 183 return static_cast<RenderedTextMatchMarker*>(this); |
| 184 } |
| 185 |
174 void DocumentMarker::setActiveMatch(bool active) { | 186 void DocumentMarker::setActiveMatch(bool active) { |
175 m_details = DocumentMarkerTextMatch::create(active); | 187 m_details = DocumentMarkerTextMatch::create(active); |
176 } | 188 } |
177 | 189 |
178 const String& DocumentMarker::description() const { | 190 const String& DocumentMarker::description() const { |
179 if (DocumentMarkerDescription* details = | 191 if (DocumentMarkerDescription* details = |
180 toDocumentMarkerDescription(m_details.get())) | 192 toDocumentMarkerDescription(m_details.get())) |
181 return details->description(); | 193 return details->description(); |
182 return emptyString; | 194 return emptyString; |
183 } | 195 } |
(...skipping 24 matching lines...) Expand all Loading... |
208 toTextCompositionMarkerDetails(m_details.get())) | 220 toTextCompositionMarkerDetails(m_details.get())) |
209 return details->backgroundColor(); | 221 return details->backgroundColor(); |
210 return Color::transparent; | 222 return Color::transparent; |
211 } | 223 } |
212 | 224 |
213 DEFINE_TRACE(DocumentMarker) { | 225 DEFINE_TRACE(DocumentMarker) { |
214 visitor->trace(m_details); | 226 visitor->trace(m_details); |
215 } | 227 } |
216 | 228 |
217 } // namespace blink | 229 } // namespace blink |
OLD | NEW |