Changeset 181168 in webkit


Ignore:
Timestamp:
Mar 6, 2015 10:44:33 AM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Setting any of the <object> element plugin controlling attributes does not have any affect.
https://bugs.webkit.org/show_bug.cgi?id=141936.

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-03-06
Reviewed by Simon Fraser.
Source/WebCore:

When setting any of the <object> element plugin controlling attributes
dynamically we need to mark the the element to be dirty by calling
setNeedsStyleRecalc(), so it has to recreate its renderer when needed.

Tests: fast/css/image-object-hover-inherit.html

svg/as-object/svg-in-object-dynamic-attribute-change.html

  • dom/Element.h: Delete unimplemented function.
  • html/HTMLObjectElement.cpp:

(WebCore::HTMLObjectElement::parseAttribute): Mark the element dirty by
calling setNeedsStyleRecalc() when one of the plugin controlling attributes
gets changed. We have to clear m_useFallbackContent because the attribute's
new value might fix the object rendering.

  • html/HTMLObjectElement.h: Add a function to clear m_useFallbackContent.

LayoutTests:

  • fast/css/image-object-hover-inherit-expected.html: Added.
  • fast/css/image-object-hover-inherit.html: Added.

A guarding test to catch the case of reconstructing the image <object>
renderer while performing a synchronous resolveTree() followed by page
rendering or dump render tree.

  • svg/as-object/resources/lime100x100.html: Added.
  • svg/as-object/resources/lime100x100.png: Added.
  • svg/as-object/resources/lime100x100.svg: Added.
  • svg/as-object/resources/red100x100.svg: Added.
  • svg/as-object/svg-in-object-dynamic-attribute-change-expected.html: Added.
  • svg/as-object/svg-in-object-dynamic-attribute-change.html: Added.

Ensure that changing the 'type' and the 'data' attributes of the <object>
element will have the expected outcome. Also make sure that the <object>
element renderer falls back correctly when setting any of the attributes
to some unexpected value.

Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r181167 r181168  
     12015-03-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Setting any of the <object> element plugin controlling attributes does not have any affect.
     4        https://bugs.webkit.org/show_bug.cgi?id=141936.
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/css/image-object-hover-inherit-expected.html: Added.
     9        * fast/css/image-object-hover-inherit.html: Added.
     10        A guarding test to catch the case of reconstructing the image <object>
     11        renderer while performing a synchronous resolveTree() followed by page
     12        rendering or dump render tree.
     13       
     14        * svg/as-object/resources/lime100x100.html: Added.
     15        * svg/as-object/resources/lime100x100.png: Added.
     16        * svg/as-object/resources/lime100x100.svg: Added.
     17        * svg/as-object/resources/red100x100.svg: Added.
     18        * svg/as-object/svg-in-object-dynamic-attribute-change-expected.html: Added.
     19        * svg/as-object/svg-in-object-dynamic-attribute-change.html: Added.
     20        Ensure that changing the 'type' and the 'data' attributes of the <object>
     21        element will have the expected outcome. Also make sure that the <object>
     22        element renderer falls back correctly when setting any of the attributes
     23        to some unexpected value.
     24
    1252015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
    226
  • trunk/Source/WebCore/ChangeLog

    r181167 r181168  
     12015-03-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Setting any of the <object> element plugin controlling attributes does not have any affect.
     4        https://bugs.webkit.org/show_bug.cgi?id=141936.
     5
     6        Reviewed by Simon Fraser.
     7       
     8        When setting any of the <object> element plugin controlling attributes
     9        dynamically we need to mark the the element to be dirty by calling
     10        setNeedsStyleRecalc(), so it has to recreate its renderer when needed.
     11
     12        Tests: fast/css/image-object-hover-inherit.html
     13               svg/as-object/svg-in-object-dynamic-attribute-change.html
     14
     15        * dom/Element.h: Delete unimplemented function.
     16       
     17        * html/HTMLObjectElement.cpp:
     18        (WebCore::HTMLObjectElement::parseAttribute): Mark the element dirty by
     19        calling setNeedsStyleRecalc() when one of the plugin controlling attributes
     20        gets changed. We have to clear m_useFallbackContent because the attribute's
     21        new value might fix the object rendering.
     22       
     23        * html/HTMLObjectElement.h: Add a function to clear m_useFallbackContent.
     24
    1252015-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
    226
  • trunk/Source/WebCore/dom/Element.h

    r181166 r181168  
    311311    virtual void copyNonAttributePropertiesFromElement(const Element&) { }
    312312
    313     void lazyReattach();
    314 
    315313    virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&);
    316314    virtual bool rendererIsNeeded(const RenderStyle&);
  • trunk/Source/WebCore/html/HTMLObjectElement.cpp

    r180966 r181168  
    108108void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    109109{
     110    bool invalidateRenderer = false;
     111
    110112    if (name == formAttr)
    111113        formAttributeChanged();
    112114    else if (name == typeAttr) {
    113115        m_serviceType = value.string().left(value.find(';')).lower();
     116        invalidateRenderer = !fastHasAttribute(classidAttr);
    114117        setNeedsWidgetUpdate(true);
    115118    } else if (name == dataAttr) {
    116119        m_url = stripLeadingAndTrailingHTMLSpaces(value);
     120        document().updateStyleIfNeeded();
     121        if (isImageType() && renderer()) {
     122            if (!m_imageLoader)
     123                m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
     124            m_imageLoader->updateFromElementIgnoringPreviousError();
     125        }
     126        invalidateRenderer = !fastHasAttribute(classidAttr);
    117127        setNeedsWidgetUpdate(true);
    118         document().updateStyleIfNeeded();
    119         if (renderer()) {
    120             if (isImageType()) {
    121                 if (!m_imageLoader)
    122                     m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
    123                 m_imageLoader->updateFromElementIgnoringPreviousError();
    124             }
    125         }
    126     } else if (name == classidAttr)
     128    } else if (name == classidAttr) {
     129        invalidateRenderer = true;
    127130        setNeedsWidgetUpdate(true);
    128     else if (name == onbeforeloadAttr)
     131    } else if (name == onbeforeloadAttr)
    129132        setAttributeEventListener(eventNames().beforeloadEvent, name, value);
    130133    else
    131134        HTMLPlugInImageElement::parseAttribute(name, value);
     135
     136    if (!invalidateRenderer || !inDocument() || !renderer())
     137        return;
     138
     139    clearUseFallbackContent();
     140    setNeedsStyleRecalc(ReconstructRenderTree);
    132141}
    133142
  • trunk/Source/WebCore/html/HTMLObjectElement.h

    r180966 r181168  
    8686    bool shouldAllowQuickTimeClassIdQuirk();
    8787    bool hasValidClassId();
     88    void clearUseFallbackContent() { m_useFallbackContent = false; }
    8889
    8990    virtual void refFormAssociatedElement() override { ref(); }
Note: See TracChangeset for help on using the changeset viewer.