Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
| index cea15c01f1c4d6a4190d6fa45444eede2de07ada..7e56e9673c183c41d001ef9422f22a45e6fca417 100644 |
| --- a/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
| +++ b/third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.cpp |
| @@ -4,8 +4,12 @@ |
| #include "core/editing/markers/TextMatchMarkerListImpl.h" |
| +#include "core/dom/Node.h" |
| +#include "core/dom/Range.h" |
| +#include "core/editing/EphemeralRange.h" |
| #include "core/editing/markers/DocumentMarkerListEditor.h" |
| #include "core/editing/markers/RenderedDocumentMarker.h" |
| +#include "third_party/WebKit/Source/core/editing/VisibleUnits.h" |
| namespace blink { |
| @@ -53,4 +57,31 @@ DEFINE_TRACE(TextMatchMarkerListImpl) { |
| DocumentMarkerList::Trace(visitor); |
| } |
| +Vector<IntRect> TextMatchMarkerListImpl::RenderedRects(const Node& node) { |
| + Vector<IntRect> result; |
| + |
| + for (DocumentMarker* marker : markers_) { |
| + RenderedDocumentMarker* const rendered_marker = |
| + ToRenderedDocumentMarker(marker); |
| + UpdateMarkerRenderedRectIfNeeded(node, *rendered_marker); |
| + if (!rendered_marker->IsRendered()) |
| + continue; |
| + result.push_back(rendered_marker->RenderedRect()); |
| + } |
| + |
| + return result; |
| +} |
| + |
| +void TextMatchMarkerListImpl::UpdateMarkerRenderedRectIfNeeded( |
| + const Node& node, |
| + RenderedDocumentMarker& marker) { |
| + if (marker.IsValid()) |
| + return; |
| + |
| + const Position startPosition(&const_cast<Node&>(node), marker.StartOffset()); |
|
yosin_UTC9
2017/05/24 09:21:50
Is it useful to have DomcumentMaker::AsRange(const
rlanday
2017/05/24 20:25:06
Might be useful in a few places. I still wish Docu
|
| + const Position endPostion(&const_cast<Node&>(node), marker.EndOffset()); |
| + EphemeralRange range(startPosition, endPostion); |
| + marker.SetRenderedRect(LayoutRect(ComputeTextRect(range))); |
| +} |
| + |
| } // namespace blink |