Title: [116592] trunk
Revision
116592
Author
[email protected]
Date
2012-05-09 18:21:14 -0700 (Wed, 09 May 2012)

Log Message

Implement HTML Media Capture
https://bugs.webkit.org/show_bug.cgi?id=85958

Reviewed by Eric Seidel.

Source/WebCore:

This patch begins the implementation of
http://www.w3.org/TR/html-media-capture/ by adding the capture
attribute to HTMLInputElement.

Test: fast/forms/file/file-input-capture.html

* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
* html/HTMLAttributeNames.in:
* html/HTMLInputElement.cpp:
(WebCore):
(WebCore::HTMLInputElement::capture):
(WebCore::HTMLInputElement::setCapture):
* html/HTMLInputElement.h:
(HTMLInputElement):
* html/HTMLInputElement.idl:
* platform/FileChooser.h:
(FileChooserSettings):

Source/WebKit/chromium:

* features.gypi:
* public/WebFileChooserParams.h:
(WebFileChooserParams):
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::runOpenPanel):

LayoutTests:

* fast/forms/file/file-input-capture-expected.txt: Added.
* fast/forms/file/file-input-capture.html: Added.
    - Test that the capture attribute works properly.
* platform/chromium/test_expectations.txt:
* platform/efl/Skipped:
* platform/gtk/test_expectations.txt:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
    - Skip the test on all platforms. The feature is enabled only on
      Android, which isn't yet able to run LayoutTests upstream.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (116591 => 116592)


--- trunk/LayoutTests/ChangeLog	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/ChangeLog	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1,3 +1,22 @@
+2012-05-09  Adam Barth  <[email protected]>
+
+        Implement HTML Media Capture
+        https://bugs.webkit.org/show_bug.cgi?id=85958
+
+        Reviewed by Eric Seidel.
+
+        * fast/forms/file/file-input-capture-expected.txt: Added.
+        * fast/forms/file/file-input-capture.html: Added.
+            - Test that the capture attribute works properly.
+        * platform/chromium/test_expectations.txt:
+        * platform/efl/Skipped:
+        * platform/gtk/test_expectations.txt:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+            - Skip the test on all platforms. The feature is enabled only on
+              Android, which isn't yet able to run LayoutTests upstream.
+
 2012-05-09  Tony Gentilcore  <[email protected]>
 
         Subresources loaded after a reload completes shouldn't be revalidated.

Added: trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt (0 => 116592)


--- trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-input-capture-expected.txt	2012-05-10 01:21:14 UTC (rev 116592)
@@ -0,0 +1,18 @@
+Tests the capture attribute of <input type='file'>
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/forms/file/file-input-capture.html (0 => 116592)


--- trunk/LayoutTests/fast/forms/file/file-input-capture.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/file-input-capture.html	2012-05-10 01:21:14 UTC (rev 116592)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+description("Tests the capture attribute of &lt;input type='file'&gt;");
+
+var input = document.createElement("input");
+
+shouldBeTrue("'capture' in input");
+shouldBe("input.capture", "''");
+
+input.setAttribute("type", "file");
+
+shouldBe("input.capture", "'filesystem'");
+
+input.setAttribute("capture", "CaMerA");
+shouldBe("input.capture", "'camera'");
+
+input.setAttribute("capture", "camcorder");
+shouldBe("input.capture", "'camcorder'");
+
+input.setAttribute("capture", "MiCroPhonE");
+shouldBe("input.capture", "'microphone'");
+
+input.setAttribute("capture", "xyzzy");
+shouldBe("input.capture", "'filesystem'");
+
+input.capture = "CamCorder";
+shouldBe("input.capture", "'camcorder'");
+shouldBe("input.getAttribute('capture')", "'CamCorder'");
+
+</script>
+<script src=""
+</html>

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (116591 => 116592)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-05-10 01:21:14 UTC (rev 116592)
@@ -3929,6 +3929,9 @@
 
 BUGWK85951 WIN DEBUG : fast/css/hover-update.html = TEXT PASS
 
+// Requires ENABLE(MEDIA_CAPTURE)
+BUGWK85958 : fast/forms/file/file-input-capture.html = TEXT
+
 BUGWK85952 MAC WIN : http/tests/media/media-source/webm/video-media-source-play.html = PASS TIMEOUT
 BUGWK85952 WIN : http/tests/media/media-source/webm/video-media-source-seek.html = PASS TIMEOUT
 BUGWK85952 WIN : http/tests/media/media-source/webm/video-media-source-state-changes.html = PASS TIMEOUT

Modified: trunk/LayoutTests/platform/efl/Skipped (116591 => 116592)


--- trunk/LayoutTests/platform/efl/Skipped	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1941,6 +1941,9 @@
 # This test requires flac codec
 media/media-can-play-flac-audio.html
 
+# Requires ENABLE(MEDIA_CAPTURE)
+fast/forms/file/file-input-capture.html
+
 # The inner <input> should now grow to take the full cell's height.
 fast/table/colspanMinWidth-vertical.html
 

Modified: trunk/LayoutTests/platform/gtk/test_expectations.txt (116591 => 116592)


--- trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1328,6 +1328,9 @@
 BUGWK84777 : ietestcenter/css3/multicolumn/column-width-applies-to-015.htm = IMAGE
 BUGWK84778 : ietestcenter/css3/multicolumn/column-width-negative-001.htm = IMAGE
 
+// Requires ENABLE(MEDIA_CAPTURE)
+BUGWK85958 : fast/forms/file/file-input-capture.html = TEXT
+
 // Generate results for your platform(s)
 BUGWK85567 : fast/images/png-suite/test.html = IMAGE
 

Modified: trunk/LayoutTests/platform/mac/Skipped (116591 => 116592)


--- trunk/LayoutTests/platform/mac/Skipped	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/mac/Skipped	2012-05-10 01:21:14 UTC (rev 116592)
@@ -815,6 +815,9 @@
 # https://bugs.webkit.org/show_bug.cgi?id=84357
 media/audio-repaint.html
 
+# Requires ENABLE(MEDIA_CAPTURE)
+fast/forms/file/file-input-capture.html
+
 # https://bugs.webkit.org/show_bug.cgi?id=85522
 http/tests/security/sandboxed-iframe-modify-self.html
 

Modified: trunk/LayoutTests/platform/qt/Skipped (116591 => 116592)


--- trunk/LayoutTests/platform/qt/Skipped	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-05-10 01:21:14 UTC (rev 116592)
@@ -2528,6 +2528,9 @@
 # REGRESSION(r115379) - https://bugs.webkit.org/show_bug.cgi?id=85004
 http/tests/inspector/network/network-initiator.html
 
+# Requires ENABLE(MEDIA_CAPTURE)
+fast/forms/file/file-input-capture.html
+
 # [Qt] ietestcenter/css3/flexbox tests fail on 32 bit
 # https://bugs.webkit.org/show_bug.cgi?id=85596
 ietestcenter/css3/flexbox/flexbox-align-end-001.htm

Modified: trunk/LayoutTests/platform/win/Skipped (116591 => 116592)


--- trunk/LayoutTests/platform/win/Skipped	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/LayoutTests/platform/win/Skipped	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1718,6 +1718,9 @@
 # The inner <input> should now grow to take the full cell's height.
 fast/table/colspanMinWidth-vertical.html
 
+# Requires ENABLE(MEDIA_CAPTURE)
+fast/forms/file/file-input-capture.html
+
 # This should only be a layer change.
 # http://webkit.org/b/82129
 fast/box-shadow/shadow-buffer-partial.html

Modified: trunk/Source/WebCore/ChangeLog (116591 => 116592)


--- trunk/Source/WebCore/ChangeLog	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/ChangeLog	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1,3 +1,29 @@
+2012-05-09  Adam Barth  <[email protected]>
+
+        Implement HTML Media Capture
+        https://bugs.webkit.org/show_bug.cgi?id=85958
+
+        Reviewed by Eric Seidel.
+
+        This patch begins the implementation of
+        http://www.w3.org/TR/html-media-capture/ by adding the capture
+        attribute to HTMLInputElement.
+
+        Test: fast/forms/file/file-input-capture.html
+
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        * html/HTMLAttributeNames.in:
+        * html/HTMLInputElement.cpp:
+        (WebCore):
+        (WebCore::HTMLInputElement::capture):
+        (WebCore::HTMLInputElement::setCapture):
+        * html/HTMLInputElement.h:
+        (HTMLInputElement):
+        * html/HTMLInputElement.idl:
+        * platform/FileChooser.h:
+        (FileChooserSettings):
+
 2012-05-09  Charles Wei  <[email protected]>
 
         [BlackBerry]  Refactor data scheme support

Modified: trunk/Source/WebCore/html/FileInputType.cpp (116591 => 116592)


--- trunk/Source/WebCore/html/FileInputType.cpp	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/html/FileInputType.cpp	2012-05-10 01:21:14 UTC (rev 116592)
@@ -188,6 +188,9 @@
 #endif
         settings.acceptMIMETypes = input->acceptMIMETypes();
         settings.selectedFiles = m_fileList->paths();
+#if ENABLE(MEDIA_CAPTURE)
+        settings.capture = input->capture();
+#endif
         chrome->runOpenPanel(input->document()->frame(), newFileChooser(settings));
     }
     event->setDefaultHandled();

Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (116591 => 116592)


--- trunk/Source/WebCore/html/HTMLAttributeNames.in	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in	2012-05-10 01:21:14 UTC (rev 116592)
@@ -58,6 +58,7 @@
 bgproperties
 border
 bordercolor
+capture
 cellpadding
 cellspacing
 char

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (116591 => 116592)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1837,6 +1837,29 @@
     return m_inputType->supportsIndeterminateAppearance() && indeterminate();
 }
 
+#if ENABLE(MEDIA_CAPTURE)
+String HTMLInputElement::capture() const
+{
+    if (!isFileUpload())
+        return String();
+
+    String capture = fastGetAttribute(captureAttr).lower();
+    if (capture == "camera"
+        || capture == "camcorder"
+        || capture == "microphone"
+        || capture == "filesystem")
+        return capture;
+
+    return "filesystem";
+}
+
+void HTMLInputElement::setCapture(const String& value)
+{
+    setAttribute(captureAttr, value);
+}
+
+#endif
+
 bool HTMLInputElement::isInRequiredRadioButtonGroup() const
 {
     ASSERT(isRadioButton());

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (116591 => 116592)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2012-05-10 01:21:14 UTC (rev 116592)
@@ -241,6 +241,11 @@
 
     String defaultToolTip() const;
 
+#if ENABLE(MEDIA_CAPTURE)
+    String capture() const;
+    void setCapture(const String& value);
+#endif
+
     static const int maximumLength;
 
     unsigned height() const;

Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (116591 => 116592)


--- trunk/Source/WebCore/html/HTMLInputElement.idl	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl	2012-05-10 01:21:14 UTC (rev 116592)
@@ -115,5 +115,7 @@
         readonly attribute URL absoluteImageURL;
 #endif
 
+        // See http://www.w3.org/TR/html-media-capture/
+        attribute [Conditional=MEDIA_CAPTURE] DOMString capture;
     };
 }

Modified: trunk/Source/WebCore/platform/FileChooser.h (116591 => 116592)


--- trunk/Source/WebCore/platform/FileChooser.h	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebCore/platform/FileChooser.h	2012-05-10 01:21:14 UTC (rev 116592)
@@ -56,6 +56,9 @@
 #endif
     Vector<String> acceptMIMETypes;
     Vector<String> selectedFiles;
+#if ENABLE(MEDIA_CAPTURE)
+    String capture;
+#endif
 };
 
 class FileChooserClient {

Modified: trunk/Source/WebKit/chromium/ChangeLog (116591 => 116592)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-10 01:21:14 UTC (rev 116592)
@@ -1,3 +1,16 @@
+2012-05-09  Adam Barth  <[email protected]>
+
+        Implement HTML Media Capture
+        https://bugs.webkit.org/show_bug.cgi?id=85958
+
+        Reviewed by Eric Seidel.
+
+        * features.gypi:
+        * public/WebFileChooserParams.h:
+        (WebFileChooserParams):
+        * src/ChromeClientImpl.cpp:
+        (WebKit::ChromeClientImpl::runOpenPanel):
+
 2012-05-09  Dana Jansens  <[email protected]>
 
         [chromium] Don't draw when canDraw() is false

Modified: trunk/Source/WebKit/chromium/features.gypi (116591 => 116592)


--- trunk/Source/WebKit/chromium/features.gypi	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebKit/chromium/features.gypi	2012-05-10 01:21:14 UTC (rev 116592)
@@ -71,6 +71,7 @@
       'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1',
       'ENABLE_LINK_PREFETCH=1',
       'ENABLE_LINK_PRERENDER=1',
+      'ENABLE_MEDIA_CAPTURE=0',
       'ENABLE_MEDIA_SOURCE=1',
       'ENABLE_MEDIA_STATISTICS=1',
       'ENABLE_MEDIA_STREAM=1',
@@ -139,6 +140,7 @@
       ['OS=="android"', {
         'feature_defines': [
           'ENABLE_CALENDAR_PICKER=0',
+          'ENABLE_MEDIA_CAPTURE=1',
           'ENABLE_PAGE_POPUP=0',
           'ENABLE_WEB_AUDIO=0',
           'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1',

Modified: trunk/Source/WebKit/chromium/public/WebFileChooserParams.h (116591 => 116592)


--- trunk/Source/WebKit/chromium/public/WebFileChooserParams.h	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebKit/chromium/public/WebFileChooserParams.h	2012-05-10 01:21:14 UTC (rev 116592)
@@ -62,6 +62,14 @@
     //  - replacing with other files
     // before opening a file chooser dialog.
     WebVector<WebString> selectedFiles;
+    // See http://www.w3.org/TR/html-media-capture/ for the semantics of the
+    // capture attribute. This string will either be empty (meaning the feature
+    // is disabled) or one of the following values:
+    //  - filesystem (default)
+    //  - camera
+    //  - camcorder
+    //  - microphone
+    WebString capture;
 
     WebFileChooserParams()
         : multiSelect(false)

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (116591 => 116592)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-05-10 01:13:35 UTC (rev 116591)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-05-10 01:21:14 UTC (rev 116592)
@@ -738,6 +738,11 @@
     params.selectedFiles = fileChooser->settings().selectedFiles;
     if (params.selectedFiles.size() > 0)
         params.initialValue = params.selectedFiles[0];
+#if ENABLE(MEDIA_CAPTURE)
+    params.capture = fileChooser->settings().capture;
+#else
+    params.capture = WebString();
+#endif
     WebFileChooserCompletionImpl* chooserCompletion =
         new WebFileChooserCompletionImpl(fileChooser);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to