Bug 118465

Summary: Update the HTML Media Capture implementation.
Product: WebKit Reporter: Raphael Kubo da Costa (:rakuco) <rakuco>
Component: PlatformAssignee: Raphael Kubo da Costa (:rakuco) <rakuco>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, eric.carlson, gyuyoung.kim, jer.noble, jonlee, kling, mxie, rniwa, rwlbuis, syoichi
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.w3.org/TR/html-media-capture/
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Description Raphael Kubo da Costa (:rakuco) 2013-07-08 05:17:24 PDT
Update the HTML Media Capture implementation.
Comment 1 Raphael Kubo da Costa (:rakuco) 2013-07-08 05:26:52 PDT
Created attachment 206232 [details]
Patch
Comment 2 Raphael Kubo da Costa (:rakuco) 2013-07-08 05:34:24 PDT
CC'ing people who can take a look at the changes to WebCore/WebKit2 and the ports affected by the change.

Since the spec has been changed in an incompatible way, I've changed the API in EFL-WebKit1 accordingly. I'm not sure if I can remove or change existing C API in WK2, so I've just deprecated the existing function there and added another one.

The work in Blink/Chromium is being tracked in <https://codereview.chromium.org/15015006>, <https://codereview.chromium.org/14758008> and <https://codereview.chromium.org/18332015>.
Comment 3 Raphael Kubo da Costa (:rakuco) 2013-08-12 06:57:47 PDT
Ping?
Comment 4 Raphael Kubo da Costa (:rakuco) 2014-02-11 07:28:24 PST
Created attachment 223860 [details]
Patch
Comment 5 Darin Adler 2014-02-11 15:30:16 PST
Comment on attachment 223860 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=223860&action=review

> Source/WebCore/html/HTMLInputElement.cpp:1806
> -    if (!isFileUpload())
> -        return String();
> -
> -    String capture = fastGetAttribute(captureAttr).lower();
> -    if (capture == "camera"
> -        || capture == "camcorder"
> -        || capture == "microphone"
> -        || capture == "filesystem")
> -        return capture;
> -
> -    return "filesystem";
> -}
> +    if (!isFileUpload() || !fastHasAttribute(captureAttr))
> +        return false;
>  
> -void HTMLInputElement::setCapture(const String& value)
> -{
> -    setAttribute(captureAttr, value);
> +    return true;

Coding style wise, the the way to write this is:

    return isFileUpload() && fastHasAttribute(captureAttr);

But getting at capture from the DOM API in JavaScript or other bindings will give true, even if isFileUpload() is false.

If we keep this function, I suggest we name it differently to make it clear it’s not exactly the same as the DOM API function.

> Source/WebCore/html/HTMLInputElement.h:301
> +    bool capture() const;

As I said above, I think it’s not good to have this HTMLInputElement::capture function that returns something different from what calling capture on an HTMLInputElement from JavaScript would give. It should be named differently.
Comment 6 Raphael Kubo da Costa (:rakuco) 2014-02-12 05:32:19 PST
Created attachment 223964 [details]
Patch for landing
Comment 7 Raphael Kubo da Costa (:rakuco) 2014-02-12 05:33:06 PST
Thanks for the suggestion. I've renamed capture() to shouldUseMediaCapture().
Comment 8 Raphael Kubo da Costa (:rakuco) 2014-02-12 06:54:01 PST
Committed r163958: <http://trac.webkit.org/changeset/163958>