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

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

Issue 2034753003: Make updateMarkerRenderedRect() to dispose temporary Range object after use (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-03T11:12:32 Created 4 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 5fd8443f6a09a9a51f56f6dd91819beeb79790f7..5a5d4e196e2c70498235aa3a71941d13f7209e37 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -195,9 +195,15 @@ static bool updateMarkerRenderedRect(Node* node, RenderedDocumentMarker& marker)
range->setStart(node, marker.startOffset(), exceptionState);
if (!exceptionState.hadException())
range->setEnd(node, marker.endOffset(), IGNORE_EXCEPTION);
- if (exceptionState.hadException())
+ if (exceptionState.hadException()) {
+ range->dispose();
return marker.invalidateRenderedRect();
- return marker.setRenderedRect(LayoutRect(range->boundingBox()));
+ }
+ // TODO(yosin): Once we have a |EphemeralRange| version of |boundingBox()|,
+ // we should use it instead of |Range| version.
+ const bool isUpdated = marker.setRenderedRect(LayoutRect(range->boundingBox()));
+ range->dispose();
+ return isUpdated;
}
// 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