Changeset 202559 in webkit


Ignore:
Timestamp:
Jun 28, 2016 4:49:21 AM (8 years ago)
Author:
pvollan@apple.com
Message:

[Win] Custom elements tests are failing.
https://bugs.webkit.org/show_bug.cgi?id=159139

Reviewed by Alex Christensen.

.:

Enable custom element API on Windows.

  • Source/cmake/OptionsWin.cmake:

Source/WebCore:

Fix compile errors after enabling custom element API.

  • bindings/js/JSHTMLElementCustom.cpp:

(WebCore::constructJSHTMLElement):

  • dom/CustomElementDefinitions.cpp:

(WebCore::CustomElementDefinitions::addElementDefinition):

  • dom/Document.cpp:

(WebCore::createHTMLElementWithNameValidation):
(WebCore::createFallbackHTMLElement):

  • dom/Element.cpp:

(WebCore::Element::attributeChanged):

  • dom/LifecycleCallbackQueue.cpp:

(WebCore::LifecycleQueueItem::LifecycleQueueItem):
(WebCore::LifecycleCallbackQueue::enqueueElementUpgrade):
(WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallback):

  • html/parser/HTMLConstructionSite.cpp:

(WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):

  • html/parser/HTMLDocumentParser.cpp:

(WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::CustomElementConstructionData::CustomElementConstructionData):
(WebCore::HTMLTreeBuilder::insertGenericHTMLElement):

  • html/parser/HTMLTreeBuilder.h:

Source/WebKit/win:

Add preference for enabling custom element API.

  • Interfaces/IWebPreferencesPrivate.idl:
  • WebPreferenceKeysPrivate.h:
  • WebPreferences.cpp:

(WebPreferences::initializeDefaultSettings):
(WebPreferences::customElementsEnabled):
(WebPreferences::setCustomElementsEnabled):

  • WebPreferences.h:
  • WebView.cpp:

(WebView::notifyPreferencesChanged):

Tools:

Enable custom element API when running tests.

  • DumpRenderTree/win/DumpRenderTree.cpp:

(resetWebPreferencesToConsistentValues):

LayoutTests:

Update test expectations for passing custom elements tests.

  • platform/win/TestExpectations:
Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r202372 r202559  
     12016-06-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Win] Custom elements tests are failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=159139
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable custom element API on Windows.
     9 
     10        * Source/cmake/OptionsWin.cmake:
     11
    1122016-06-23  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/LayoutTests/ChangeLog

    r202557 r202559  
     12016-06-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Win] Custom elements tests are failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=159139
     5
     6        Reviewed by Alex Christensen.
     7
     8        Update test expectations for passing custom elements tests.
     9
     10        * platform/win/TestExpectations:
     11
    1122016-06-28  Philippe Normand  <pnormand@igalia.com>
    213
  • trunk/LayoutTests/platform/win/TestExpectations

    r202489 r202559  
    33193319webkit.org/b/152411 http/tests/contentdispositionattachmentsandbox/referer-header-stripped.html [ Failure ]
    33203320
     3321webkit.org/b/150225 fast/custom-elements [ Pass ]
     3322
    33213323webkit.org/b/148695 fast/shadow-dom [ Pass ]
    33223324
  • trunk/Source/WebCore/ChangeLog

    r202558 r202559  
     12016-06-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Win] Custom elements tests are failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=159139
     5
     6        Reviewed by Alex Christensen.
     7
     8        Fix compile errors after enabling custom element API.
     9
     10        * bindings/js/JSHTMLElementCustom.cpp:
     11        (WebCore::constructJSHTMLElement):
     12        * dom/CustomElementDefinitions.cpp:
     13        (WebCore::CustomElementDefinitions::addElementDefinition):
     14        * dom/Document.cpp:
     15        (WebCore::createHTMLElementWithNameValidation):
     16        (WebCore::createFallbackHTMLElement):
     17        * dom/Element.cpp:
     18        (WebCore::Element::attributeChanged):
     19        * dom/LifecycleCallbackQueue.cpp:
     20        (WebCore::LifecycleQueueItem::LifecycleQueueItem):
     21        (WebCore::LifecycleCallbackQueue::enqueueElementUpgrade):
     22        (WebCore::LifecycleCallbackQueue::enqueueAttributeChangedCallback):
     23        * html/parser/HTMLConstructionSite.cpp:
     24        (WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
     25        (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
     26        * html/parser/HTMLDocumentParser.cpp:
     27        (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
     28        * html/parser/HTMLTreeBuilder.cpp:
     29        (WebCore::CustomElementConstructionData::CustomElementConstructionData):
     30        (WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
     31        * html/parser/HTMLTreeBuilder.h:
     32
    1332016-06-28  Philippe Normand  <pnormand@igalia.com>
    234
  • trunk/Source/WebCore/bindings/js/JSHTMLElementCustom.cpp

    r200775 r202559  
    5555    JSValue newTargetValue = state->thisValue();
    5656    JSObject* newTarget = newTargetValue.getObject();
    57     auto* interface = definitions->findInterface(newTarget);
    58     if (!interface)
     57    auto* elementInterface = definitions->findInterface(newTarget);
     58    if (!elementInterface)
    5959        return throwVMTypeError(state, "new.target does not define a custom element");
    6060
    61     if (!interface->isUpgradingElement()) {
     61    if (!elementInterface->isUpgradingElement()) {
    6262        auto* globalObject = jsConstructor->globalObject();
    6363        Structure* baseStructure = getDOMStructure<JSHTMLElement>(vm, *globalObject);
     
    6666            return JSValue::encode(jsUndefined());
    6767
    68         Ref<HTMLElement> element = HTMLElement::create(interface->name(), document);
     68        Ref<HTMLElement> element = HTMLElement::create(elementInterface->name(), document);
    6969        element->setIsUnresolvedCustomElement();
    7070        auto* jsElement = JSHTMLElement::create(newElementStructure, globalObject, element.get());
     
    7373    }
    7474
    75     Element* elementToUpgrade = interface->lastElementInConstructionStack();
     75    Element* elementToUpgrade = elementInterface->lastElementInConstructionStack();
    7676    if (!elementToUpgrade) {
    7777        throwInvalidStateError(*state, "Cannot instantiate a custom element inside its own constrcutor during upgrades");
     
    9191        return JSValue::encode(jsUndefined());
    9292
    93     interface->didUpgradeLastElementInConstructionStack();
     93    elementInterface->didUpgradeLastElementInConstructionStack();
    9494
    9595    return JSValue::encode(elementWrapperValue);
  • trunk/Source/WebCore/dom/CustomElementDefinitions.cpp

    r201739 r202559  
    4040namespace WebCore {
    4141
    42 void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface>&& interface)
     42void CustomElementDefinitions::addElementDefinition(Ref<JSCustomElementInterface>&& elementInterface)
    4343{
    44     AtomicString localName = interface->name().localName();
     44    AtomicString localName = elementInterface->name().localName();
    4545    ASSERT(!m_nameMap.contains(localName));
    46     m_constructorMap.add(interface->constructor(), interface.ptr());
    47     m_nameMap.add(localName, interface.copyRef());
     46    m_constructorMap.add(elementInterface->constructor(), elementInterface.ptr());
     47    m_nameMap.add(localName, elementInterface.copyRef());
    4848
    4949    auto candidateList = m_upgradeCandidatesMap.find(localName);
     
    5757    for (auto& candidate : list) {
    5858        ASSERT(candidate);
    59         interface->upgradeElement(*candidate);
     59        elementInterface->upgradeElement(*candidate);
    6060    }
    6161
  • trunk/Source/WebCore/dom/Document.cpp

    r202537 r202559  
    884884    auto* definitions = document.customElementDefinitions();
    885885    if (UNLIKELY(definitions)) {
    886         if (auto* interface = definitions->findInterface(localName))
    887             return interface->constructElement(localName, JSCustomElementInterface::ShouldClearException::DoNotClear);
     886        if (auto* elementInterface = definitions->findInterface(localName))
     887            return elementInterface->constructElement(localName, JSCustomElementInterface::ShouldClearException::DoNotClear);
    888888    }
    889889#endif
     
    10751075    auto* definitions = document.customElementDefinitions();
    10761076    if (UNLIKELY(definitions)) {
    1077         if (auto* interface = definitions->findInterface(name)) {
     1077        if (auto* elementInterface = definitions->findInterface(name)) {
    10781078            Ref<HTMLElement> element = HTMLElement::create(name, document);
    10791079            element->setIsUnresolvedCustomElement();
    1080             LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *interface);
     1080            LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *elementInterface);
    10811081            return element;
    10821082        }
  • trunk/Source/WebCore/dom/Element.cpp

    r202517 r202559  
    12811281    if (UNLIKELY(isCustomElement())) {
    12821282        auto* definitions = document().customElementDefinitions();
    1283         auto* interface = definitions->findInterface(tagQName());
    1284         RELEASE_ASSERT(interface);
    1285         LifecycleCallbackQueue::enqueueAttributeChangedCallback(*this, *interface, name, oldValue, newValue);
     1283        auto* elementInterface = definitions->findInterface(tagQName());
     1284        RELEASE_ASSERT(elementInterface);
     1285        LifecycleCallbackQueue::enqueueAttributeChangedCallback(*this, *elementInterface, name, oldValue, newValue);
    12861286    }
    12871287#endif
  • trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp

    r197634 r202559  
    4646    };
    4747
    48     LifecycleQueueItem(Type type, Element& element, JSCustomElementInterface& interface)
     48    LifecycleQueueItem(Type type, Element& element, JSCustomElementInterface& elementInterface)
    4949        : m_type(type)
    5050        , m_element(element)
    51         , m_interface(interface)
     51        , m_interface(elementInterface)
    5252    { }
    5353
    54     LifecycleQueueItem(Element& element, JSCustomElementInterface& interface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
     54    LifecycleQueueItem(Element& element, JSCustomElementInterface& elementInterface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
    5555        : m_type(Type::AttributeChanged)
    5656        , m_element(element)
    57         , m_interface(interface)
     57        , m_interface(elementInterface)
    5858        , m_attributeName(attributeName)
    5959        , m_oldValue(oldValue)
     
    9191}
    9292
    93 void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& interface)
     93void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
    9494{
    9595    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
    96         queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, interface));
     96        queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, elementInterface));
    9797}
    9898
    99 void LifecycleCallbackQueue::enqueueAttributeChangedCallback(Element& element, JSCustomElementInterface& interface,
     99void LifecycleCallbackQueue::enqueueAttributeChangedCallback(Element& element, JSCustomElementInterface& elementInterface,
    100100    const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
    101101{
    102102    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
    103         queue->m_items.append(LifecycleQueueItem(element, interface, attributeName, oldValue, newValue));
     103        queue->m_items.append(LifecycleQueueItem(element, elementInterface, attributeName, oldValue, newValue));
    104104}
    105105
  • trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp

    r201739 r202559  
    483483JSCustomElementInterface* HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface(AtomicHTMLToken& token)
    484484{
    485     JSCustomElementInterface* interface = nullptr;
    486     RefPtr<Element> element = createHTMLElementOrFindCustomElementInterface(token, &interface);
    487     if (UNLIKELY(interface))
    488         return interface;
     485    JSCustomElementInterface* elementInterface = nullptr;
     486    RefPtr<Element> element = createHTMLElementOrFindCustomElementInterface(token, &elementInterface);
     487    if (UNLIKELY(elementInterface))
     488        return elementInterface;
    489489    attachLater(currentNode(), *element);
    490490    m_openElements.push(HTMLStackItem::create(element.releaseNonNull(), token));
     
    662662            auto* definitions = ownerDocument.customElementDefinitions();
    663663            if (UNLIKELY(definitions)) {
    664                 if (auto* interface = definitions->findInterface(localName)) {
    665                     *customElementInterface = interface;
     664                if (auto* elementInterface = definitions->findInterface(localName)) {
     665                    *customElementInterface = elementInterface;
    666666                    return nullptr;
    667667                }
  • trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp

    r202242 r202559  
    195195        ASSERT(!m_treeBuilder->hasParserBlockingScriptWork());
    196196
    197         RefPtr<Element> newElement = constructionData->interface->constructElement(constructionData->name, JSCustomElementInterface::ShouldClearException::Clear);
     197        RefPtr<Element> newElement = constructionData->elementInterface->constructElement(constructionData->name, JSCustomElementInterface::ShouldClearException::Clear);
    198198        if (!newElement) {
    199199            ASSERT(!m_treeBuilder->isParsingTemplateContents());
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r201205 r202559  
    5656#if ENABLE(CUSTOM_ELEMENTS)
    5757
    58 CustomElementConstructionData::CustomElementConstructionData(Ref<JSCustomElementInterface>&& interface, const AtomicString& name, const Vector<Attribute>& attributes)
    59     : interface(WTFMove(interface))
     58CustomElementConstructionData::CustomElementConstructionData(Ref<JSCustomElementInterface>&& customElementInterface, const AtomicString& name, const Vector<Attribute>& attributes)
     59    : elementInterface(WTFMove(customElementInterface))
    6060    , name(name)
    6161    , attributes(attributes) // FIXME: Avoid copying attributes.
     
    910910{
    911911#if ENABLE(CUSTOM_ELEMENTS)
    912     auto* interface = m_tree.insertHTMLElementOrFindCustomElementInterface(token);
    913     if (UNLIKELY(interface))
    914         m_customElementToConstruct = std::make_unique<CustomElementConstructionData>(*interface, token.name(), token.attributes());
     912    auto* elementInterface = m_tree.insertHTMLElementOrFindCustomElementInterface(token);
     913    if (UNLIKELY(elementInterface))
     914        m_customElementToConstruct = std::make_unique<CustomElementConstructionData>(*elementInterface, token.name(), token.attributes());
    915915#else
    916916    m_tree.insertHTMLElement(token);
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.h

    r200075 r202559  
    4343    ~CustomElementConstructionData();
    4444
    45     Ref<JSCustomElementInterface> interface;
     45    Ref<JSCustomElementInterface> elementInterface;
    4646    AtomicString name;
    4747    Vector<Attribute> attributes;
  • trunk/Source/WebKit/win/ChangeLog

    r202417 r202559  
     12016-06-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Win] Custom elements tests are failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=159139
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add preference for enabling custom element API.
     9
     10        * Interfaces/IWebPreferencesPrivate.idl:
     11        * WebPreferenceKeysPrivate.h:
     12        * WebPreferences.cpp:
     13        (WebPreferences::initializeDefaultSettings):
     14        (WebPreferences::customElementsEnabled):
     15        (WebPreferences::setCustomElementsEnabled):
     16        * WebPreferences.h:
     17        * WebView.cpp:
     18        (WebView::notifyPreferencesChanged):
     19
    1202016-06-23  Per Arne Vollan  <pvollan@apple.com>
    221
  • trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r201817 r202559  
    180180    HRESULT shadowDOMEnabled([out, retval] BOOL* enabled);
    181181    HRESULT setShadowDOMEnabled([in] BOOL enabled);
     182    HRESULT customElementsEnabled([out, retval] BOOL* enabled);
     183    HRESULT setCustomElementsEnabled([in] BOOL enabled);
    182184}
    183185
  • trunk/Source/WebKit/win/WebPreferenceKeysPrivate.h

    r201817 r202559  
    172172
    173173#define WebKitShadowDOMEnabledPreferenceKey "WebKitShadowDOMEnabled"
     174
     175#define WebKitCustomElementsEnabledPreferenceKey "WebKitCustomElementsEnabled"
  • trunk/Source/WebKit/win/WebPreferences.cpp

    r201817 r202559  
    296296    CFDictionaryAddValue(defaults, CFSTR(WebKitShadowDOMEnabledPreferenceKey), kCFBooleanFalse);
    297297
     298    CFDictionaryAddValue(defaults, CFSTR(WebKitCustomElementsEnabledPreferenceKey), kCFBooleanFalse);
     299
    298300    defaultSettings = defaults;
    299301}
     
    19501952    return S_OK;
    19511953}
     1954
     1955HRESULT WebPreferences::customElementsEnabled(_Out_ BOOL* enabled)
     1956{
     1957    if (!enabled)
     1958        return E_POINTER;
     1959    *enabled = boolValueForKey(WebKitCustomElementsEnabledPreferenceKey);
     1960    return S_OK;
     1961}
     1962
     1963HRESULT WebPreferences::setCustomElementsEnabled(BOOL enabled)
     1964{
     1965    setBoolValue(WebKitCustomElementsEnabledPreferenceKey, enabled);
     1966    return S_OK;
     1967}
  • trunk/Source/WebKit/win/WebPreferences.h

    r201817 r202559  
    238238    virtual HRESULT STDMETHODCALLTYPE shadowDOMEnabled(_Out_ BOOL*);
    239239    virtual HRESULT STDMETHODCALLTYPE setShadowDOMEnabled(BOOL);
     240    virtual HRESULT STDMETHODCALLTYPE customElementsEnabled(_Out_ BOOL*);
     241    virtual HRESULT STDMETHODCALLTYPE setCustomElementsEnabled(BOOL);
    240242
    241243    // WebPreferences
  • trunk/Source/WebKit/win/WebView.cpp

    r202292 r202559  
    50535053    RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(!!enabled);
    50545054
     5055#if ENABLE(CUSTOM_ELEMENTS)
     5056    hr = prefsPrivate->customElementsEnabled(&enabled);
     5057    if (FAILED(hr))
     5058        return hr;
     5059    RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(!!enabled);
     5060#endif
     5061
    50555062    hr = preferences->privateBrowsingEnabled(&enabled);
    50565063    if (FAILED(hr))
  • trunk/Source/cmake/OptionsWin.cmake

    r202091 r202559  
    2121WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHAPES PUBLIC ON)
    2222WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CURSOR_VISIBILITY PUBLIC ON)
    23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_ELEMENTS PRIVATE OFF)
     23WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_ELEMENTS PRIVATE ON)
    2424WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER PUBLIC OFF)
    2525WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PUBLIC OFF)
  • trunk/Tools/ChangeLog

    r202543 r202559  
     12016-06-28  Per Arne Vollan  <pvollan@apple.com>
     2
     3        [Win] Custom elements tests are failing.
     4        https://bugs.webkit.org/show_bug.cgi?id=159139
     5
     6        Reviewed by Alex Christensen.
     7
     8        Enable custom element API when running tests.
     9
     10        * DumpRenderTree/win/DumpRenderTree.cpp:
     11        (resetWebPreferencesToConsistentValues):
     12
    1132016-06-27  Lucas Forschler  <lforschler@apple.com>
    214
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r201817 r202559  
    852852    prefsPrivate3->setFetchAPIEnabled(TRUE);
    853853    prefsPrivate3->setShadowDOMEnabled(TRUE);
     854    prefsPrivate3->setCustomElementsEnabled(TRUE);
    854855
    855856    setAlwaysAcceptCookies(false);
Note: See TracChangeset for help on using the changeset viewer.