Update the HTML Media Capture implementation.
Created attachment 206232 [details]
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>.
Created attachment 223860 [details]
Comment on attachment 223860 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=223860&action=review
> - 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);
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.
> + bool capture() const;
Created attachment 223964 [details]
Patch for landing
Thanks for the suggestion. I've renamed capture() to shouldUseMediaCapture().
Committed r163958: <http://trac.webkit.org/changeset/163958>