Changeset 70047 in webkit


Ignore:
Timestamp:
Oct 19, 2010 4:50:02 AM (14 years ago)
Author:
benm@google.com
Message:

2010-10-19 Ben Murdoch <benm@google.com>

Reviewed by Steve Block.

Missing support for document.createTouch and document.createTouchList
https://bugs.webkit.org/show_bug.cgi?id=47676

Add tests to verify the presence of the APIs and that they work correctly.

  • fast/events/touch/document-create-touch-expected.txt: Added.
  • fast/events/touch/document-create-touch-list-expected.txt: Added.
  • fast/events/touch/document-create-touch-list.html: Added.
  • fast/events/touch/document-create-touch.html: Added.
  • fast/events/touch/script-tests/document-create-touch-list.js: Added.
  • fast/events/touch/script-tests/document-create-touch.js: Added.

2010-10-19 Ben Murdoch <benm@google.com>

Reviewed by Steve Block.

Missing support for document.createTouch and document.createTouchList
https://bugs.webkit.org/show_bug.cgi?id=47676

These APIs are used by many sites to detect support for touch events.

Implement the APIs according to the documentation at:
http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html

Tests: fast/events/touch/document-create-touch-list.html

fast/events/touch/document-create-touch.html

  • bindings/js/JSBindingsAllInOne.cpp: Add new files to list.
  • bindings/js/JSTouchCustom.cpp: Added. (WebCore::toJSNewlyCreated):
  • bindings/js/JSTouchListCustom.cpp: Added. (WebCore::toJSNewlyCreated):
  • bindings/scripts/CodeGeneratorJS.pm:
  • dom/Document.cpp: (WebCore::Document::createTouch): (WebCore::Document::createTouchList):
  • dom/Document.h:
  • dom/Document.idl: Add createTouch and createTouchList functions.
  • Android.jscbindings.mk: Update makefiles.
  • CMakeLists.txt: Ditto.
  • GNUmakefile.am: Ditto.
  • WebCore.gypi: Ditto.
  • WebCore.pro: Ditto.
Location:
trunk
Files:
8 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70040 r70047  
     12010-10-19  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Steve Block.
     4
     5        Missing support for document.createTouch and document.createTouchList
     6        https://bugs.webkit.org/show_bug.cgi?id=47676
     7
     8        Add tests to verify the presence of the APIs and that they work correctly.
     9
     10        * fast/events/touch/document-create-touch-expected.txt: Added.
     11        * fast/events/touch/document-create-touch-list-expected.txt: Added.
     12        * fast/events/touch/document-create-touch-list.html: Added.
     13        * fast/events/touch/document-create-touch.html: Added.
     14        * fast/events/touch/script-tests/document-create-touch-list.js: Added.
     15        * fast/events/touch/script-tests/document-create-touch.js: Added.
     16
    1172010-10-19  Hayato Ito  <hayato@chromium.org>
    218
  • trunk/WebCore/Android.jscbindings.mk

    r68440 r70047  
    152152        bindings/js/JSStyleSheetListCustom.cpp \
    153153        bindings/js/JSTextCustom.cpp \
     154        bindings/js/JSTouchCustom.cpp \
     155        bindings/js/JSTouchListCustom.cpp \
    154156        bindings/js/JSTreeWalkerCustom.cpp \
    155157        bindings/js/JSWebKitCSSMatrixCustom.cpp \
  • trunk/WebCore/CMakeLists.txt

    r69968 r70047  
    671671    bindings/js/JSStyleSheetListCustom.cpp
    672672    bindings/js/JSTextCustom.cpp
     673    bindings/js/JSTouchCustom.cpp
     674    bindings/js/JSTouchListCustom.cpp
    673675    bindings/js/JSTreeWalkerCustom.cpp
    674676    bindings/js/JSWebKitCSSMatrixCustom.cpp
  • trunk/WebCore/ChangeLog

    r70046 r70047  
     12010-10-19  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Steve Block.
     4
     5        Missing support for document.createTouch and document.createTouchList
     6        https://bugs.webkit.org/show_bug.cgi?id=47676
     7
     8        These APIs are used by many sites to detect support for touch events.
     9
     10        Implement the APIs according to the documentation at:
     11        http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
     12
     13        Tests: fast/events/touch/document-create-touch-list.html
     14               fast/events/touch/document-create-touch.html
     15
     16        * bindings/js/JSBindingsAllInOne.cpp: Add new files to list.
     17        * bindings/js/JSTouchCustom.cpp: Added.
     18        (WebCore::toJSNewlyCreated):
     19        * bindings/js/JSTouchListCustom.cpp: Added.
     20        (WebCore::toJSNewlyCreated):
     21        * bindings/scripts/CodeGeneratorJS.pm:
     22        * dom/Document.cpp:
     23        (WebCore::Document::createTouch):
     24        (WebCore::Document::createTouchList):
     25        * dom/Document.h:
     26        * dom/Document.idl: Add createTouch and createTouchList functions.
     27        * Android.jscbindings.mk: Update makefiles.
     28        * CMakeLists.txt: Ditto.
     29        * GNUmakefile.am: Ditto.
     30        * WebCore.gypi: Ditto.
     31        * WebCore.pro: Ditto.
     32
     33
    1342010-10-19  Pavel Feldman  <pfeldman@chromium.org>
    235
  • trunk/WebCore/GNUmakefile.am

    r70033 r70047  
    797797        WebCore/bindings/js/JSSVGPODTypeWrapper.h \
    798798        WebCore/bindings/js/JSTextCustom.cpp \
     799        WebCore/bindings/js/JSTouchCustom.cpp \
     800        WebCore/bindings/js/JSTouchListCustom.cpp \
    799801        WebCore/bindings/js/JSTreeWalkerCustom.cpp \
    800802        WebCore/bindings/js/JSWebKitCSSMatrixCustom.cpp \
  • trunk/WebCore/WebCore.gypi

    r69968 r70047  
    679679            'bindings/js/JSSVGPODTypeWrapper.h',
    680680            'bindings/js/JSTextCustom.cpp',
     681            'bindings/js/JSTouchCustom.cpp',
     682            'bindings/js/JSTouchListCustom.cpp',
    681683            'bindings/js/JSTreeWalkerCustom.cpp',
    682684            'bindings/js/JSWebKitCSSMatrixCustom.cpp',
  • trunk/WebCore/WebCore.pro

    r69968 r70047  
    552552        bindings/js/JSStyleSheetListCustom.cpp \
    553553        bindings/js/JSTextCustom.cpp \
     554        bindings/js/JSTouchCustom.cpp \
     555        bindings/js/JSTouchListCustom.cpp \
    554556        bindings/js/JSTreeWalkerCustom.cpp \
    555557        bindings/js/JSWebKitCSSMatrixCustom.cpp \
  • trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r67167 r70047  
    125125#include "JSStyleSheetListCustom.cpp"
    126126#include "JSTextCustom.cpp"
     127#include "JSTouchCustom.cpp"
     128#include "JSTouchListCustom.cpp"
    127129#include "JSTreeWalkerCustom.cpp"
    128130#include "JSWebKitCSSMatrixCustom.cpp"
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r69553 r70047  
    611611}
    612612
     613my %usesToJSNewlyCreated = (
     614    "CDATASection" => 1,
     615    "Element" => 1,
     616    "Node" => 1,
     617    "Text" => 1,
     618    "Touch" => 1,
     619    "TouchList" => 1
     620);
     621
    613622sub GenerateHeader
    614623{
     
    944953        }
    945954    }
    946     if ($interfaceName eq "Node" or $interfaceName eq "Element" or $interfaceName eq "Text" or $interfaceName eq "CDATASection") {
     955    if ($usesToJSNewlyCreated{$interfaceName}) {
    947956        push(@headerContent, "JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, $interfaceName*);\n");
    948957    }
  • trunk/WebCore/dom/Document.cpp

    r69984 r70047  
    47744774}
    47754775
     4776#if ENABLE(TOUCH_EVENTS)
     4777PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const
     4778{
     4779    // FIXME: It's not clear from the documentation at
     4780    // http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html
     4781    // when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS
     4782    // and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819
     4783    // Ditto for the createTouchList method below.
     4784    Frame* frame = window ? window->frame() : this->frame();
     4785    return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY);
     4786}
     4787
     4788PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
     4789{
     4790    return TouchList::create();
     4791}
     4792#endif
     4793
    47764794} // namespace WebCore
  • trunk/WebCore/dom/Document.h

    r69710 r70047  
    137137#endif
    138138
     139#if ENABLE(TOUCH_EVENTS)
     140class Touch;
     141class TouchList;
     142#endif
     143
    139144typedef int ExceptionCode;
    140145
     
    10341039    bool isDelayingLoadEvent() const { return m_loadEventDelayCount; }
    10351040
     1041#if ENABLE(TOUCH_EVENTS)
     1042    PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const;
     1043    PassRefPtr<TouchList> createTouchList(ExceptionCode&) const;
     1044#endif
     1045
    10361046protected:
    10371047    Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
  • trunk/WebCore/dom/Document.idl

    r69710 r70047  
    325325#endif
    326326
     327#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
     328        [ReturnsNew] Touch createTouch(in DOMWindow window,
     329                                       in EventTarget target,
     330                                       in long identifier,
     331                                       in long pageX,
     332                                       in long pageY,
     333                                       in long ScreenX,
     334                                       in long screenY)
     335            raises (DOMException);
     336        [ReturnsNew] TouchList createTouchList()
     337            raises (DOMException);
     338#endif
     339
    327340#if defined(LANGUAGE_CPP) && LANGUAGE_CPP
    328341        // Extra WebCore methods exposed to allow compile-time casting in C++
Note: See TracChangeset for help on using the changeset viewer.