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 "wtf/StdLibExtras.h" | |
34 | |
35 namespace blink { | 33 namespace blink { |
36 | 34 |
37 DocumentMarkerDetails::~DocumentMarkerDetails() | 35 DocumentMarkerDetails::~DocumentMarkerDetails() |
38 { | 36 { |
39 } | 37 } |
40 | 38 |
41 class DocumentMarkerDescription final : public DocumentMarkerDetails { | 39 class DocumentMarkerDescription final : public DocumentMarkerDetails { |
42 public: | 40 public: |
43 static RawPtr<DocumentMarkerDescription> create(const String&); | 41 static RawPtr<DocumentMarkerDescription> create(const String&); |
44 | 42 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 explicit DocumentMarkerTextMatch(bool match) | 76 explicit DocumentMarkerTextMatch(bool match) |
79 : m_match(match) | 77 : m_match(match) |
80 { | 78 { |
81 } | 79 } |
82 | 80 |
83 bool m_match; | 81 bool m_match; |
84 }; | 82 }; |
85 | 83 |
86 RawPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::create(bool match) | 84 RawPtr<DocumentMarkerTextMatch> DocumentMarkerTextMatch::create(bool match) |
87 { | 85 { |
88 DEFINE_STATIC_LOCAL(DocumentMarkerTextMatch, trueInstance, (new DocumentMark
erTextMatch(true))); | 86 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(DocumentMarkerTextMatch, trueInstance,
(new DocumentMarkerTextMatch(true))); |
89 DEFINE_STATIC_LOCAL(DocumentMarkerTextMatch, falseInstance, (new DocumentMar
kerTextMatch(false))); | 87 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(DocumentMarkerTextMatch, falseInstance,
(new DocumentMarkerTextMatch(false))); |
90 return match ? &trueInstance : &falseInstance; | 88 return match ? trueInstance : falseInstance; |
91 } | 89 } |
92 | 90 |
93 inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch(DocumentMarkerDetails*
details) | 91 inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch(DocumentMarkerDetails*
details) |
94 { | 92 { |
95 if (details && details->isTextMatch()) | 93 if (details && details->isTextMatch()) |
96 return static_cast<DocumentMarkerTextMatch*>(details); | 94 return static_cast<DocumentMarkerTextMatch*>(details); |
97 return 0; | 95 return 0; |
98 } | 96 } |
99 | 97 |
100 class TextCompositionMarkerDetails final : public DocumentMarkerDetails { | 98 class TextCompositionMarkerDetails final : public DocumentMarkerDetails { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 return details->backgroundColor(); | 211 return details->backgroundColor(); |
214 return Color::transparent; | 212 return Color::transparent; |
215 } | 213 } |
216 | 214 |
217 DEFINE_TRACE(DocumentMarker) | 215 DEFINE_TRACE(DocumentMarker) |
218 { | 216 { |
219 visitor->trace(m_details); | 217 visitor->trace(m_details); |
220 } | 218 } |
221 | 219 |
222 } // namespace blink | 220 } // namespace blink |
OLD | NEW |