Title: [97538] trunk/Source
Revision
97538
Author
[email protected]
Date
2011-10-14 21:37:31 -0700 (Fri, 14 Oct 2011)

Log Message

<http://webkit.org/b/70158> Fix clang compiler warnings

Reviewed by Darin Adler.

Source/WebCore:

* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes): Use std::max<float>()
instead of std::max().

Source/WebKit/mac:

The following two methods in WebDelegateImplementationCaching.h
are ambiguous in WebChromeClient::runJavaScriptPrompt() because
the compiler can't decide how to convert the WTF::String
defaultText argument:

    id CallUIDelegate(WebView *, SEL, id, id);
    id CallUIDelegate(WebView *, SEL, id, BOOL);

The fix is to perform the conversion explicitly.

* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::runJavaScriptPrompt): Extract a defaultString
variable to convert the WTF::String to an NSString*, then
use defaultString in place of defaultText.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97537 => 97538)


--- trunk/Source/WebCore/ChangeLog	2011-10-15 02:00:23 UTC (rev 97537)
+++ trunk/Source/WebCore/ChangeLog	2011-10-15 04:37:31 UTC (rev 97538)
@@ -1,3 +1,13 @@
+2011-10-14  David Kilzer  <[email protected]>
+
+        <http://webkit.org/b/70158> Fix clang compiler warnings
+
+        Reviewed by Darin Adler.
+
+        * dom/ViewportArguments.cpp:
+        (WebCore::computeViewportAttributes): Use std::max<float>()
+        instead of std::max().
+
 2011-10-14  Mark Hahnenberg  <[email protected]>
 
         Rename getOwnPropertySlot to getOwnPropertySlotVirtual

Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (97537 => 97538)


--- trunk/Source/WebCore/dom/ViewportArguments.cpp	2011-10-15 02:00:23 UTC (rev 97537)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp	2011-10-15 04:37:31 UTC (rev 97538)
@@ -134,7 +134,7 @@
             result.initialScale = availableWidth / args.width;
         if (args.height != ViewportArguments::ValueAuto) {
             // if 'auto', the initial-scale will be negative here and thus ignored.
-            result.initialScale = max(result.initialScale, availableHeight / args.height);
+            result.initialScale = max<float>(result.initialScale, availableHeight / args.height);
         }
     }
 
@@ -162,13 +162,13 @@
         height = width * availableHeight / availableWidth;
 
     // Extend width and height to fill the visual viewport for the resolved initial-scale.
-    width = max(width, availableWidth / result.initialScale);
-    height = max(height, availableHeight / result.initialScale);
+    width = max<float>(width, availableWidth / result.initialScale);
+    height = max<float>(height, availableHeight / result.initialScale);
     result.layoutSize.setWidth(static_cast<int>(roundf(width)));
     result.layoutSize.setHeight(static_cast<int>(roundf(height)));
 
     // Update minimum scale factor, to never allow zooming out more than viewport
-    result.minimumScale = max(result.minimumScale, max(availableWidth / width, availableHeight / height));
+    result.minimumScale = max<float>(result.minimumScale, max(availableWidth / width, availableHeight / height));
 
     result.userScalable = args.userScalable;
     // Make maximum and minimum scale equal to the initial scale if user is not allowed to zoom in/out.

Modified: trunk/Source/WebKit/mac/ChangeLog (97537 => 97538)


--- trunk/Source/WebKit/mac/ChangeLog	2011-10-15 02:00:23 UTC (rev 97537)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-10-15 04:37:31 UTC (rev 97538)
@@ -1,3 +1,24 @@
+2011-10-14  David Kilzer  <[email protected]>
+
+        <http://webkit.org/b/70158> Fix clang compiler warnings
+
+        Reviewed by Darin Adler.
+
+        The following two methods in WebDelegateImplementationCaching.h
+        are ambiguous in WebChromeClient::runJavaScriptPrompt() because
+        the compiler can't decide how to convert the WTF::String
+        defaultText argument:
+
+            id CallUIDelegate(WebView *, SEL, id, id);
+            id CallUIDelegate(WebView *, SEL, id, BOOL);
+
+        The fix is to perform the conversion explicitly.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::runJavaScriptPrompt): Extract a defaultString
+        variable to convert the WTF::String to an NSString*, then
+        use defaultString in place of defaultText.
+
 2011-10-14  Mark Hahnenberg  <[email protected]>
 
         Rename virtual put to putVirtual

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (97537 => 97538)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2011-10-15 02:00:23 UTC (rev 97537)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2011-10-15 04:37:31 UTC (rev 97538)
@@ -505,19 +505,20 @@
 {
     id delegate = [m_webView UIDelegate];
     SEL selector = @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:);
+    NSString *defaultString = defaultText;
     if ([delegate respondsToSelector:selector]) {
-        result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultText, kit(frame));
+        result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultString, kit(frame));
         return !result.isNull();
     }
 
     // Call the old version of the delegate method if it is implemented.
     selector = @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:);
     if ([delegate respondsToSelector:selector]) {
-        result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultText);
+        result = (NSString *)CallUIDelegate(m_webView, selector, prompt, defaultString);
         return !result.isNull();
     }
 
-    result = [[WebDefaultUIDelegate sharedUIDelegate] webView:m_webView runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultText initiatedByFrame:kit(frame)];
+    result = [[WebDefaultUIDelegate sharedUIDelegate] webView:m_webView runJavaScriptTextInputPanelWithPrompt:prompt defaultText:defaultString initiatedByFrame:kit(frame)];
     return !result.isNull();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to