Chromium Code Reviews| 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..a8ac70e190c387002f46844d9f55b63d3464e1f0 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) { |
| + EphemeralRange range(match.m_range.get()); |
|
Xiaocheng
2017/03/28 21:29:34
nit: |const EphemeralRange|
tanvir
2017/03/30 19:11:06
Done.
|
| + 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())); |
| + EphemeralRange range(activeMatch()); |
|
Xiaocheng
2017/03/28 21:29:34
nit: |const EphemeralRange|
tanvir
2017/03/30 19:11:06
Done.
|
| + 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() && |