Index: third_party/WebKit/Source/web/TextFinder.cpp |
diff --git a/third_party/WebKit/Source/web/TextFinder.cpp b/third_party/WebKit/Source/web/TextFinder.cpp |
index 7fd1db6032c3ba42c1a40bff96e934d7b7e55391..90967855ad78663732b84ab5f81704b1ca86d0ea 100644 |
--- a/third_party/WebKit/Source/web/TextFinder.cpp |
+++ b/third_party/WebKit/Source/web/TextFinder.cpp |
@@ -165,10 +165,10 @@ bool TextFinder::find(int identifier, |
->document() |
->textAutosizer() |
->pageNeedsAutosizing()) { |
+ const EphemeralRange range(m_activeMatch.get()); |
ownerFrame().viewImpl()->zoomToFindInPageRect( |
- ownerFrame().frameView()->contentsToRootFrame( |
- enclosingIntRect(LayoutObject::absoluteBoundingBoxRectForRange( |
- m_activeMatch.get())))); |
+ ownerFrame().frameView()->contentsToRootFrame(enclosingIntRect( |
+ LayoutObject::absoluteBoundingBoxRectForRange(range)))); |
} |
bool wasActiveFrame = m_currentActiveMatchFrame; |
@@ -529,10 +529,12 @@ void TextFinder::updateFindMatchRects() { |
size_t deadMatches = 0; |
for (FindMatch& match : m_findMatchesCache) { |
if (!match.m_range->boundaryPointsValid() || |
- !match.m_range->startContainer()->isConnected()) |
+ !match.m_range->startContainer()->isConnected()) { |
match.m_rect = FloatRect(); |
- else if (!m_findMatchRectsAreValid) |
- match.m_rect = findInPageRectFromRange(match.m_range.get()); |
+ } else if (!m_findMatchRectsAreValid) { |
+ const EphemeralRange range(match.m_range.get()); |
+ match.m_rect = findInPageRectFromRange(range); |
+ } |
if (match.m_rect.isEmpty()) |
++deadMatches; |
@@ -566,7 +568,8 @@ WebFloatRect TextFinder::activeFindMatchRect() { |
if (!m_currentActiveMatchFrame || !m_activeMatch) |
return WebFloatRect(); |
- return WebFloatRect(findInPageRectFromRange(activeMatch())); |
+ const EphemeralRange range(activeMatch()); |
+ return WebFloatRect(findInPageRectFromRange(range)); |
} |
void TextFinder::findMatchRects(WebVector<WebFloatRect>& outputRects) { |
@@ -645,8 +648,9 @@ int TextFinder::selectFindMatch(unsigned index, WebRect* selectionRect) { |
} |
IntRect activeMatchRect; |
- IntRect activeMatchBoundingBox = enclosingIntRect( |
- LayoutObject::absoluteBoundingBoxRectForRange(m_activeMatch.get())); |
+ IntRect activeMatchBoundingBox = |
+ enclosingIntRect(LayoutObject::absoluteBoundingBoxRectForRange( |
+ EphemeralRange(m_activeMatch.get()))); |
if (!activeMatchBoundingBox.isEmpty()) { |
if (m_activeMatch->firstNode() && |