Skip to content
  • adamk@chromium.org's avatar
    [MutationObservers] Add stub implementation of WebKitMutationObserver · 136a5cf8
    adamk@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=68949
    
    Reviewed by Ryosuke Niwa, Oliver Hunt, and Dimitri Glazkov.
    
    Source/WebCore:
    
    See https://bugs.webkit.org/show_bug.cgi?id=68729 for the metabug.
    
    This patch adds a stub WebKitMutationObserver and its supporting classes
    MutationCallback and MutationObserverOptions.
    No implementation is provided for the all-important observe() and
    disconnect() methods.
    
    Note that WebKitMutationObserver is vendor-prefixed since it has a
    constructor exposed on DOMWindow.  None of the rest of the API needs
    prefixing, as it's only available via a call through a MutationObserver
    callback (created by instantiating WebKitMutationObserver).
    
    Given the number of files required to get just the stub up and running,
    it seems reasonable to leave the actual implementation for the next
    patch (or more likely several patches).  I've left FIXMEs in all the places
    that'll need augmentation.
    
    Tests: fast/mutation/mutation-observer-constructor.html
           fast/mutation/observe-exceptions.html
    
    * CMakeLists.txt:
    * DerivedSources.cpp:
    * DerivedSources.make:
    * GNUmakefile.list.am:
    * UseJSC.cmake:
    * WebCore.gypi:
    * WebCore.pro:
    * WebCore.vcproj/WebCore.vcproj:
    * WebCore.xcodeproj/project.pbxproj:
    * bindings/js/JSDictionary.h:
    (WebCore::JSDictionary::tryGetProperty):
    * bindings/js/JSMutationCallbackCustom.cpp: Added.
    (WebCore::JSMutationCallback::handleEvent):
    * bindings/js/JSWebKitMutationObserverCustom.cpp: Added.
    (WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver):
    (WebCore::JSWebKitMutationObserver::observe):
    * bindings/v8/custom/V8MutationCallbackCustom.cpp: Added.
    (WebCore::V8MutationCallback::handleEvent):
    * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp: Added.
    (WebCore::V8WebKitMutationObserver::constructorCallback):
    (WebCore::V8WebKitMutationObserver::observeCallback):
    * dom/MutationCallback.h: Added.
    (WebCore::MutationCallback::~MutationCallback):
    * dom/MutationCallback.idl: Added.
    * dom/MutationObserverOptions.h: Added.
    (WebCore::MutationObserverOptions::create):
    (WebCore::MutationObserverOptions::childList):
    (WebCore::MutationObserverOptions::setChildList):
    (WebCore::MutationObserverOptions::attributes):
    (WebCore::MutationObserverOptions::setAttributes):
    (WebCore::MutationObserverOptions::characterData):
    (WebCore::MutationObserverOptions::setCharacterData):
    (WebCore::MutationObserverOptions::subtree):
    (WebCore::MutationObserverOptions::setSubtree):
    (WebCore::MutationObserverOptions::attributeOldValue):
    (WebCore::MutationObserverOptions::setAttributeOldValue):
    (WebCore::MutationObserverOptions::characterDataOldValue):
    (WebCore::MutationObserverOptions::setCharacterDataOldValue):
    (WebCore::MutationObserverOptions::MutationObserverOptions):
    * dom/WebKitMutationObserver.cpp: Added.
    (WebCore::WebKitMutationObserver::create):
    (WebCore::WebKitMutationObserver::WebKitMutationObserver):
    (WebCore::WebKitMutationObserver::~WebKitMutationObserver):
    (WebCore::WebKitMutationObserver::observe):
    (WebCore::WebKitMutationObserver::disconnect):
    * dom/WebKitMutationObserver.h: Added.
    * dom/WebKitMutationObserver.idl: Added.
    * page/DOMWindow.idl:
    
    Source/WebKit/chromium:
    
    * features.gypi: Added 'enable_mutation_observers' variable.
    
    LayoutTests:
    
    Add basic tests and skip them in all ports for now.
    
    * fast/mutation/mutation-observer-constructor-expected.txt: Added.
    * fast/mutation/mutation-observer-constructor.html: Added.
    * fast/mutation/observe-exceptions-expected.txt: Added.
    * fast/mutation/observe-exceptions.html: Added.
    * platform/chromium/test_expectations.txt:
    * platform/gtk/Skipped:
    * platform/mac/Skipped:
    * platform/qt/Skipped:
    * platform/win/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    136a5cf8