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