Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp |
| index b18b3fd88304206850783d3ee5de7a20483edd5f..d7cb00f62aef9565129a5be4944296a6b59c74f0 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp |
| +++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarker.cpp |
| @@ -64,23 +64,28 @@ inline DocumentMarkerDescription* toDocumentMarkerDescription( |
| class DocumentMarkerTextMatch final : public DocumentMarkerDetails { |
| public: |
| - static DocumentMarkerTextMatch* create(bool); |
| + static DocumentMarkerTextMatch* create(DocumentMarker::MatchStatus); |
| - bool activeMatch() const { return m_match; } |
|
yosin_UTC9
2017/04/05 01:33:37
I think we can leave |bool activeMatch()| as is.
W
|
| + DocumentMarker::MatchStatus activeMatch() const { return m_matchStatus; } |
| bool isTextMatch() const override { return true; } |
| private: |
| - explicit DocumentMarkerTextMatch(bool match) : m_match(match) {} |
| + explicit DocumentMarkerTextMatch(DocumentMarker::MatchStatus matchStatus) |
| + : m_matchStatus(matchStatus) {} |
| - bool m_match; |
| + DocumentMarker::MatchStatus m_matchStatus; |
| }; |
| -DocumentMarkerTextMatch* DocumentMarkerTextMatch::create(bool match) { |
| - DEFINE_STATIC_LOCAL(DocumentMarkerTextMatch, trueInstance, |
| - (new DocumentMarkerTextMatch(true))); |
| - DEFINE_STATIC_LOCAL(DocumentMarkerTextMatch, falseInstance, |
| - (new DocumentMarkerTextMatch(false))); |
| - return match ? &trueInstance : &falseInstance; |
| +DocumentMarkerTextMatch* DocumentMarkerTextMatch::create( |
| + DocumentMarker::MatchStatus matchStatus) { |
| + DEFINE_STATIC_LOCAL( |
| + DocumentMarkerTextMatch, trueInstance, |
|
yosin_UTC9
2017/04/05 01:33:36
nit: s/trueInstance/activeInstance/
|
| + (new DocumentMarkerTextMatch(DocumentMarker::MatchStatus::Active))); |
| + DEFINE_STATIC_LOCAL( |
| + DocumentMarkerTextMatch, falseInstance, |
|
yosin_UTC9
2017/04/05 01:33:37
nit: s/falseInstance/InactiveInstance/
|
| + (new DocumentMarkerTextMatch(DocumentMarker::MatchStatus::Inactive))); |
| + return matchStatus == DocumentMarker::MatchStatus::Active ? &trueInstance |
| + : &falseInstance; |
| } |
| inline DocumentMarkerTextMatch* toDocumentMarkerTextMatch( |
| @@ -142,7 +147,7 @@ DocumentMarker::DocumentMarker(MarkerType type, |
| DocumentMarker::DocumentMarker(unsigned startOffset, |
| unsigned endOffset, |
| - bool activeMatch) |
| + MatchStatus activeMatch) |
| : m_type(DocumentMarker::TextMatch), |
| m_startOffset(startOffset), |
| m_endOffset(endOffset), |
| @@ -171,8 +176,8 @@ void DocumentMarker::shiftOffsets(int delta) { |
| m_endOffset += delta; |
| } |
| -void DocumentMarker::setActiveMatch(bool active) { |
| - m_details = DocumentMarkerTextMatch::create(active); |
| +void DocumentMarker::setActiveMatch(DocumentMarker::MatchStatus matchStatus) { |
| + m_details = DocumentMarkerTextMatch::create(matchStatus); |
| } |
| const String& DocumentMarker::description() const { |
| @@ -182,11 +187,11 @@ const String& DocumentMarker::description() const { |
| return emptyString; |
| } |
| -bool DocumentMarker::activeMatch() const { |
| +DocumentMarker::MatchStatus DocumentMarker::activeMatch() const { |
| if (DocumentMarkerTextMatch* details = |
| toDocumentMarkerTextMatch(m_details.get())) |
| return details->activeMatch(); |
| - return false; |
| + return DocumentMarker::MatchStatus::Inactive; |
| } |
| Color DocumentMarker::underlineColor() const { |