Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/TextMatchMarker.h

Issue 2911733002: [DMC #25] Make DocumentMarker::GetType() virtual (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 28 matching lines...) Expand all
39 class TextMatchMarker final : public DocumentMarker { 39 class TextMatchMarker final : public DocumentMarker {
40 private: 40 private:
41 enum class State { kInvalid, kValidNull, kValidNotNull }; 41 enum class State { kInvalid, kValidNull, kValidNotNull };
42 42
43 public: 43 public:
44 enum class MatchStatus { kInactive, kActive }; 44 enum class MatchStatus { kInactive, kActive };
45 45
46 TextMatchMarker(unsigned start_offset, 46 TextMatchMarker(unsigned start_offset,
47 unsigned end_offset, 47 unsigned end_offset,
48 MatchStatus status) 48 MatchStatus status)
49 : DocumentMarker(DocumentMarker::kTextMatch, start_offset, end_offset), 49 : DocumentMarker(start_offset, end_offset),
50 match_status_(status), 50 match_status_(status),
51 layout_state_(State::kInvalid) {} 51 layout_state_(State::kInvalid) {}
52 52
53 // DocumentMarker implementations
54 MarkerType GetType() const { return DocumentMarker::kTextMatch; }
yosin_UTC9 2017/05/29 05:17:09 We have an implementation of interface in ".cpp" f
55
56 // TextMatchMarker-specific
53 bool IsActiveMatch() const { return match_status_ == MatchStatus::kActive; } 57 bool IsActiveMatch() const { return match_status_ == MatchStatus::kActive; }
54 void SetIsActiveMatch(bool active) { 58 void SetIsActiveMatch(bool active) {
55 match_status_ = active ? MatchStatus::kActive : MatchStatus::kInactive; 59 match_status_ = active ? MatchStatus::kActive : MatchStatus::kInactive;
56 } 60 }
57 61
58 bool IsRendered() const { return layout_state_ == State::kValidNotNull; } 62 bool IsRendered() const { return layout_state_ == State::kValidNotNull; }
59 bool Contains(const LayoutPoint& point) const { 63 bool Contains(const LayoutPoint& point) const {
60 DCHECK_EQ(layout_state_, State::kValidNotNull); 64 DCHECK_EQ(layout_state_, State::kValidNotNull);
61 return rendered_rect_.Contains(point); 65 return rendered_rect_.Contains(point);
62 } 66 }
(...skipping 27 matching lines...) Expand all
90 94
91 DEFINE_TYPE_CASTS(TextMatchMarker, 95 DEFINE_TYPE_CASTS(TextMatchMarker,
92 DocumentMarker, 96 DocumentMarker,
93 marker, 97 marker,
94 marker->GetType() == DocumentMarker::kTextMatch, 98 marker->GetType() == DocumentMarker::kTextMatch,
95 marker.GetType() == DocumentMarker::kTextMatch); 99 marker.GetType() == DocumentMarker::kTextMatch);
96 100
97 } // namespace blink 101 } // namespace blink
98 102
99 #endif 103 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698