OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/editing/markers/TextMatchMarker.h" | 5 #include "core/editing/markers/TextMatchMarker.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 TextMatchMarker::TextMatchMarker(unsigned start_offset, | 9 TextMatchMarker::TextMatchMarker(unsigned start_offset, |
10 unsigned end_offset, | 10 unsigned end_offset, |
(...skipping 11 matching lines...) Expand all Loading... |
22 void TextMatchMarker::SetIsActiveMatch(bool active) { | 22 void TextMatchMarker::SetIsActiveMatch(bool active) { |
23 match_status_ = active ? MatchStatus::kActive : MatchStatus::kInactive; | 23 match_status_ = active ? MatchStatus::kActive : MatchStatus::kInactive; |
24 } | 24 } |
25 | 25 |
26 bool TextMatchMarker::IsRendered() const { | 26 bool TextMatchMarker::IsRendered() const { |
27 return layout_status_ == LayoutStatus::kValidNotNull; | 27 return layout_status_ == LayoutStatus::kValidNotNull; |
28 } | 28 } |
29 | 29 |
30 bool TextMatchMarker::Contains(const LayoutPoint& point) const { | 30 bool TextMatchMarker::Contains(const LayoutPoint& point) const { |
31 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull); | 31 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull); |
32 return rendered_rect_.Contains(point); | 32 return layout_rect_.Contains(point); |
33 } | 33 } |
34 | 34 |
35 void TextMatchMarker::SetRenderedRect(const LayoutRect& rect) { | 35 void TextMatchMarker::SetLayoutRect(const LayoutRect& rect) { |
36 if (layout_status_ == LayoutStatus::kValidNotNull && rect == rendered_rect_) | 36 if (layout_status_ == LayoutStatus::kValidNotNull && rect == layout_rect_) |
37 return; | 37 return; |
38 layout_status_ = LayoutStatus::kValidNotNull; | 38 layout_status_ = LayoutStatus::kValidNotNull; |
39 rendered_rect_ = rect; | 39 layout_rect_ = rect; |
40 } | 40 } |
41 | 41 |
42 const LayoutRect& TextMatchMarker::RenderedRect() const { | 42 const LayoutRect& TextMatchMarker::GetLayoutRect() const { |
43 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull); | 43 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull); |
44 return rendered_rect_; | 44 return layout_rect_; |
45 } | 45 } |
46 | 46 |
47 void TextMatchMarker::NullifyRenderedRect() { | 47 void TextMatchMarker::NullifyLayoutRect() { |
48 layout_status_ = LayoutStatus::kValidNull; | 48 layout_status_ = LayoutStatus::kValidNull; |
49 // Now |rendered_rect_| can not be accessed until |SetRenderedRect| is | 49 // Now |rendered_rect_| can not be accessed until |SetRenderedRect| is |
50 // called. | 50 // called. |
51 } | 51 } |
52 | 52 |
53 void TextMatchMarker::Invalidate() { | 53 void TextMatchMarker::Invalidate() { |
54 layout_status_ = LayoutStatus::kInvalid; | 54 layout_status_ = LayoutStatus::kInvalid; |
55 } | 55 } |
56 | 56 |
57 bool TextMatchMarker::IsValid() const { | 57 bool TextMatchMarker::IsValid() const { |
58 return layout_status_ != LayoutStatus::kInvalid; | 58 return layout_status_ != LayoutStatus::kInvalid; |
59 } | 59 } |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
OLD | NEW |