Title: [164715] trunk/Source/WebKit2
Revision
164715
Author
commit-qu...@webkit.org
Date
2014-02-26 05:51:32 -0800 (Wed, 26 Feb 2014)

Log Message

WebKitFindOptions shouldn't expose WEBKIT_FIND_OPTIONS_SHOW_{OVERLAY,FIND_INDICATOR,HIGHLIGHT}
https://bugs.webkit.org/show_bug.cgi?id=129263

Patch by Enrique Ocaña González <eoca...@igalia.com> on 2014-02-26
Reviewed by Sergio Villar Senin.

Avoided the need of WEBKIT_FIND_OPTIONS_SHOW_* fields by changing the semantics
of the findOptions field in WebKitFindOptions.

* UIProcess/API/gtk/WebKitFindController.cpp: Now
_WebKitFindControllerPrivate.findOptions is interpreted as WebKit::FindOptions
instead of WebKitFindOptions like before. Now the conversion has to be done in
both ways.
(toWebKitFindOptions): Added conversion function from WebKit::FindOptions to
WebKitFindOptions.
(webkit_find_controller_get_options):
(webKitFindControllerPerform):
(webkit_find_controller_search):
(webkit_find_controller_search_next):
(webkit_find_controller_search_previous):
(webkit_find_controller_count_matches):
* UIProcess/API/gtk/WebKitFindController.h: Removed values that shouldn't be
exposed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164714 => 164715)


--- trunk/Source/WebKit2/ChangeLog	2014-02-26 13:40:26 UTC (rev 164714)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-26 13:51:32 UTC (rev 164715)
@@ -1,3 +1,28 @@
+2014-02-26  Enrique Ocaña González  <eoca...@igalia.com>
+
+        WebKitFindOptions shouldn't expose WEBKIT_FIND_OPTIONS_SHOW_{OVERLAY,FIND_INDICATOR,HIGHLIGHT}
+        https://bugs.webkit.org/show_bug.cgi?id=129263
+
+        Reviewed by Sergio Villar Senin.
+
+        Avoided the need of WEBKIT_FIND_OPTIONS_SHOW_* fields by changing the semantics
+        of the findOptions field in WebKitFindOptions.
+
+        * UIProcess/API/gtk/WebKitFindController.cpp: Now
+        _WebKitFindControllerPrivate.findOptions is interpreted as WebKit::FindOptions
+        instead of WebKitFindOptions like before. Now the conversion has to be done in
+        both ways.
+        (toWebKitFindOptions): Added conversion function from WebKit::FindOptions to
+        WebKitFindOptions.
+        (webkit_find_controller_get_options):
+        (webKitFindControllerPerform):
+        (webkit_find_controller_search):
+        (webkit_find_controller_search_next):
+        (webkit_find_controller_search_previous):
+        (webkit_find_controller_count_matches):
+        * UIProcess/API/gtk/WebKitFindController.h: Removed values that shouldn't be
+        exposed.
+
 2014-02-26  Gergo Balogh  <gbalogh.u-sze...@partner.samsung.com>
 
         Inspector server should be enabled only when the web sockets is enabled too.

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp (164714 => 164715)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp	2014-02-26 13:40:26 UTC (rev 164714)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.cpp	2014-02-26 13:51:32 UTC (rev 164715)
@@ -73,6 +73,7 @@
 
 struct _WebKitFindControllerPrivate {
     CString searchText;
+    // Interpreted as WebKit::FindOptions.
     uint32_t findOptions;
     unsigned maxMatchCount;
     WebKitWebView* webView;
@@ -82,21 +83,22 @@
 
 WEBKIT_DEFINE_TYPE(WebKitFindController, webkit_find_controller, G_TYPE_OBJECT)
 
-static inline WebKit::FindOptions toWebKitFindOptions(WebKitFindOptions type)
+static inline WebKit::FindOptions toWebFindOptions(uint32_t findOptions)
 {
-    return static_cast<WebKit::FindOptions>((type & WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE ? FindOptionsCaseInsensitive : 0)
-        | (type & WEBKIT_FIND_OPTIONS_AT_WORD_STARTS ? FindOptionsAtWordStarts : 0)
-        | (type & WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START ? FindOptionsTreatMedialCapitalAsWordStart : 0)
-        | (type & WEBKIT_FIND_OPTIONS_BACKWARDS ? FindOptionsBackwards : 0)
-        | (type & WEBKIT_FIND_OPTIONS_WRAP_AROUND ? FindOptionsWrapAround : 0)
-        | (type & WEBKIT_FIND_OPTIONS_SHOW_OVERLAY ? FindOptionsShowOverlay : 0)
-        | (type & WEBKIT_FIND_OPTIONS_SHOW_FIND_INDICATOR ? FindOptionsShowFindIndicator : 0)
-        | (type & WEBKIT_FIND_OPTIONS_SHOW_HIGHLIGHT ? FindOptionsShowHighlight : 0));
+    return static_cast<WebKit::FindOptions>((findOptions & WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE ? FindOptionsCaseInsensitive : 0)
+        | (findOptions & WEBKIT_FIND_OPTIONS_AT_WORD_STARTS ? FindOptionsAtWordStarts : 0)
+        | (findOptions & WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START ? FindOptionsTreatMedialCapitalAsWordStart : 0)
+        | (findOptions & WEBKIT_FIND_OPTIONS_BACKWARDS ? FindOptionsBackwards : 0)
+        | (findOptions & WEBKIT_FIND_OPTIONS_WRAP_AROUND ? FindOptionsWrapAround : 0));
 }
 
-static inline WebKit::FindOptions toWebKitFindOptions(uint32_t type)
+static inline WebKitFindOptions toWebKitFindOptions(uint32_t findOptions)
 {
-    return toWebKitFindOptions(static_cast<WebKitFindOptions>(type));
+    return static_cast<WebKitFindOptions>((findOptions & FindOptionsCaseInsensitive ? WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE : 0)
+        | (findOptions & FindOptionsAtWordStarts ? WEBKIT_FIND_OPTIONS_AT_WORD_STARTS : 0)
+        | (findOptions & FindOptionsTreatMedialCapitalAsWordStart ? WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START : 0)
+        | (findOptions & FindOptionsBackwards ? WEBKIT_FIND_OPTIONS_BACKWARDS : 0)
+        | (findOptions & FindOptionsWrapAround ? WEBKIT_FIND_OPTIONS_WRAP_AROUND : 0));
 }
 
 static void didFindString(WKPageRef page, WKStringRef string, unsigned matchCount, const void* clientInfo)
@@ -317,7 +319,7 @@
 {
     g_return_val_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController), WEBKIT_FIND_OPTIONS_NONE);
 
-    return findController->priv->findOptions;
+    return toWebKitFindOptions(findController->priv->findOptions);
 }
 
 /**
@@ -360,7 +362,7 @@
     WebKitFindControllerPrivate* priv = findController->priv;
     if (operation == CountOperation) {
         getPage(findController)->countStringMatches(String::fromUTF8(priv->searchText.data()),
-            toWebKitFindOptions(priv->findOptions), priv->maxMatchCount);
+            static_cast<WebKit::FindOptions>(priv->findOptions), priv->maxMatchCount);
         return;
     }
 
@@ -373,9 +375,9 @@
         // unconditionally show highlights. Both search_next() and
         // search_prev() should not enable highlighting to avoid an
         // extra unmarkAllTextMatches() + markAllTextMatches()
-        findOptions |= WEBKIT_FIND_OPTIONS_SHOW_HIGHLIGHT;
+        findOptions |= FindOptionsShowHighlight;
 
-    getPage(findController)->findString(String::fromUTF8(priv->searchText.data()), toWebKitFindOptions(findOptions),
+    getPage(findController)->findString(String::fromUTF8(priv->searchText.data()), static_cast<WebKit::FindOptions>(findOptions),
                                         priv->maxMatchCount);
 }
 
@@ -417,8 +419,7 @@
 {
     g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
     g_return_if_fail(searchText);
-
-    webKitFindControllerSetSearchData(findController, searchText, findOptions, maxMatchCount);
+    webKitFindControllerSetSearchData(findController, searchText, toWebFindOptions(findOptions), maxMatchCount);
     webKitFindControllerPerform(findController, FindOperation);
 }
 
@@ -435,8 +436,8 @@
 {
     g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
 
-    findController->priv->findOptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS;
-    findController->priv->findOptions &= ~WEBKIT_FIND_OPTIONS_SHOW_HIGHLIGHT;
+    findController->priv->findOptions &= ~FindOptionsBackwards;
+    findController->priv->findOptions &= ~FindOptionsShowHighlight;
     webKitFindControllerPerform(findController, FindNextPrevOperation);
 }
 
@@ -453,8 +454,8 @@
 {
     g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
 
-    findController->priv->findOptions |= WEBKIT_FIND_OPTIONS_BACKWARDS;
-    findController->priv->findOptions &= ~WEBKIT_FIND_OPTIONS_SHOW_HIGHLIGHT;
+    findController->priv->findOptions |= FindOptionsBackwards;
+    findController->priv->findOptions &= ~FindOptionsShowHighlight;
     webKitFindControllerPerform(findController, FindNextPrevOperation);
 }
 
@@ -475,7 +476,7 @@
     g_return_if_fail(WEBKIT_IS_FIND_CONTROLLER(findController));
     g_return_if_fail(searchText);
 
-    webKitFindControllerSetSearchData(findController, searchText, findOptions, maxMatchCount);
+    webKitFindControllerSetSearchData(findController, searchText, toWebFindOptions(findOptions), maxMatchCount);
     webKitFindControllerPerform(findController, CountOperation);
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h (164714 => 164715)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h	2014-02-26 13:40:26 UTC (rev 164714)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitFindController.h	2014-02-26 13:51:32 UTC (rev 164715)
@@ -62,11 +62,7 @@
   WEBKIT_FIND_OPTIONS_AT_WORD_STARTS =                     1 << 1,
   WEBKIT_FIND_OPTIONS_TREAT_MEDIAL_CAPITAL_AS_WORD_START = 1 << 2,
   WEBKIT_FIND_OPTIONS_BACKWARDS =                          1 << 3,
-  WEBKIT_FIND_OPTIONS_WRAP_AROUND =                        1 << 4,
-  /*< private >*/
-  WEBKIT_FIND_OPTIONS_SHOW_OVERLAY =                       1 << 5,
-  WEBKIT_FIND_OPTIONS_SHOW_FIND_INDICATOR =                1 << 6,
-  WEBKIT_FIND_OPTIONS_SHOW_HIGHLIGHT =                     1 << 7,
+  WEBKIT_FIND_OPTIONS_WRAP_AROUND =                        1 << 4
 } WebKitFindOptions;
 
 struct _WebKitFindController {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to