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 08f7445144404f3d27d76fed3fad099c62d4ac05..887f4f68bbb9a5cd3cfc0eb0a93fa0b2474b2be4 100644 |
| --- a/third_party/WebKit/Source/web/TextFinder.cpp |
| +++ b/third_party/WebKit/Source/web/TextFinder.cpp |
| @@ -112,7 +112,7 @@ private: |
| const bool m_reset; |
| }; |
| -bool TextFinder::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect) |
| +bool TextFinder::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect, bool* activeNow) |
| { |
| if (!ownerFrame().frame() || !ownerFrame().frame()->page()) |
| return false; |
| @@ -163,17 +163,22 @@ bool TextFinder::find(int identifier, const WebString& searchText, const WebFind |
| ownerFrame().viewImpl()->zoomToFindInPageRect(ownerFrame().frameView()->contentsToRootFrame(enclosingIntRect(LayoutObject::absoluteBoundingBoxRectForRange(m_activeMatch.get())))); |
| } |
| - setMarkerActive(m_activeMatch.get(), true); |
| + if (activeNow) |
| + *activeNow = setMarkerActive(m_activeMatch.get(), true); |
| + else |
| + setMarkerActive(m_activeMatch.get(), true); |
|
Finnur
2016/01/29 17:47:50
Not as verbose and probably a bit clearer:
bool i
dvadym
2016/02/01 12:41:10
Thanks, it makes code clearer.
|
| + |
| WebLocalFrameImpl* oldActiveFrame = mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame; |
| mainFrameImpl->ensureTextFinder().m_currentActiveMatchFrame = &ownerFrame(); |
| // Make sure no node is focused. See http://crbug.com/38700. |
| ownerFrame().frame()->document()->clearFocusedElement(); |
| - if (!options.findNext || activeSelection) { |
| - // This is either a Find operation or a Find-next from a new start point |
| - // due to a selection, so we set the flag to ask the scoping effort |
| - // to find the active rect for us and report it back to the UI. |
| + if (!options.findNext || activeSelection || (activeNow && !*activeNow)) { |
|
Finnur
2016/01/29 17:47:49
Replace
(activeNow && !*activeNow)
with
!isAct
dvadym
2016/02/01 12:41:10
Done.
|
| + // This is either a Find operation, a Find-next from a new start point |
| + // due to a selection, or Find-next which found newly added text, so we |
|
Finnur
2016/01/29 17:47:50
Suggest: "or new matches were found during Find-ne
dvadym
2016/02/01 12:41:10
Done.
|
| + // set the flag to ask the scoping effort to find the active rect for |
| + // us and report it back to the UI. |
| m_locatingActiveRect = true; |
| } else { |
| if (oldActiveFrame != &ownerFrame()) { |
| @@ -687,11 +692,11 @@ void TextFinder::addMarker(Range* range, bool activeMatch) |
| ownerFrame().frame()->document()->markers().addTextMatchMarker(range, activeMatch); |
| } |
| -void TextFinder::setMarkerActive(Range* range, bool active) |
| +bool TextFinder::setMarkerActive(Range* range, bool active) |
| { |
| if (!range || range->collapsed()) |
| - return; |
| - ownerFrame().frame()->document()->markers().setMarkersActive(range, active); |
| + return false; |
| + return ownerFrame().frame()->document()->markers().setMarkersActive(range, active); |
| } |
| void TextFinder::unmarkAllTextMatches() |