Title: [163958] trunk
Revision
163958
Author
[email protected]
Date
2014-02-12 06:58:40 -0800 (Wed, 12 Feb 2014)

Log Message

Update the HTML Media Capture implementation.
https://bugs.webkit.org/show_bug.cgi?id=118465

Reviewed by Darin Adler.

Make the implementation in WebKit compatible with the 2013-05-09
version of the spec, which makes the "capture" attribute a boolean
instead of an enum.

Source/WebCore:

Covered by fast/forms/file/file-input-capture.html.

* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::capture): Renamed to shouldUseMediaCapture().
(WebCore::HTMLInputElement::shouldUseMediaCapture): Return a bool.
* html/HTMLInputElement.h:
* html/HTMLInputElement.idl: Turn the `capture' attribute into a
reflective boolean instead of a DOMString.
* platform/FileChooser.h:

Source/WebKit/efl:

* ewk/ewk_file_chooser.cpp:
(ewk_file_chooser_capture_get): Return an Eina_Bool now.
* ewk/ewk_file_chooser.h: Get rid of Ewk_File_Chooser_Capture_Type.

Source/WebKit2:

* Shared/WebOpenPanelParameters.cpp:
(WebKit::WebOpenPanelParameters::capture): Return a bool.
* Shared/WebOpenPanelParameters.h: Ditto.
* UIProcess/API/C/WKOpenPanelParameters.cpp:
(WKOpenPanelParametersCopyCapture): Deprecate, the implementation is
incompatible with the current version of the spec.
(WKOpenPanelParametersGetCaptureEnabled): Add and return a bool.
* UIProcess/API/C/WKOpenPanelParameters.h:

LayoutTests:

* fast/forms/file/file-input-capture-expected.txt:
* fast/forms/file/file-input-capture.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163957 => 163958)


--- trunk/LayoutTests/ChangeLog	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/LayoutTests/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
@@ -1,3 +1,17 @@
+2014-02-12  Raphael Kubo da Costa  <[email protected]>
+
+        Update the HTML Media Capture implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=118465
+
+        Reviewed by Darin Adler.
+
+        Make the implementation in WebKit compatible with the 2013-05-09
+        version of the spec, which makes the "capture" attribute a boolean
+        instead of an enum.
+
+        * fast/forms/file/file-input-capture-expected.txt:
+        * fast/forms/file/file-input-capture.html:
+
 2014-02-12  Mihai Tica  <[email protected]>
 
         [CSS Element Blending] Implement the software path of -webkit-blend-mode with Core Graphics.

Modified: trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt (163957 => 163958)


--- trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt	2014-02-12 14:58:40 UTC (rev 163958)
@@ -4,14 +4,20 @@
 
 
 PASS 'capture' in input is true
-PASS input.capture is ''
-PASS input.capture is 'filesystem'
-PASS input.capture is 'camera'
-PASS input.capture is 'camcorder'
-PASS input.capture is 'microphone'
-PASS input.capture is 'filesystem'
-PASS input.capture is 'camcorder'
-PASS input.getAttribute('capture') is 'CamCorder'
+PASS input.capture is false
+PASS input.hasAttribute('capture') is false
+PASS input.capture is false
+PASS input.hasAttribute('capture') is false
+PASS input.capture is true
+PASS input.hasAttribute('capture') is true
+PASS input.capture is false
+PASS input.hasAttribute('capture') is false
+PASS input.capture is true
+PASS input.hasAttribute('capture') is true
+PASS input.capture is false
+PASS input.hasAttribute('capture') is false
+PASS input.capture is true
+PASS input.hasAttribute('capture') is true
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/forms/file/file-input-capture.html (163957 => 163958)


--- trunk/LayoutTests/fast/forms/file/file-input-capture.html	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/LayoutTests/fast/forms/file/file-input-capture.html	2014-02-12 14:58:40 UTC (rev 163958)
@@ -7,28 +7,33 @@
 var input = document.createElement("input");
 
 shouldBeTrue("'capture' in input");
-shouldBe("input.capture", "''");
+shouldBe("input.capture", "false");
+shouldBe("input.hasAttribute('capture')", "false");
 
 input.setAttribute("type", "file");
 
-shouldBe("input.capture", "'filesystem'");
+shouldBe("input.capture", "false");
+shouldBe("input.hasAttribute('capture')", "false");
 
-input.setAttribute("capture", "CaMerA");
-shouldBe("input.capture", "'camera'");
+input.setAttribute("capture", true);
+shouldBe("input.capture", "true");
+shouldBe("input.hasAttribute('capture')", "true");
 
-input.setAttribute("capture", "camcorder");
-shouldBe("input.capture", "'camcorder'");
+input.removeAttribute("capture");
+shouldBe("input.capture", "false");
+shouldBe("input.hasAttribute('capture')", "false");
 
-input.setAttribute("capture", "MiCroPhonE");
-shouldBe("input.capture", "'microphone'");
+input.setAttribute("capture", "'x'");
+shouldBe("input.capture", "true");
+shouldBe("input.hasAttribute('capture')", "true");
 
-input.setAttribute("capture", "xyzzy");
-shouldBe("input.capture", "'filesystem'");
+input.capture = false;
+shouldBe("input.capture", "false");
+shouldBe("input.hasAttribute('capture')", "false");
 
-input.capture = "CamCorder";
-shouldBe("input.capture", "'camcorder'");
-shouldBe("input.getAttribute('capture')", "'CamCorder'");
-
+input.capture = true;
+shouldBe("input.capture", "true");
+shouldBe("input.hasAttribute('capture')", "true");
 </script>
 <script src=""
 </html>

Modified: trunk/Source/WebCore/ChangeLog (163957 => 163958)


--- trunk/Source/WebCore/ChangeLog	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
@@ -1,3 +1,26 @@
+2014-02-12  Raphael Kubo da Costa  <[email protected]>
+
+        Update the HTML Media Capture implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=118465
+
+        Reviewed by Darin Adler.
+
+        Make the implementation in WebKit compatible with the 2013-05-09
+        version of the spec, which makes the "capture" attribute a boolean
+        instead of an enum.
+
+        Covered by fast/forms/file/file-input-capture.html.
+
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::capture): Renamed to shouldUseMediaCapture().
+        (WebCore::HTMLInputElement::shouldUseMediaCapture): Return a bool.
+        * html/HTMLInputElement.h:
+        * html/HTMLInputElement.idl: Turn the `capture' attribute into a
+        reflective boolean instead of a DOMString.
+        * platform/FileChooser.h:
+
 2014-02-12  Radu Stavila  <[email protected]>
 
         [CSS Regions] Remove unused method in RenderFlowThread

Modified: trunk/Source/WebCore/html/FileInputType.cpp (163957 => 163958)


--- trunk/Source/WebCore/html/FileInputType.cpp	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/html/FileInputType.cpp	2014-02-12 14:58:40 UTC (rev 163958)
@@ -193,7 +193,7 @@
         settings.acceptFileExtensions = input.acceptFileExtensions();
         settings.selectedFiles = m_fileList->paths();
 #if ENABLE(MEDIA_CAPTURE)
-        settings.capture = input.capture();
+        settings.capture = input.shouldUseMediaCapture();
 #endif
 
         applyFileChooserSettings(settings);

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (163957 => 163958)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2014-02-12 14:58:40 UTC (rev 163958)
@@ -1798,26 +1798,10 @@
 }
 
 #if ENABLE(MEDIA_CAPTURE)
-String HTMLInputElement::capture() const
+bool HTMLInputElement::shouldUseMediaCapture() const
 {
-    if (!isFileUpload())
-        return String();
-
-    String capture = fastGetAttribute(captureAttr).lower();
-    if (capture == "camera"
-        || capture == "camcorder"
-        || capture == "microphone"
-        || capture == "filesystem")
-        return capture;
-
-    return "filesystem";
+    return isFileUpload() && fastHasAttribute(captureAttr);
 }
-
-void HTMLInputElement::setCapture(const String& value)
-{
-    setAttribute(captureAttr, value);
-}
-
 #endif
 
 bool HTMLInputElement::isInRequiredRadioButtonGroup()

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (163957 => 163958)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2014-02-12 14:58:40 UTC (rev 163958)
@@ -298,8 +298,7 @@
     String defaultToolTip() const;
 
 #if ENABLE(MEDIA_CAPTURE)
-    String capture() const;
-    void setCapture(const String& value);
+    bool shouldUseMediaCapture() const;
 #endif
 
     static const int maximumLength;

Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (163957 => 163958)


--- trunk/Source/WebCore/html/HTMLInputElement.idl	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl	2014-02-12 14:58:40 UTC (rev 163958)
@@ -126,5 +126,5 @@
     [Conditional=IOS_AUTOCORRECT_AND_AUTOCAPITALIZE, TreatNullAs=NullString] attribute DOMString autocapitalize;
 
     // See http://www.w3.org/TR/html-media-capture/
-    [Conditional=MEDIA_CAPTURE] attribute DOMString capture;
+    [Conditional=MEDIA_CAPTURE, Reflect] attribute boolean capture;
 };

Modified: trunk/Source/WebCore/platform/FileChooser.h (163957 => 163958)


--- trunk/Source/WebCore/platform/FileChooser.h	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebCore/platform/FileChooser.h	2014-02-12 14:58:40 UTC (rev 163958)
@@ -56,7 +56,7 @@
     Vector<String> acceptFileExtensions;
     Vector<String> selectedFiles;
 #if ENABLE(MEDIA_CAPTURE)
-    String capture;
+    bool capture;
 #endif
 
     // Returns a combined vector of acceptMIMETypes and acceptFileExtensions.

Modified: trunk/Source/WebKit/efl/ChangeLog (163957 => 163958)


--- trunk/Source/WebKit/efl/ChangeLog	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit/efl/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
@@ -1,3 +1,18 @@
+2014-02-12  Raphael Kubo da Costa  <[email protected]>
+
+        Update the HTML Media Capture implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=118465
+
+        Reviewed by Darin Adler.
+
+        Make the implementation in WebKit compatible with the 2013-05-09
+        version of the spec, which makes the "capture" attribute a boolean
+        instead of an enum.
+
+        * ewk/ewk_file_chooser.cpp:
+        (ewk_file_chooser_capture_get): Return an Eina_Bool now.
+        * ewk/ewk_file_chooser.h: Get rid of Ewk_File_Chooser_Capture_Type.
+
 2014-02-09  Ryuan Choi  <[email protected]>
 
         [EFL] Remove PageClientEfl

Modified: trunk/Source/WebKit/efl/ewk/ewk_file_chooser.cpp (163957 => 163958)


--- trunk/Source/WebKit/efl/ewk/ewk_file_chooser.cpp	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit/efl/ewk/ewk_file_chooser.cpp	2014-02-12 14:58:40 UTC (rev 163958)
@@ -76,26 +76,14 @@
     return files;
 }
 
-Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser)
+Eina_Bool ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser)
 {
 #if ENABLE(MEDIA_CAPTURE)
-    EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID);
-
-    String capture = chooser->fileChooser->settings().capture;
-
-    if (capture == "camera")
-        return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA;
-
-    if (capture == "camcorder")
-        return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER;
-
-    if (capture == "microphone")
-        return EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE;
-
-    return EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM;
+    EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false);
+    return chooser->fileChooser->settings().capture;
 #else
     UNUSED_PARAM(chooser);
-    return EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID;
+    return false;
 #endif
 }
 

Modified: trunk/Source/WebKit/efl/ewk/ewk_file_chooser.h (163957 => 163958)


--- trunk/Source/WebKit/efl/ewk/ewk_file_chooser.h	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit/efl/ewk/ewk_file_chooser.h	2014-02-12 14:58:40 UTC (rev 163958)
@@ -43,19 +43,6 @@
 typedef struct _Ewk_File_Chooser Ewk_File_Chooser;
 
 /**
- * \enum    _Ewk_File_Chooser_Capture_Type
- * @brief   Types of capture attribute of file chooser to support the HTML media capture.
- */
-enum _Ewk_File_Chooser_Capture_Type {
-    EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID,
-    EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM,
-    EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA,
-    EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER,
-    EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE
-};
-typedef enum _Ewk_File_Chooser_Capture_Type Ewk_File_Chooser_Capture_Type;
-
-/**
  * Query if multiple files are supported by file chooser.
  *
  * @param f file chooser object.
@@ -114,16 +101,15 @@
 EAPI Eina_List *ewk_file_chooser_selected_files_get(const Ewk_File_Chooser *f);
 
 /**
- * Returns the capture attribute of the file chooser to support HTML media capture.
+ * Returns whether the device's media capture capabilities should be used in the file chooser.
  *
  * @see http://www.w3.org/TR/html-media-capture/ for the semantics of the capture attribute.
  *
  * @param f file chooser object.
  *
- * @return @c Ewk_File_Chooser_Capture_Type on supporting HTML media capture or
- *         @c EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID on failure.
+ * @return @c EINA_TRUE if the device's capabilities should be used, @c EINA_FALSE otherwise.
  */
-EAPI Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser *f);
+EAPI Eina_Bool ewk_file_chooser_capture_get(const Ewk_File_Chooser *f);
 
 #ifdef __cplusplus
 }

Modified: trunk/Source/WebKit2/ChangeLog (163957 => 163958)


--- trunk/Source/WebKit2/ChangeLog	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-12 14:58:40 UTC (rev 163958)
@@ -1,3 +1,23 @@
+2014-02-12  Raphael Kubo da Costa  <[email protected]>
+
+        Update the HTML Media Capture implementation.
+        https://bugs.webkit.org/show_bug.cgi?id=118465
+
+        Reviewed by Darin Adler.
+
+        Make the implementation in WebKit compatible with the 2013-05-09
+        version of the spec, which makes the "capture" attribute a boolean
+        instead of an enum.
+
+        * Shared/WebOpenPanelParameters.cpp:
+        (WebKit::WebOpenPanelParameters::capture): Return a bool.
+        * Shared/WebOpenPanelParameters.h: Ditto.
+        * UIProcess/API/C/WKOpenPanelParameters.cpp:
+        (WKOpenPanelParametersCopyCapture): Deprecate, the implementation is
+        incompatible with the current version of the spec.
+        (WKOpenPanelParametersGetCaptureEnabled): Add and return a bool.
+        * UIProcess/API/C/WKOpenPanelParameters.h:
+
 2014-02-12  Alberto Garcia  <[email protected]>
 
         [GTK] Fails to build if configure is run with its absolute path

Modified: trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp (163957 => 163958)


--- trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp	2014-02-12 14:58:40 UTC (rev 163958)
@@ -55,7 +55,7 @@
 }
 
 #if ENABLE(MEDIA_CAPTURE)
-String WebOpenPanelParameters::capture() const
+bool WebOpenPanelParameters::capture() const
 {
     return m_settings.capture;
 }

Modified: trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h (163957 => 163958)


--- trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h	2014-02-12 14:58:40 UTC (rev 163958)
@@ -47,7 +47,7 @@
     PassRefPtr<API::Array> acceptMIMETypes() const;
     PassRefPtr<API::Array> selectedFileNames() const;
 #if ENABLE(MEDIA_CAPTURE)
-    String capture() const;
+    bool capture() const;
 #endif
 
 private:

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp (163957 => 163958)


--- trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp	2014-02-12 14:58:40 UTC (rev 163958)
@@ -48,13 +48,19 @@
     return toAPI(toImpl(parametersRef)->acceptMIMETypes().leakRef());
 }
 
+// Deprecated.
 WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parametersRef)
 {
+    return 0;
+}
+
+bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef)
+{
 #if ENABLE(MEDIA_CAPTURE)
-    return toCopiedAPI(toImpl(parametersRef)->capture());
+    return toImpl(parametersRef)->capture();
 #else
     UNUSED_PARAM(parametersRef);
-    return 0;
+    return false;
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h (163957 => 163958)


--- trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h	2014-02-12 13:31:22 UTC (rev 163957)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h	2014-02-12 14:58:40 UTC (rev 163958)
@@ -43,8 +43,11 @@
 
 WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parameters);
 
+/* DEPRECATED - Please use WKOpenPanelParametersGetCaptureEnabled() instead. */
 WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters);
 
+WK_EXPORT bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef);
+
 WK_EXPORT WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef);
 
 #ifdef __cplusplus
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to