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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "platform/geometry/LayoutRect.h" | 31 #include "platform/geometry/LayoutRect.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 // A subclass of DocumentMarker used to store information specific to TextMatch | 35 // A subclass of DocumentMarker used to store information specific to TextMatch |
36 // markers. We store whether or not the match is active, a LayoutRect used for | 36 // markers. We store whether or not the match is active, a LayoutRect used for |
37 // rendering the marker, and whether or not the LayoutRect is currently | 37 // rendering the marker, and whether or not the LayoutRect is currently |
38 // up-to-date. | 38 // up-to-date. |
39 class CORE_EXPORT TextMatchMarker final : public DocumentMarker { | 39 class CORE_EXPORT TextMatchMarker final : public DocumentMarker { |
40 private: | 40 private: |
41 enum class State { kInvalid, kValidNull, kValidNotNull }; | 41 enum class LayoutStatus { 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, unsigned end_offset, MatchStatus); | 46 TextMatchMarker(unsigned start_offset, unsigned end_offset, MatchStatus); |
47 | 47 |
48 // DocumentMarker implementations | 48 // DocumentMarker implementations |
49 MarkerType GetType() const final; | 49 MarkerType GetType() const final; |
50 | 50 |
51 // TextMatchMarker-specific | 51 // TextMatchMarker-specific |
52 bool IsActiveMatch() const; | 52 bool IsActiveMatch() const; |
53 void SetIsActiveMatch(bool active); | 53 void SetIsActiveMatch(bool active); |
54 | 54 |
55 bool IsRendered() const; | 55 bool IsRendered() const; |
56 bool Contains(const LayoutPoint&) const; | 56 bool Contains(const LayoutPoint&) const; |
57 void SetRenderedRect(const LayoutRect&); | 57 void SetRenderedRect(const LayoutRect&); |
58 const LayoutRect& RenderedRect() const; | 58 const LayoutRect& RenderedRect() const; |
59 void NullifyRenderedRect(); | 59 void NullifyRenderedRect(); |
60 void Invalidate(); | 60 void Invalidate(); |
61 bool IsValid() const; | 61 bool IsValid() const; |
62 | 62 |
63 private: | 63 private: |
64 MatchStatus match_status_; | 64 MatchStatus match_status_; |
| 65 LayoutStatus layout_status_ = LayoutStatus::kInvalid; |
65 LayoutRect rendered_rect_; | 66 LayoutRect rendered_rect_; |
66 State layout_state_ = State::kInvalid; | |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(TextMatchMarker); | 68 DISALLOW_COPY_AND_ASSIGN(TextMatchMarker); |
69 }; | 69 }; |
70 | 70 |
71 DEFINE_TYPE_CASTS(TextMatchMarker, | 71 DEFINE_TYPE_CASTS(TextMatchMarker, |
72 DocumentMarker, | 72 DocumentMarker, |
73 marker, | 73 marker, |
74 marker->GetType() == DocumentMarker::kTextMatch, | 74 marker->GetType() == DocumentMarker::kTextMatch, |
75 marker.GetType() == DocumentMarker::kTextMatch); | 75 marker.GetType() == DocumentMarker::kTextMatch); |
76 | 76 |
77 } // namespace blink | 77 } // namespace blink |
78 | 78 |
79 #endif | 79 #endif |
OLD | NEW |