Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 14 matching lines...) Expand all Loading... | |
| 25 * Boston, MA 02110-1301, USA. | 25 * Boston, MA 02110-1301, USA. |
| 26 * | 26 * |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "core/editing/markers/DocumentMarkerController.h" | 29 #include "core/editing/markers/DocumentMarkerController.h" |
| 30 | 30 |
| 31 #include "core/dom/Node.h" | 31 #include "core/dom/Node.h" |
| 32 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
| 33 #include "core/dom/Range.h" | 33 #include "core/dom/Range.h" |
| 34 #include "core/dom/Text.h" | 34 #include "core/dom/Text.h" |
| 35 #include "core/editing/VisibleUnits.h" | |
| 35 #include "core/editing/iterators/TextIterator.h" | 36 #include "core/editing/iterators/TextIterator.h" |
| 36 #include "core/editing/markers/RenderedDocumentMarker.h" | 37 #include "core/editing/markers/RenderedDocumentMarker.h" |
| 37 #include "core/frame/FrameView.h" | 38 #include "core/frame/FrameView.h" |
| 38 #include "core/layout/LayoutObject.h" | 39 #include "core/layout/LayoutObject.h" |
| 39 #include <algorithm> | 40 #include <algorithm> |
| 40 | 41 |
| 41 #ifndef NDEBUG | 42 #ifndef NDEBUG |
| 42 #include <stdio.h> | 43 #include <stdio.h> |
| 43 #endif | 44 #endif |
| 44 | 45 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 RenderedDocumentMarker& marker) { | 207 RenderedDocumentMarker& marker) { |
| 207 Range* range = Range::create(node.document()); | 208 Range* range = Range::create(node.document()); |
| 208 // The offsets of the marker may be out-dated, so check for exceptions. | 209 // The offsets of the marker may be out-dated, so check for exceptions. |
| 209 DummyExceptionStateForTesting exceptionState; | 210 DummyExceptionStateForTesting exceptionState; |
| 210 range->setStart(&const_cast<Node&>(node), marker.startOffset(), | 211 range->setStart(&const_cast<Node&>(node), marker.startOffset(), |
| 211 exceptionState); | 212 exceptionState); |
| 212 if (!exceptionState.hadException()) { | 213 if (!exceptionState.hadException()) { |
| 213 range->setEnd(&const_cast<Node&>(node), marker.endOffset(), | 214 range->setEnd(&const_cast<Node&>(node), marker.endOffset(), |
| 214 IGNORE_EXCEPTION_FOR_TESTING); | 215 IGNORE_EXCEPTION_FOR_TESTING); |
| 215 } | 216 } |
| 216 if (!exceptionState.hadException()) { | 217 if (!exceptionState.hadException() && range->isConnected()) { |
| 217 // TODO(yosin): Once we have a |EphemeralRange| version of |boundingBox()|, | 218 marker.setRenderedRect(LayoutRect(boundingBox(EphemeralRange(range)))); |
|
yosin_UTC9
2017/03/30 01:23:17
Note: Intention of this TODO is using |EphemeralRa
| |
| 218 // we should use it instead of |Range| version. | |
| 219 marker.setRenderedRect(LayoutRect(range->boundingBox())); | |
| 220 } else { | 219 } else { |
| 221 marker.nullifyRenderedRect(); | 220 marker.nullifyRenderedRect(); |
| 222 } | 221 } |
| 223 range->dispose(); | 222 range->dispose(); |
| 224 } | 223 } |
| 225 | 224 |
| 226 // Markers are stored in order sorted by their start offset. | 225 // Markers are stored in order sorted by their start offset. |
| 227 // Markers of the same type do not overlap each other. | 226 // Markers of the same type do not overlap each other. |
| 228 | 227 |
| 229 void DocumentMarkerController::addMarker(Node* node, | 228 void DocumentMarkerController::addMarker(Node* node, |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 883 } | 882 } |
| 884 | 883 |
| 885 } // namespace blink | 884 } // namespace blink |
| 886 | 885 |
| 887 #ifndef NDEBUG | 886 #ifndef NDEBUG |
| 888 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 887 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
| 889 if (controller) | 888 if (controller) |
| 890 controller->showMarkers(); | 889 controller->showMarkers(); |
| 891 } | 890 } |
| 892 #endif | 891 #endif |
| OLD | NEW |