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

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

Issue 2776103002: Make RenderedRectsForMarkers() to ignore disconnected nodes. (Closed)
Patch Set: upload test file Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 RenderedDocumentMarker& marker) { 206 RenderedDocumentMarker& marker) {
207 Range* range = Range::create(node.document()); 207 Range* range = Range::create(node.document());
208 // The offsets of the marker may be out-dated, so check for exceptions. 208 // The offsets of the marker may be out-dated, so check for exceptions.
209 DummyExceptionStateForTesting exceptionState; 209 DummyExceptionStateForTesting exceptionState;
210 range->setStart(&const_cast<Node&>(node), marker.startOffset(), 210 range->setStart(&const_cast<Node&>(node), marker.startOffset(),
211 exceptionState); 211 exceptionState);
212 if (!exceptionState.hadException()) { 212 if (!exceptionState.hadException()) {
213 range->setEnd(&const_cast<Node&>(node), marker.endOffset(), 213 range->setEnd(&const_cast<Node&>(node), marker.endOffset(),
214 IGNORE_EXCEPTION_FOR_TESTING); 214 IGNORE_EXCEPTION_FOR_TESTING);
215 } 215 }
216 if (!exceptionState.hadException()) { 216 if (!exceptionState.hadException() && range->isConnected()) {
217 // TODO(yosin): Once we have a |EphemeralRange| version of |boundingBox()|, 217 marker.setRenderedRect(LayoutRect(EphemeralRange(range).boundingBox()));
218 // we should use it instead of |Range| version.
219 marker.setRenderedRect(LayoutRect(range->boundingBox()));
220 } else { 218 } else {
221 marker.nullifyRenderedRect(); 219 marker.nullifyRenderedRect();
222 } 220 }
223 range->dispose(); 221 range->dispose();
224 } 222 }
225 223
226 // Markers are stored in order sorted by their start offset. 224 // Markers are stored in order sorted by their start offset.
227 // Markers of the same type do not overlap each other. 225 // Markers of the same type do not overlap each other.
228 226
229 void DocumentMarkerController::addMarker(Node* node, 227 void DocumentMarkerController::addMarker(Node* node,
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } 881 }
884 882
885 } // namespace blink 883 } // namespace blink
886 884
887 #ifndef NDEBUG 885 #ifndef NDEBUG
888 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { 886 void showDocumentMarkers(const blink::DocumentMarkerController* controller) {
889 if (controller) 887 if (controller)
890 controller->showMarkers(); 888 controller->showMarkers();
891 } 889 }
892 #endif 890 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698