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

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

Issue 2919603005: [DMC #27] Move TextMatchMarker method implementations to TextMatchMarker.cpp (Closed)
Patch Set: 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
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,
10 unsigned end_offset,
11 MatchStatus status)
12 : DocumentMarker(start_offset, end_offset), match_status_(status) {
13 layout_state_ = State::kInvalid;
Xiaocheng 2017/06/01 21:42:49 nit: This should be in the member initialization l
rlanday 2017/06/01 21:48:13 yosin previously requested initializing this outsi
Xiaocheng 2017/06/01 22:12:49 I think what he meant is to put the initialization
14 }
15
9 DocumentMarker::MarkerType TextMatchMarker::GetType() const { 16 DocumentMarker::MarkerType TextMatchMarker::GetType() const {
10 return DocumentMarker::kTextMatch; 17 return DocumentMarker::kTextMatch;
11 } 18 }
12 19
20 bool TextMatchMarker::IsActiveMatch() const {
21 return match_status_ == MatchStatus::kActive;
22 }
23
24 void TextMatchMarker::SetIsActiveMatch(bool active) {
25 match_status_ = active ? MatchStatus::kActive : MatchStatus::kInactive;
26 }
27
28 bool TextMatchMarker::IsRendered() const {
29 return layout_state_ == State::kValidNotNull;
30 }
31
32 bool TextMatchMarker::Contains(const LayoutPoint& point) const {
33 DCHECK_EQ(layout_state_, State::kValidNotNull);
34 return rendered_rect_.Contains(point);
35 }
36
37 void TextMatchMarker::SetRenderedRect(const LayoutRect& rect) {
38 if (layout_state_ == State::kValidNotNull && rect == rendered_rect_)
39 return;
40 layout_state_ = State::kValidNotNull;
41 rendered_rect_ = rect;
42 }
43
44 const LayoutRect& TextMatchMarker::RenderedRect() const {
45 DCHECK_EQ(layout_state_, State::kValidNotNull);
46 return rendered_rect_;
47 }
48
49 void TextMatchMarker::NullifyRenderedRect() {
50 layout_state_ = State::kValidNull;
51 // Now |m_renderedRect| can not be accessed until |setRenderedRect| is
52 // called.
53 }
54
55 void TextMatchMarker::Invalidate() {
56 layout_state_ = State::kInvalid;
57 }
58
59 bool TextMatchMarker::IsValid() const {
60 return layout_state_ != State::kInvalid;
61 }
62
13 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698