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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/markers/RenderedTextMatchMarker.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/RenderedTextMatchMarker.cpp b/third_party/WebKit/Source/core/editing/markers/RenderedTextMatchMarker.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8cc9ec2feb7829628946dfd88057c2a0af422836
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/markers/RenderedTextMatchMarker.cpp
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/editing/markers/RenderedTextMatchMarker.h"
+
+#include "core/dom/Range.h"
+
+namespace blink {
+
+bool RenderedTextMatchMarker::isRenderedTextMatch() const {
+ return true;
+}
+
+void RenderedTextMatchMarker::updateRenderedRectIfNeeded(const Node& node) {
+ if (!isValid())
+ updateRenderedRect(node);
+}
+
+void RenderedTextMatchMarker::updateRenderedRect(const Node& node) {
+ Range* range = Range::create(node.document());
+ // The offsets of the marker may be out-dated, so check for exceptions.
+ DummyExceptionStateForTesting exceptionState;
+ range->setStart(&const_cast<Node&>(node), startOffset(), exceptionState);
+ if (!exceptionState.hadException()) {
+ range->setEnd(&const_cast<Node&>(node), endOffset(),
+ IGNORE_EXCEPTION_FOR_TESTING);
+ }
+ if (!exceptionState.hadException()) {
+ // TODO(yosin): Once we have a |EphemeralRange| version of
+ // |boundingBox()|, we should use it instead of |Range| version.
+ setRenderedRect(LayoutRect(range->boundingBox()));
+ } else {
+ nullifyRenderedRect();
+ }
+ range->dispose();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698