Changeset 163958 in webkit


Ignore:
Timestamp:
Feb 12, 2014 6:58:40 AM (10 years ago)
Author:
rakuco@webkit.org
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:
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r163955 r163958  
     12014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
     2
     3        Update the HTML Media Capture implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=118465
     5
     6        Reviewed by Darin Adler.
     7
     8        Make the implementation in WebKit compatible with the 2013-05-09
     9        version of the spec, which makes the "capture" attribute a boolean
     10        instead of an enum.
     11
     12        * fast/forms/file/file-input-capture-expected.txt:
     13        * fast/forms/file/file-input-capture.html:
     14
    1152014-02-12  Mihai Tica  <mitica@adobe.com>
    216
  • trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt

    r116592 r163958  
    55
    66PASS 'capture' in input is true
    7 PASS input.capture is ''
    8 PASS input.capture is 'filesystem'
    9 PASS input.capture is 'camera'
    10 PASS input.capture is 'camcorder'
    11 PASS input.capture is 'microphone'
    12 PASS input.capture is 'filesystem'
    13 PASS input.capture is 'camcorder'
    14 PASS input.getAttribute('capture') is 'CamCorder'
     7PASS input.capture is false
     8PASS input.hasAttribute('capture') is false
     9PASS input.capture is false
     10PASS input.hasAttribute('capture') is false
     11PASS input.capture is true
     12PASS input.hasAttribute('capture') is true
     13PASS input.capture is false
     14PASS input.hasAttribute('capture') is false
     15PASS input.capture is true
     16PASS input.hasAttribute('capture') is true
     17PASS input.capture is false
     18PASS input.hasAttribute('capture') is false
     19PASS input.capture is true
     20PASS input.hasAttribute('capture') is true
    1521PASS successfullyParsed is true
    1622
  • trunk/LayoutTests/fast/forms/file/file-input-capture.html

    r155268 r163958  
    88
    99shouldBeTrue("'capture' in input");
    10 shouldBe("input.capture", "''");
     10shouldBe("input.capture", "false");
     11shouldBe("input.hasAttribute('capture')", "false");
    1112
    1213input.setAttribute("type", "file");
    1314
    14 shouldBe("input.capture", "'filesystem'");
     15shouldBe("input.capture", "false");
     16shouldBe("input.hasAttribute('capture')", "false");
    1517
    16 input.setAttribute("capture", "CaMerA");
    17 shouldBe("input.capture", "'camera'");
     18input.setAttribute("capture", true);
     19shouldBe("input.capture", "true");
     20shouldBe("input.hasAttribute('capture')", "true");
    1821
    19 input.setAttribute("capture", "camcorder");
    20 shouldBe("input.capture", "'camcorder'");
     22input.removeAttribute("capture");
     23shouldBe("input.capture", "false");
     24shouldBe("input.hasAttribute('capture')", "false");
    2125
    22 input.setAttribute("capture", "MiCroPhonE");
    23 shouldBe("input.capture", "'microphone'");
     26input.setAttribute("capture", "'x'");
     27shouldBe("input.capture", "true");
     28shouldBe("input.hasAttribute('capture')", "true");
    2429
    25 input.setAttribute("capture", "xyzzy");
    26 shouldBe("input.capture", "'filesystem'");
     30input.capture = false;
     31shouldBe("input.capture", "false");
     32shouldBe("input.hasAttribute('capture')", "false");
    2733
    28 input.capture = "CamCorder";
    29 shouldBe("input.capture", "'camcorder'");
    30 shouldBe("input.getAttribute('capture')", "'CamCorder'");
    31 
     34input.capture = true;
     35shouldBe("input.capture", "true");
     36shouldBe("input.hasAttribute('capture')", "true");
    3237</script>
    3338<script src="../../../resources/js-test-post.js"></script>
  • trunk/Source/WebCore/ChangeLog

    r163957 r163958  
     12014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
     2
     3        Update the HTML Media Capture implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=118465
     5
     6        Reviewed by Darin Adler.
     7
     8        Make the implementation in WebKit compatible with the 2013-05-09
     9        version of the spec, which makes the "capture" attribute a boolean
     10        instead of an enum.
     11
     12        Covered by fast/forms/file/file-input-capture.html.
     13
     14        * html/FileInputType.cpp:
     15        (WebCore::FileInputType::handleDOMActivateEvent):
     16        * html/HTMLInputElement.cpp:
     17        (WebCore::HTMLInputElement::capture): Renamed to shouldUseMediaCapture().
     18        (WebCore::HTMLInputElement::shouldUseMediaCapture): Return a bool.
     19        * html/HTMLInputElement.h:
     20        * html/HTMLInputElement.idl: Turn the `capture' attribute into a
     21        reflective boolean instead of a DOMString.
     22        * platform/FileChooser.h:
     23
    1242014-02-12  Radu Stavila  <stavila@adobe.com>
    225
  • trunk/Source/WebCore/html/FileInputType.cpp

    r163724 r163958  
    194194        settings.selectedFiles = m_fileList->paths();
    195195#if ENABLE(MEDIA_CAPTURE)
    196         settings.capture = input.capture();
     196        settings.capture = input.shouldUseMediaCapture();
    197197#endif
    198198
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r163724 r163958  
    17991799
    18001800#if ENABLE(MEDIA_CAPTURE)
    1801 String HTMLInputElement::capture() const
    1802 {
    1803     if (!isFileUpload())
    1804         return String();
    1805 
    1806     String capture = fastGetAttribute(captureAttr).lower();
    1807     if (capture == "camera"
    1808         || capture == "camcorder"
    1809         || capture == "microphone"
    1810         || capture == "filesystem")
    1811         return capture;
    1812 
    1813     return "filesystem";
    1814 }
    1815 
    1816 void HTMLInputElement::setCapture(const String& value)
    1817 {
    1818     setAttribute(captureAttr, value);
    1819 }
    1820 
     1801bool HTMLInputElement::shouldUseMediaCapture() const
     1802{
     1803    return isFileUpload() && fastHasAttribute(captureAttr);
     1804}
    18211805#endif
    18221806
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r162158 r163958  
    299299
    300300#if ENABLE(MEDIA_CAPTURE)
    301     String capture() const;
    302     void setCapture(const String& value);
     301    bool shouldUseMediaCapture() const;
    303302#endif
    304303
  • trunk/Source/WebCore/html/HTMLInputElement.idl

    r163483 r163958  
    127127
    128128    // See http://www.w3.org/TR/html-media-capture/
    129     [Conditional=MEDIA_CAPTURE] attribute DOMString capture;
     129    [Conditional=MEDIA_CAPTURE, Reflect] attribute boolean capture;
    130130};
  • trunk/Source/WebCore/platform/FileChooser.h

    r163483 r163958  
    5757    Vector<String> selectedFiles;
    5858#if ENABLE(MEDIA_CAPTURE)
    59     String capture;
     59    bool capture;
    6060#endif
    6161
  • trunk/Source/WebKit/efl/ChangeLog

    r163761 r163958  
     12014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
     2
     3        Update the HTML Media Capture implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=118465
     5
     6        Reviewed by Darin Adler.
     7
     8        Make the implementation in WebKit compatible with the 2013-05-09
     9        version of the spec, which makes the "capture" attribute a boolean
     10        instead of an enum.
     11
     12        * ewk/ewk_file_chooser.cpp:
     13        (ewk_file_chooser_capture_get): Return an Eina_Bool now.
     14        * ewk/ewk_file_chooser.h: Get rid of Ewk_File_Chooser_Capture_Type.
     15
    1162014-02-09  Ryuan Choi  <ryuan.choi@samsung.com>
    217
  • trunk/Source/WebKit/efl/ewk/ewk_file_chooser.cpp

    r163483 r163958  
    7777}
    7878
    79 Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser)
     79Eina_Bool ewk_file_chooser_capture_get(const Ewk_File_Chooser* chooser)
    8080{
    8181#if ENABLE(MEDIA_CAPTURE)
    82     EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID);
    83 
    84     String capture = chooser->fileChooser->settings().capture;
    85 
    86     if (capture == "camera")
    87         return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA;
    88 
    89     if (capture == "camcorder")
    90         return EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER;
    91 
    92     if (capture == "microphone")
    93         return EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE;
    94 
    95     return EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM;
     82    EINA_SAFETY_ON_NULL_RETURN_VAL(chooser, false);
     83    return chooser->fileChooser->settings().capture;
    9684#else
    9785    UNUSED_PARAM(chooser);
    98     return EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID;
     86    return false;
    9987#endif
    10088}
  • trunk/Source/WebKit/efl/ewk/ewk_file_chooser.h

    r123597 r163958  
    4242
    4343typedef struct _Ewk_File_Chooser Ewk_File_Chooser;
    44 
    45 /**
    46  * \enum    _Ewk_File_Chooser_Capture_Type
    47  * @brief   Types of capture attribute of file chooser to support the HTML media capture.
    48  */
    49 enum _Ewk_File_Chooser_Capture_Type {
    50     EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID,
    51     EWK_FILE_CHOOSER_CAPTURE_TYPE_FILESYSTEM,
    52     EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMERA,
    53     EWK_FILE_CHOOSER_CAPTURE_TYPE_CAMCORDER,
    54     EWK_FILE_CHOOSER_CAPTURE_TYPE_MICROPHONE
    55 };
    56 typedef enum _Ewk_File_Chooser_Capture_Type Ewk_File_Chooser_Capture_Type;
    5744
    5845/**
     
    115102
    116103/**
    117  * Returns the capture attribute of the file chooser to support HTML media capture.
     104 * Returns whether the device's media capture capabilities should be used in the file chooser.
    118105 *
    119106 * @see http://www.w3.org/TR/html-media-capture/ for the semantics of the capture attribute.
     
    121108 * @param f file chooser object.
    122109 *
    123  * @return @c Ewk_File_Chooser_Capture_Type on supporting HTML media capture or
    124  *         @c EWK_FILE_CHOOSER_CAPTURE_TYPE_INVALID on failure.
     110 * @return @c EINA_TRUE if the device's capabilities should be used, @c EINA_FALSE otherwise.
    125111 */
    126 EAPI Ewk_File_Chooser_Capture_Type ewk_file_chooser_capture_get(const Ewk_File_Chooser *f);
     112EAPI Eina_Bool ewk_file_chooser_capture_get(const Ewk_File_Chooser *f);
    127113
    128114#ifdef __cplusplus
  • trunk/Source/WebKit2/ChangeLog

    r163956 r163958  
     12014-02-12  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
     2
     3        Update the HTML Media Capture implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=118465
     5
     6        Reviewed by Darin Adler.
     7
     8        Make the implementation in WebKit compatible with the 2013-05-09
     9        version of the spec, which makes the "capture" attribute a boolean
     10        instead of an enum.
     11
     12        * Shared/WebOpenPanelParameters.cpp:
     13        (WebKit::WebOpenPanelParameters::capture): Return a bool.
     14        * Shared/WebOpenPanelParameters.h: Ditto.
     15        * UIProcess/API/C/WKOpenPanelParameters.cpp:
     16        (WKOpenPanelParametersCopyCapture): Deprecate, the implementation is
     17        incompatible with the current version of the spec.
     18        (WKOpenPanelParametersGetCaptureEnabled): Add and return a bool.
     19        * UIProcess/API/C/WKOpenPanelParameters.h:
     20
    1212014-02-12  Alberto Garcia  <berto@igalia.com>
    222
  • trunk/Source/WebKit2/Shared/WebOpenPanelParameters.cpp

    r160608 r163958  
    5656
    5757#if ENABLE(MEDIA_CAPTURE)
    58 String WebOpenPanelParameters::capture() const
     58bool WebOpenPanelParameters::capture() const
    5959{
    6060    return m_settings.capture;
  • trunk/Source/WebKit2/Shared/WebOpenPanelParameters.h

    r160384 r163958  
    4848    PassRefPtr<API::Array> selectedFileNames() const;
    4949#if ENABLE(MEDIA_CAPTURE)
    50     String capture() const;
     50    bool capture() const;
    5151#endif
    5252
  • trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.cpp

    r159333 r163958  
    4949}
    5050
     51// Deprecated.
    5152WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parametersRef)
    5253{
     54    return 0;
     55}
     56
     57bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef)
     58{
    5359#if ENABLE(MEDIA_CAPTURE)
    54     return toCopiedAPI(toImpl(parametersRef)->capture());
     60    return toImpl(parametersRef)->capture();
    5561#else
    5662    UNUSED_PARAM(parametersRef);
    57     return 0;
     63    return false;
    5864#endif
    5965}
  • trunk/Source/WebKit2/UIProcess/API/C/WKOpenPanelParameters.h

    r148005 r163958  
    4444WK_EXPORT WKArrayRef WKOpenPanelParametersCopyAcceptedMIMETypes(WKOpenPanelParametersRef parameters);
    4545
     46/* DEPRECATED - Please use WKOpenPanelParametersGetCaptureEnabled() instead. */
    4647WK_EXPORT WKStringRef WKOpenPanelParametersCopyCapture(WKOpenPanelParametersRef parameters);
     48
     49WK_EXPORT bool WKOpenPanelParametersGetCaptureEnabled(WKOpenPanelParametersRef parametersRef);
    4750
    4851WK_EXPORT WKArrayRef WKOpenPanelParametersCopySelectedFileNames(WKOpenPanelParametersRef parametersRef);
Note: See TracChangeset for help on using the changeset viewer.