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

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

Issue 2915193002: [DMC #28] Rename TextMatchMarker::State to LayoutStatus (Closed)
Patch Set: Rebase Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/TextMatchMarker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
11 MatchStatus status) 11 MatchStatus status)
12 : DocumentMarker(start_offset, end_offset), match_status_(status) {} 12 : DocumentMarker(start_offset, end_offset), match_status_(status) {}
13 13
14 DocumentMarker::MarkerType TextMatchMarker::GetType() const { 14 DocumentMarker::MarkerType TextMatchMarker::GetType() const {
15 return DocumentMarker::kTextMatch; 15 return DocumentMarker::kTextMatch;
16 } 16 }
17 17
18 bool TextMatchMarker::IsActiveMatch() const { 18 bool TextMatchMarker::IsActiveMatch() const {
19 return match_status_ == MatchStatus::kActive; 19 return match_status_ == MatchStatus::kActive;
20 } 20 }
21 21
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_state_ == State::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_state_, State::kValidNotNull); 31 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull);
32 return rendered_rect_.Contains(point); 32 return rendered_rect_.Contains(point);
33 } 33 }
34 34
35 void TextMatchMarker::SetRenderedRect(const LayoutRect& rect) { 35 void TextMatchMarker::SetRenderedRect(const LayoutRect& rect) {
36 if (layout_state_ == State::kValidNotNull && rect == rendered_rect_) 36 if (layout_status_ == LayoutStatus::kValidNotNull && rect == rendered_rect_)
37 return; 37 return;
38 layout_state_ = State::kValidNotNull; 38 layout_status_ = LayoutStatus::kValidNotNull;
39 rendered_rect_ = rect; 39 rendered_rect_ = rect;
40 } 40 }
41 41
42 const LayoutRect& TextMatchMarker::RenderedRect() const { 42 const LayoutRect& TextMatchMarker::RenderedRect() const {
43 DCHECK_EQ(layout_state_, State::kValidNotNull); 43 DCHECK_EQ(layout_status_, LayoutStatus::kValidNotNull);
44 return rendered_rect_; 44 return rendered_rect_;
45 } 45 }
46 46
47 void TextMatchMarker::NullifyRenderedRect() { 47 void TextMatchMarker::NullifyRenderedRect() {
48 layout_state_ = State::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_state_ = State::kInvalid; 54 layout_status_ = LayoutStatus::kInvalid;
55 } 55 }
56 56
57 bool TextMatchMarker::IsValid() const { 57 bool TextMatchMarker::IsValid() const {
58 return layout_state_ != State::kInvalid; 58 return layout_status_ != LayoutStatus::kInvalid;
59 } 59 }
60 60
61 } // namespace blink 61 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/TextMatchMarker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698