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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp

Issue 2885103004: Rewrite UpdateMarkerRenderedRect() to use EphemeralRange. (Closed)
Patch Set: fix the some nit. Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index ef5e4029fb55fedbc9ddf78377d328900de5380a..5e71a42497cf11a979fea3b59ff801262adae7b8 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -33,6 +33,7 @@
#include "core/dom/NodeTraversal.h"
#include "core/dom/Range.h"
#include "core/dom/Text.h"
+#include "core/editing/VisibleUnits.h"
#include "core/editing/iterators/TextIterator.h"
#include "core/editing/markers/CompositionMarkerListImpl.h"
#include "core/editing/markers/DocumentMarkerListEditor.h"
@@ -201,23 +202,10 @@ void DocumentMarkerController::RemoveMarkersInRange(
static void UpdateMarkerRenderedRect(const Node& node,
RenderedDocumentMarker& marker) {
- Range* range = Range::Create(node.GetDocument());
- // The offsets of the marker may be out-dated, so check for exceptions.
- DummyExceptionStateForTesting exception_state;
- range->setStart(&const_cast<Node&>(node), marker.StartOffset(),
- exception_state);
- if (!exception_state.HadException()) {
- range->setEnd(&const_cast<Node&>(node), marker.EndOffset(),
- IGNORE_EXCEPTION_FOR_TESTING);
- }
- if (!exception_state.HadException()) {
- // TODO(yosin): Once we have a |EphemeralRange| version of |boundingBox()|,
- // we should use it instead of |Range| version.
- marker.SetRenderedRect(LayoutRect(range->BoundingBox()));
- } else {
- marker.NullifyRenderedRect();
- }
- range->Dispose();
+ const Position startPosition(&const_cast<Node&>(node), marker.StartOffset());
+ const Position endPostion(&const_cast<Node&>(node), marker.EndOffset());
+ EphemeralRange range(startPosition, endPostion);
+ marker.SetRenderedRect(LayoutRect(ComputeTextRect(range)));
}
// Markers are stored in order sorted by their start offset.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698