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

Side by Side Diff: Source/web/TextFinder.h

Issue 241303002: Rename WebFrameImpl to WebLocalFrameImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Mac too Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/StorageQuotaClientImpl.cpp ('k') | Source/web/TextFinder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
42 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 #include "wtf/text/WTFString.h" 44 #include "wtf/text/WTFString.h"
45 45
46 namespace WebCore { 46 namespace WebCore {
47 class Range; 47 class Range;
48 } 48 }
49 49
50 namespace blink { 50 namespace blink {
51 class WebFrameImpl; 51 class WebLocalFrameImpl;
52 52
53 template <typename T> class WebVector; 53 template <typename T> class WebVector;
54 54
55 class TextFinder { 55 class TextFinder {
56 public: 56 public:
57 static PassOwnPtr<TextFinder> create(WebFrameImpl& ownerFrame); 57 static PassOwnPtr<TextFinder> create(WebLocalFrameImpl& ownerFrame);
58 58
59 bool find( 59 bool find(
60 int identifier, const WebString& searchText, const WebFindOptions&, 60 int identifier, const WebString& searchText, const WebFindOptions&,
61 bool wrapWithinFrame, WebRect* selectionRect); 61 bool wrapWithinFrame, WebRect* selectionRect);
62 void stopFindingAndClearSelection(); 62 void stopFindingAndClearSelection();
63 void scopeStringMatches( 63 void scopeStringMatches(
64 int identifier, const WebString& searchText, const WebFindOptions&, 64 int identifier, const WebString& searchText, const WebFindOptions&,
65 bool reset); 65 bool reset);
66 void cancelPendingScopingEffort(); 66 void cancelPendingScopingEffort();
67 void increaseMatchCount(int identifier, int count); 67 void increaseMatchCount(int identifier, int count);
68 void resetMatchCount(); 68 void resetMatchCount();
69 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; } 69 int findMatchMarkersVersion() const { return m_findMatchMarkersVersion; }
70 WebFloatRect activeFindMatchRect(); 70 WebFloatRect activeFindMatchRect();
71 void findMatchRects(WebVector<WebFloatRect>&); 71 void findMatchRects(WebVector<WebFloatRect>&);
72 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect); 72 int selectNearestFindMatch(const WebFloatPoint&, WebRect* selectionRect);
73 73
74 // Returns which frame has an active match. This function should only be 74 // Returns which frame has an active match. This function should only be
75 // called on the main frame, as it is the only frame keeping track. Returned 75 // called on the main frame, as it is the only frame keeping track. Returned
76 // value can be 0 if no frame has an active match. 76 // value can be 0 if no frame has an active match.
77 WebFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFrame; } 77 WebLocalFrameImpl* activeMatchFrame() const { return m_currentActiveMatchFra me; }
78 78
79 // Returns the active match in the current frame. Could be a null range if 79 // Returns the active match in the current frame. Could be a null range if
80 // the local frame has no active match. 80 // the local frame has no active match.
81 WebCore::Range* activeMatch() const { return m_activeMatch.get(); } 81 WebCore::Range* activeMatch() const { return m_activeMatch.get(); }
82 82
83 void flushCurrentScoping(); 83 void flushCurrentScoping();
84 84
85 void resetActiveMatch() { m_activeMatch = nullptr; } 85 void resetActiveMatch() { m_activeMatch = nullptr; }
86 86
87 int totalMatchCount() const { return m_totalMatchCount; } 87 int totalMatchCount() const { return m_totalMatchCount; }
(...skipping 16 matching lines...) Expand all
104 104
105 FindMatch(PassRefPtrWillBeRawPtr<WebCore::Range>, int ordinal); 105 FindMatch(PassRefPtrWillBeRawPtr<WebCore::Range>, int ordinal);
106 106
107 void trace(WebCore::Visitor*); 107 void trace(WebCore::Visitor*);
108 }; 108 };
109 109
110 private: 110 private:
111 class DeferredScopeStringMatches; 111 class DeferredScopeStringMatches;
112 friend class DeferredScopeStringMatches; 112 friend class DeferredScopeStringMatches;
113 113
114 explicit TextFinder(WebFrameImpl& ownerFrame); 114 explicit TextFinder(WebLocalFrameImpl& ownerFrame);
115 115
116 // Notifies the delegate about a new selection rect. 116 // Notifies the delegate about a new selection rect.
117 void reportFindInPageSelection( 117 void reportFindInPageSelection(
118 const WebRect& selectionRect, int activeMatchOrdinal, int identifier); 118 const WebRect& selectionRect, int activeMatchOrdinal, int identifier);
119 119
120 // Clear the find-in-page matches cache forcing rects to be fully 120 // Clear the find-in-page matches cache forcing rects to be fully
121 // calculated again next time updateFindMatchRects is called. 121 // calculated again next time updateFindMatchRects is called.
122 void clearFindMatchesCache(); 122 void clearFindMatchesCache();
123 123
124 // Check if the activeMatchFrame still exists in the frame tree. 124 // Check if the activeMatchFrame still exists in the frame tree.
(...skipping 21 matching lines...) Expand all
146 // Add a WebKit TextMatch-highlight marker to nodes in a range. 146 // Add a WebKit TextMatch-highlight marker to nodes in a range.
147 void addMarker(WebCore::Range*, bool activeMatch); 147 void addMarker(WebCore::Range*, bool activeMatch);
148 148
149 // Sets the markers within a range as active or inactive. 149 // Sets the markers within a range as active or inactive.
150 void setMarkerActive(WebCore::Range*, bool active); 150 void setMarkerActive(WebCore::Range*, bool active);
151 151
152 // Returns the ordinal of the first match in the frame specified. This 152 // Returns the ordinal of the first match in the frame specified. This
153 // function enumerates the frames, starting with the main frame and up to (b ut 153 // function enumerates the frames, starting with the main frame and up to (b ut
154 // not including) the frame passed in as a parameter and counts how many 154 // not including) the frame passed in as a parameter and counts how many
155 // matches have been found. 155 // matches have been found.
156 int ordinalOfFirstMatchForFrame(WebFrameImpl*) const; 156 int ordinalOfFirstMatchForFrame(WebLocalFrameImpl*) const;
157 157
158 // Determines whether the scoping effort is required for a particular frame. 158 // Determines whether the scoping effort is required for a particular frame.
159 // It is not necessary if the frame is invisible, for example, or if this 159 // It is not necessary if the frame is invisible, for example, or if this
160 // is a repeat search that already returned nothing last time the same prefi x 160 // is a repeat search that already returned nothing last time the same prefi x
161 // was searched. 161 // was searched.
162 bool shouldScopeMatches(const WTF::String& searchText); 162 bool shouldScopeMatches(const WTF::String& searchText);
163 163
164 // Removes the current frame from the global scoping effort and triggers any 164 // Removes the current frame from the global scoping effort and triggers any
165 // updates if appropriate. This method does not mark the scoping operation 165 // updates if appropriate. This method does not mark the scoping operation
166 // as finished. 166 // as finished.
(...skipping 16 matching lines...) Expand all
183 void invalidateIfNecessary(); 183 void invalidateIfNecessary();
184 184
185 // Sets the markers within a current match range as active or inactive. 185 // Sets the markers within a current match range as active or inactive.
186 void setMatchMarkerActive(bool); 186 void setMatchMarkerActive(bool);
187 187
188 void decrementFramesScopingCount(int identifier); 188 void decrementFramesScopingCount(int identifier);
189 189
190 // Returns the ordinal of the first match in the owner frame. 190 // Returns the ordinal of the first match in the owner frame.
191 int ordinalOfFirstMatch() const; 191 int ordinalOfFirstMatch() const;
192 192
193 WebFrameImpl& m_ownerFrame; 193 WebLocalFrameImpl& m_ownerFrame;
194 194
195 // A way for the main frame to keep track of which frame has an active 195 // A way for the main frame to keep track of which frame has an active
196 // match. Should be 0 for all other frames. 196 // match. Should be 0 for all other frames.
197 WebFrameImpl* m_currentActiveMatchFrame; 197 WebLocalFrameImpl* m_currentActiveMatchFrame;
198 198
199 // The range of the active match for the current frame. 199 // The range of the active match for the current frame.
200 RefPtrWillBePersistent<WebCore::Range> m_activeMatch; 200 RefPtrWillBePersistent<WebCore::Range> m_activeMatch;
201 201
202 // The index of the active match for the current frame. 202 // The index of the active match for the current frame.
203 int m_activeMatchIndexInCurrentFrame; 203 int m_activeMatchIndexInCurrentFrame;
204 204
205 // The scoping effort can time out and we need to keep track of where we 205 // The scoping effort can time out and we need to keep track of where we
206 // ended our last search so we can continue from where we left of. 206 // ended our last search so we can continue from where we left of.
207 RefPtrWillBePersistent<WebCore::Range> m_resumeScopingFromRange; 207 RefPtrWillBePersistent<WebCore::Range> m_resumeScopingFromRange;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 } // namespace blink 269 } // namespace blink
270 270
271 namespace WTF { 271 namespace WTF {
272 template <> struct VectorTraits<blink::TextFinder::FindMatch> : VectorTraitsBase <blink::TextFinder::FindMatch> { 272 template <> struct VectorTraits<blink::TextFinder::FindMatch> : VectorTraitsBase <blink::TextFinder::FindMatch> {
273 static const bool canInitializeWithMemset = true; 273 static const bool canInitializeWithMemset = true;
274 }; 274 };
275 } 275 }
276 276
277 #endif 277 #endif
OLDNEW
« no previous file with comments | « Source/web/StorageQuotaClientImpl.cpp ('k') | Source/web/TextFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698