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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 return match ? trueInstance : falseInstance; | 89 return match ? trueInstance : falseInstance; |
90 } | 90 } |
91 | 91 |
92 inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch(DocumentMarkerDetails*
details) | 92 inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch(DocumentMarkerDetails*
details) |
93 { | 93 { |
94 if (details && details->isTextMatch()) | 94 if (details && details->isTextMatch()) |
95 return static_cast<DocumentMarkerTextMatch*>(details); | 95 return static_cast<DocumentMarkerTextMatch*>(details); |
96 return 0; | 96 return 0; |
97 } | 97 } |
98 | 98 |
99 | |
100 DocumentMarker::DocumentMarker() | |
101 : m_type(Spelling) | |
102 , m_startOffset(0) | |
103 , m_endOffset(0) | |
104 , m_hash(0) | |
105 { | |
106 } | |
107 | |
108 DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
ndOffset, const String& description, uint32_t hash) | 99 DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
ndOffset, const String& description, uint32_t hash) |
109 : m_type(type) | 100 : m_type(type) |
110 , m_startOffset(startOffset) | 101 , m_startOffset(startOffset) |
111 , m_endOffset(endOffset) | 102 , m_endOffset(endOffset) |
112 , m_details(description.isEmpty() ? nullptr : DocumentMarkerDescription::cre
ate(description)) | 103 , m_details(description.isEmpty() ? nullptr : DocumentMarkerDescription::cre
ate(description)) |
113 , m_hash(hash) | 104 , m_hash(hash) |
114 { | 105 { |
115 } | 106 } |
116 | 107 |
117 DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool ac
tiveMatch) | 108 DocumentMarker::DocumentMarker(unsigned startOffset, unsigned endOffset, bool ac
tiveMatch) |
118 : m_type(DocumentMarker::TextMatch) | 109 : m_type(DocumentMarker::TextMatch) |
119 , m_startOffset(startOffset) | 110 , m_startOffset(startOffset) |
120 , m_endOffset(endOffset) | 111 , m_endOffset(endOffset) |
121 , m_details(DocumentMarkerTextMatch::instanceFor(activeMatch)) | 112 , m_details(DocumentMarkerTextMatch::instanceFor(activeMatch)) |
122 , m_hash(0) | 113 , m_hash(0) |
123 { | 114 { |
124 } | 115 } |
125 | 116 |
126 DocumentMarker::DocumentMarker(MarkerType type, unsigned startOffset, unsigned e
ndOffset, PassRefPtrWillBeRawPtr<DocumentMarkerDetails> details) | |
127 : m_type(type) | |
128 , m_startOffset(startOffset) | |
129 , m_endOffset(endOffset) | |
130 , m_details(details) | |
131 , m_hash(0) | |
132 { | |
133 } | |
134 | |
135 DocumentMarker::DocumentMarker(const DocumentMarker& marker) | 117 DocumentMarker::DocumentMarker(const DocumentMarker& marker) |
136 : m_type(marker.type()) | 118 : m_type(marker.type()) |
137 , m_startOffset(marker.startOffset()) | 119 , m_startOffset(marker.startOffset()) |
138 , m_endOffset(marker.endOffset()) | 120 , m_endOffset(marker.endOffset()) |
139 , m_details(marker.details()) | 121 , m_details(marker.details()) |
140 , m_hash(marker.hash()) | 122 , m_hash(marker.hash()) |
141 { | 123 { |
142 } | 124 } |
143 | 125 |
144 void DocumentMarker::shiftOffsets(int delta) | 126 void DocumentMarker::shiftOffsets(int delta) |
(...skipping 20 matching lines...) Expand all Loading... |
165 return details->activeMatch(); | 147 return details->activeMatch(); |
166 return false; | 148 return false; |
167 } | 149 } |
168 | 150 |
169 void DocumentMarker::trace(Visitor* visitor) | 151 void DocumentMarker::trace(Visitor* visitor) |
170 { | 152 { |
171 visitor->trace(m_details); | 153 visitor->trace(m_details); |
172 } | 154 } |
173 | 155 |
174 } // namespace blink | 156 } // namespace blink |
OLD | NEW |