Title: [170012] trunk/Source
Revision
170012
Author
[email protected]
Date
2014-06-16 09:42:31 -0700 (Mon, 16 Jun 2014)

Log Message

Page::findStringMatchingRanges() should take Vector<RefPtr<Range>> by reference instead of pointer
https://bugs.webkit.org/show_bug.cgi?id=133677

Reviewed by Anders Carlsson.


Source/WebCore: 
* WebCore.exp.in: Update the changed symbol.
* page/Page.cpp:
(WebCore::Page::findStringMatchingRanges): The method expects the matchRanges parameter to be non-null,
so it should take in that parameter by reference instead of pointer.
* page/Page.h:

Source/WebKit2: 
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::findString): Update the call to Page::findStringMatchingRanges() to pass
in a Vector<RefPtr<Range>> reference instead of a pointer.
(WebKit::FindController::findStringMatches): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170011 => 170012)


--- trunk/Source/WebCore/ChangeLog	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebCore/ChangeLog	2014-06-16 16:42:31 UTC (rev 170012)
@@ -1,3 +1,16 @@
+2014-06-16  Zan Dobersek  <[email protected]>
+
+        Page::findStringMatchingRanges() should take Vector<RefPtr<Range>> by reference instead of pointer
+        https://bugs.webkit.org/show_bug.cgi?id=133677
+
+        Reviewed by Anders Carlsson.
+
+        * WebCore.exp.in: Update the changed symbol.
+        * page/Page.cpp:
+        (WebCore::Page::findStringMatchingRanges): The method expects the matchRanges parameter to be non-null,
+        so it should take in that parameter by reference instead of pointer.
+        * page/Page.h:
+
 2014-06-16  Radu Stavila  <[email protected]>
 
         REGRESSION (r168046): Incorrect layout for multicol spanners when moving from one thread to another

Modified: trunk/Source/WebCore/WebCore.exp.in (170011 => 170012)


--- trunk/Source/WebCore/WebCore.exp.in	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-06-16 16:42:31 UTC (rev 170012)
@@ -1108,7 +1108,7 @@
 __ZN7WebCore4Page22removeLayoutMilestonesEj
 __ZN7WebCore4Page23clearUndoRedoOperationsEv
 __ZN7WebCore4Page23invalidateStylesForLinkEy
-__ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEhiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0ENS1_15CrashOnOverflowEEERi
+__ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEhiRNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0ENS1_15CrashOnOverflowEEERi
 __ZN7WebCore4Page24resumeScriptedAnimationsEv
 __ZN7WebCore4Page24scrollingStateTreeAsTextEv
 __ZN7WebCore4Page25suspendScriptedAnimationsEv

Modified: trunk/Source/WebCore/page/Page.cpp (170011 => 170012)


--- trunk/Source/WebCore/page/Page.cpp	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebCore/page/Page.cpp	2014-06-16 16:42:31 UTC (rev 170012)
@@ -539,35 +539,35 @@
     return false;
 }
 
-void Page::findStringMatchingRanges(const String& target, FindOptions options, int limit, Vector<RefPtr<Range>>* matchRanges, int& indexForSelection)
+void Page::findStringMatchingRanges(const String& target, FindOptions options, int limit, Vector<RefPtr<Range>>& matchRanges, int& indexForSelection)
 {
     indexForSelection = 0;
 
     Frame* frame = &mainFrame();
     Frame* frameWithSelection = 0;
     do {
-        frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matchRanges->size()) : 0, true, matchRanges);
+        frame->editor().countMatchesForText(target, 0, options, limit ? (limit - matchRanges.size()) : 0, true, &matchRanges);
         if (frame->selection().isRange())
             frameWithSelection = frame;
         frame = incrementFrame(frame, true, false);
     } while (frame);
 
-    if (matchRanges->isEmpty())
+    if (matchRanges.isEmpty())
         return;
 
     if (frameWithSelection) {
         indexForSelection = NoMatchAfterUserSelection;
         RefPtr<Range> selectedRange = frameWithSelection->selection().selection().firstRange();
         if (options & Backwards) {
-            for (size_t i = matchRanges->size(); i > 0; --i) {
-                if (selectedRange->compareBoundaryPoints(Range::END_TO_START, matchRanges->at(i - 1).get(), IGNORE_EXCEPTION) > 0) {
+            for (size_t i = matchRanges.size(); i > 0; --i) {
+                if (selectedRange->compareBoundaryPoints(Range::END_TO_START, matchRanges[i - 1].get(), IGNORE_EXCEPTION) > 0) {
                     indexForSelection = i - 1;
                     break;
                 }
             }
         } else {
-            for (size_t i = 0; i < matchRanges->size(); ++i) {
-                if (selectedRange->compareBoundaryPoints(Range::START_TO_END, matchRanges->at(i).get(), IGNORE_EXCEPTION) < 0) {
+            for (size_t i = 0, size = matchRanges.size(); i < size; ++i) {
+                if (selectedRange->compareBoundaryPoints(Range::START_TO_END, matchRanges[i].get(), IGNORE_EXCEPTION) < 0) {
                     indexForSelection = i;
                     break;
                 }
@@ -575,7 +575,7 @@
         }
     } else {
         if (options & Backwards)
-            indexForSelection = matchRanges->size() - 1;
+            indexForSelection = matchRanges.size() - 1;
         else
             indexForSelection = 0;
     }

Modified: trunk/Source/WebCore/page/Page.h (170011 => 170012)


--- trunk/Source/WebCore/page/Page.h	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebCore/page/Page.h	2014-06-16 16:42:31 UTC (rev 170012)
@@ -251,7 +251,7 @@
     // the index of the first range after the user selection
     // NoMatchAfterUserSelection if there is no matching text after the user selection.
     enum { NoMatchAfterUserSelection = -1 };
-    void findStringMatchingRanges(const String&, FindOptions, int maxCount, Vector<RefPtr<Range>>*, int& indexForSelection);
+    void findStringMatchingRanges(const String&, FindOptions, int maxCount, Vector<RefPtr<Range>>&, int& indexForSelection);
 #if PLATFORM(COCOA)
     void addSchedulePair(PassRefPtr<SchedulePair>);
     void removeSchedulePair(PassRefPtr<SchedulePair>);

Modified: trunk/Source/WebKit2/ChangeLog (170011 => 170012)


--- trunk/Source/WebKit2/ChangeLog	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebKit2/ChangeLog	2014-06-16 16:42:31 UTC (rev 170012)
@@ -1,5 +1,17 @@
 2014-06-16  Zan Dobersek  <[email protected]>
 
+        Page::findStringMatchingRanges() should take Vector<RefPtr<Range>> by reference instead of pointer
+        https://bugs.webkit.org/show_bug.cgi?id=133677
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::findString): Update the call to Page::findStringMatchingRanges() to pass
+        in a Vector<RefPtr<Range>> reference instead of a pointer.
+        (WebKit::FindController::findStringMatches): Ditto.
+
+2014-06-16  Zan Dobersek  <[email protected]>
+
         Unreviewed build fixes for the EFL and GTK+ ports after r169994 and 170000.
 
         * UIProcess/API/C/WKPluginSiteDataManager.cpp: Undefine the None macro under X11.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (170011 => 170012)


--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2014-06-16 16:40:56 UTC (rev 170011)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2014-06-16 16:42:31 UTC (rev 170012)
@@ -209,7 +209,7 @@
             if (fs.selectionBounds().isEmpty()) {
                 m_findMatches.clear();
                 int indexForSelection;
-                m_webPage->corePage()->findStringMatchingRanges(string, core(options), maxMatchCount, &m_findMatches, indexForSelection);
+                m_webPage->corePage()->findStringMatchingRanges(string, core(options), maxMatchCount, m_findMatches, indexForSelection);
                 m_foundStringMatchIndex = indexForSelection;
                 foundStringStartsAfterSelection = true;
             }
@@ -237,7 +237,7 @@
     m_findMatches.clear();
     int indexForSelection;
 
-    m_webPage->corePage()->findStringMatchingRanges(string, core(options), maxMatchCount, &m_findMatches, indexForSelection);
+    m_webPage->corePage()->findStringMatchingRanges(string, core(options), maxMatchCount, m_findMatches, indexForSelection);
 
     Vector<Vector<IntRect>> matchRects;
     for (size_t i = 0; i < m_findMatches.size(); ++i) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to