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

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

Issue 2723663002: Refactor DocumentMarkerController (Closed)
Patch Set: Use correct base commit Created 3 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/editing/markers/RenderedTextMatchMarker.h"
6
7 #include "core/dom/Range.h"
8
9 namespace blink {
10
11 bool RenderedTextMatchMarker::isRenderedTextMatch() const {
12 return true;
13 }
14
15 void RenderedTextMatchMarker::updateRenderedRectIfNeeded(const Node& node) {
16 if (!isValid())
17 updateRenderedRect(node);
18 }
19
20 void RenderedTextMatchMarker::updateRenderedRect(const Node& node) {
21 Range* range = Range::create(node.document());
22 // The offsets of the marker may be out-dated, so check for exceptions.
23 DummyExceptionStateForTesting exceptionState;
24 range->setStart(&const_cast<Node&>(node), startOffset(), exceptionState);
25 if (!exceptionState.hadException()) {
26 range->setEnd(&const_cast<Node&>(node), endOffset(),
27 IGNORE_EXCEPTION_FOR_TESTING);
28 }
29 if (!exceptionState.hadException()) {
30 // TODO(yosin): Once we have a |EphemeralRange| version of
31 // |boundingBox()|, we should use it instead of |Range| version.
32 setRenderedRect(LayoutRect(range->boundingBox()));
33 } else {
34 nullifyRenderedRect();
35 }
36 range->dispose();
37 }
38
39 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698