Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: third_party/WebKit/Source/web/TextFinder.h

Issue 1959183002: Multi-Process Find-in-Page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disabled tests on Android Release because of crbug.com/615291. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.cpp ('k') | third_party/WebKit/Source/web/TextFinder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/TextFinder.h
diff --git a/third_party/WebKit/Source/web/TextFinder.h b/third_party/WebKit/Source/web/TextFinder.h
index 2ce33e59642ac69c46f16a4305452f469e018407..267f2335fc0f2d0cf9ba9f265b99de3f3e66ae44 100644
--- a/third_party/WebKit/Source/web/TextFinder.h
+++ b/third_party/WebKit/Source/web/TextFinder.h
@@ -60,6 +60,7 @@ public:
bool find(
int identifier, const WebString& searchText, const WebFindOptions&,
bool wrapWithinFrame, WebRect* selectionRect, bool* activeNow = nullptr);
+ void clearActiveFindMatch();
void stopFindingAndClearSelection();
void scopeStringMatches(
int identifier, const WebString& searchText, const WebFindOptions&,
@@ -72,10 +73,13 @@ public:
void findMatchRects(WebVector<WebFloatRect>&);
int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect);
- // Returns which frame has an active match. This function should only be
- // called on the main frame, as it is the only frame keeping track. Returned
- // value can be 0 if no frame has an active match.
- WebLocalFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; }
+ // Return the index in the find-in-page cache of the match closest to the
+ // provided point in find-in-page coordinates, or -1 in case of error.
+ // The squared distance to the closest match is returned in the |distanceSquared| parameter.
+ int nearestFindMatch(const FloatPoint&, float* distanceSquared);
+
+ // Returns whether this frame has the active match.
+ bool activeMatchFrame() const { return m_currentActiveMatchFrame; }
// Returns the active match in the current frame. Could be a null range if
// the local frame has no active match.
@@ -126,14 +130,6 @@ private:
// calculated again next time updateFindMatchRects is called.
void clearFindMatchesCache();
- // Check if the activeMatchFrame still exists in the frame tree.
- bool isActiveMatchFrameValid() const;
-
- // Return the index in the find-in-page cache of the match closest to the
- // provided point in find-in-page coordinates, or -1 in case of error.
- // The squared distance to the closest match is returned in the distanceSquared parameter.
- int nearestFindMatch(const FloatPoint&, float& distanceSquared);
-
// Select a find-in-page match marker in the current frame using a cache
// match index returned by nearestFindMatch. Returns the ordinal of the new
// selected match or -1 in case of error. Also provides the bounding box of
@@ -145,9 +141,6 @@ private:
// propagating the invalidation to child frames.
void updateFindMatchRects();
- // Append the find-in-page match rects of the current frame to the provided vector.
- void appendFindMatchRects(Vector<WebFloatRect>& frameRects);
-
// Add a WebKit TextMatch-highlight marker to nodes in a range.
void addMarker(Range*, bool activeMatch);
@@ -158,12 +151,6 @@ private:
// Removes all markers.
void unmarkAllTextMatches();
- // Returns the ordinal of the first match in the frame specified. This
- // function enumerates the frames, starting with the main frame and up to (but
- // not including) the frame passed in as a parameter and counts how many
- // matches have been found.
- int ordinalOfFirstMatchForFrame(WebLocalFrameImpl*) const;
-
// Determines whether the scoping effort is required for a particular frame.
// It is not necessary if the frame is invisible, for example, or if this
// is a repeat search that already returned nothing last time the same prefix
@@ -191,31 +178,22 @@ private:
// Determines whether to invalidate the content area and scrollbar.
void invalidateIfNecessary();
- // Sets the markers within a current match range as active or inactive.
- void setMatchMarkerActive(bool);
-
- void decrementFramesScopingCount(int identifier);
-
WebLocalFrameImpl& ownerFrame() const
{
DCHECK(m_ownerFrame);
return *m_ownerFrame;
}
- // Returns the ordinal of the first match in the owner frame.
- int ordinalOfFirstMatch() const;
-
Member<WebLocalFrameImpl> m_ownerFrame;
- // A way for the main frame to keep track of which frame has an active
- // match. Should be 0 for all other frames.
- Member<WebLocalFrameImpl> m_currentActiveMatchFrame;
+ // Indicates whether this frame currently has the active match.
+ bool m_currentActiveMatchFrame;
// The range of the active match for the current frame.
Member<Range> m_activeMatch;
// The index of the active match for the current frame.
- int m_activeMatchIndexInCurrentFrame;
+ int m_activeMatchIndex;
// The scoping effort can time out and we need to keep track of where we
// ended our last search so we can continue from where we left of.
@@ -235,15 +213,12 @@ private:
// with m_lastSearchString) to figure out if we need to search the frame again.
int m_lastMatchCount;
- // This variable keeps a cumulative total of matches found so far for ALL the
- // frames on the page, and is only incremented by calling IncreaseMatchCount
- // (on the main frame only). It should be -1 for all other frames.
+ // This variable keeps a cumulative total of matches found so far in this
+ // frame, and is only incremented by calling IncreaseMatchCount.
int m_totalMatchCount;
- // This variable keeps a cumulative total of how many frames are currently
- // scoping, and is incremented/decremented on the main frame only.
- // It should be -1 for all other frames.
- int m_framesScopingCount;
+ // Keeps track of whether the frame is currently scoping (being searched for matches).
+ bool m_frameScoping;
// Identifier of the latest find-in-page request. Required to be stored in
// the frame in order to reply if required in case the frame is detached.
@@ -256,8 +231,8 @@ private:
// A list of all of the pending calls to scopeStringMatches.
HeapVector<Member<DeferredScopeStringMatches>> m_deferredScopingWork;
- // Version number incremented on the main frame only whenever the document
- // find-in-page match markers change. It should be 0 for all other frames.
+ // Version number incremented whenever this frame's find-in-page match
+ // markers change.
int m_findMatchMarkersVersion;
// Local cache of the find match markers currently displayed for this frame.
« no previous file with comments | « third_party/WebKit/Source/core/page/Page.cpp ('k') | third_party/WebKit/Source/web/TextFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698