- Revision
- 180683
- Author
- commit-qu...@webkit.org
- Date
- 2015-02-26 10:34:51 -0800 (Thu, 26 Feb 2015)
Log 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 <sabouhall...@apple.com> on 2015-02-26
Reviewed by Zalan Bujtas.
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.
Test: svg/as-object/svg-in-object-dynamic-attribute-change.html
* dom/Element.h: Delete unimplemented function.
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parseAttribute): Dirty the element by calling
setNeedsStyleRecalc() when one of the plugin controlling attributes gets
changed. We have to clear the m_useFallbackContent because the attribute's
new value might fix the object rendering.
* html/HTMLObjectElement.h: Add a function to clear m_useFallbackContent.
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::willRecalcStyle): We might need to
reconstruct the object renderer in the image case. This can happen if the
image was rendering fallback content and the attribute's new value fixes
the object rendering.
LayoutTests:
* 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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (180682 => 180683)
--- trunk/LayoutTests/ChangeLog 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/LayoutTests/ChangeLog 2015-02-26 18:34:51 UTC (rev 180683)
@@ -1,3 +1,21 @@
+2015-02-26 Said Abou-Hallawa <sabouhall...@apple.com>
+
+ Setting any of the <object> element plugin controlling attributes does not have any affect.
+ https://bugs.webkit.org/show_bug.cgi?id=141936.
+
+ Reviewed by Zalan Bujtas.
+
+ * 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.
+
2015-02-26 Brent Fulgham <bfulg...@apple.com>
[Win] Unreviewed test updates for Debug bots.
Added: trunk/LayoutTests/svg/as-object/resources/lime100x100.html (0 => 180683)
--- trunk/LayoutTests/svg/as-object/resources/lime100x100.html (rev 0)
+++ trunk/LayoutTests/svg/as-object/resources/lime100x100.html 2015-02-26 18:34:51 UTC (rev 180683)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ html, body {
+ margin: 0 0 0 0;
+ overflow:hidden;
+ }
+ </style>
+</head>
+<body>
+ <img src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-object/resources/lime100x100.png
(Binary files differ)
Property changes on: trunk/LayoutTests/svg/as-object/resources/lime100x100.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/svg/as-object/resources/lime100x100.svg (0 => 180683)
--- trunk/LayoutTests/svg/as-object/resources/lime100x100.svg (rev 0)
+++ trunk/LayoutTests/svg/as-object/resources/lime100x100.svg 2015-02-26 18:34:51 UTC (rev 180683)
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'>
+ <rect width='100%' height='100%' fill='lime'/>
+</svg>
Added: trunk/LayoutTests/svg/as-object/resources/red100x100.svg (0 => 180683)
--- trunk/LayoutTests/svg/as-object/resources/red100x100.svg (rev 0)
+++ trunk/LayoutTests/svg/as-object/resources/red100x100.svg 2015-02-26 18:34:51 UTC (rev 180683)
@@ -0,0 +1,3 @@
+<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'>
+ <rect width='100%' height='100%' fill='red'/>
+</svg>
\ No newline at end of file
Added: trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change-expected.html (0 => 180683)
--- trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change-expected.html (rev 0)
+++ trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change-expected.html 2015-02-26 18:34:51 UTC (rev 180683)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ div {
+ width: 100px;
+ height: 100px;
+ background-color: lime;
+ display: inline-block;
+ }
+ </style>
+</head>
+<body>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+</body>
+</html>
Added: trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change.html (0 => 180683)
--- trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change.html (rev 0)
+++ trunk/LayoutTests/svg/as-object/svg-in-object-dynamic-attribute-change.html 2015-02-26 18:34:51 UTC (rev 180683)
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <object id="object1" data=""
+ <img src=""
+ </object>
+ <object id="object2" type="image/svg+xml" data=""
+ <img src=""
+ </object>
+ <object width="100px" height="100px" id="object3">
+ <img src=""
+ </object>
+ <object id="object4" type="dummy">
+ <img src=""
+ </object>
+ <object id="object5" type="dummy">
+ <img src=""
+ </object>
+ <object id="object6" type="image/svg+xml" data=""
+ <img src=""
+ </object>
+ <script>
+ function onObjectLoad() {
+ if (!window.testRunner)
+ return;
+
+ if (typeof onObjectLoad.counter == 'undefined')
+ onObjectLoad.counter = 0;
+
+ if (++onObjectLoad.counter == 4)
+ testRunner.notifyDone();
+ }
+
+ window.addEventListener("load", function() {
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ // change the 'type' attribute
+ var object1 = document.getElementById("object1");
+ object1.setAttribute("type", "image/svg+xml");
+
+ // change the 'data' attribute
+ var object2 = document.getElementById("object2");
+ object2._onload_ = onObjectLoad;
+ object2.setAttribute("data", "resources/lime100x100.svg");
+
+ // change the 'data' attribute
+ var object3 = document.getElementById("object3");
+ object3._onload_ = onObjectLoad;
+ object3.setAttribute("data", "resources/lime100x100.html");
+
+ // change the 'type' then the 'data' attributes of an image object
+ var object4 = document.getElementById("object4");
+ object4._onload_ = onObjectLoad;
+ object4.setAttribute("type", "image/png");
+ object4.setAttribute("data", "resources/lime100x100.png");
+
+ // change the 'data' then the 'type' attributes of an image object
+ var object5 = document.getElementById("object5");
+ object5._onload_ = onObjectLoad;
+ object5.setAttribute("data", "resources/lime100x100.png");
+ object5.setAttribute("type", "image/png");
+
+ // object rederer fallback
+ var object6 = document.getElementById("object6");
+ object6.setAttribute("type", "dummy");
+ });
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (180682 => 180683)
--- trunk/Source/WebCore/ChangeLog 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/Source/WebCore/ChangeLog 2015-02-26 18:34:51 UTC (rev 180683)
@@ -1,3 +1,32 @@
+2015-02-26 Said Abou-Hallawa <sabouhall...@apple.com>
+
+ Setting any of the <object> element plugin controlling attributes does not have any affect.
+ https://bugs.webkit.org/show_bug.cgi?id=141936.
+
+ Reviewed by Zalan Bujtas.
+
+ 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.
+
+ Test: svg/as-object/svg-in-object-dynamic-attribute-change.html
+
+ * dom/Element.h: Delete unimplemented function.
+
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::parseAttribute): Dirty the element by calling
+ setNeedsStyleRecalc() when one of the plugin controlling attributes gets
+ changed. We have to clear the m_useFallbackContent because the attribute's
+ new value might fix the object rendering.
+
+ * html/HTMLObjectElement.h: Add a function to clear m_useFallbackContent.
+
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::willRecalcStyle): We might need to
+ reconstruct the object renderer in the image case. This can happen if the
+ image was rendering fallback content and the attribute's new value fixes
+ the object rendering.
+
2015-02-26 Brent Fulgham <bfulg...@apple.com>
[Win] Make build logs more legible by reducing noise
Modified: trunk/Source/WebCore/dom/Element.h (180682 => 180683)
--- trunk/Source/WebCore/dom/Element.h 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/Source/WebCore/dom/Element.h 2015-02-26 18:34:51 UTC (rev 180683)
@@ -310,8 +310,6 @@
virtual void copyNonAttributePropertiesFromElement(const Element&) { }
- void lazyReattach();
-
virtual RenderPtr<RenderElement> createElementRenderer(Ref<RenderStyle>&&);
virtual bool rendererIsNeeded(const RenderStyle&);
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (180682 => 180683)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2015-02-26 18:34:51 UTC (rev 180683)
@@ -107,28 +107,37 @@
void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
+ bool invalidateRenderer = false;
+
if (name == formAttr)
formAttributeChanged();
else if (name == typeAttr) {
m_serviceType = value.string().left(value.find(';')).lower();
+ invalidateRenderer = !fastHasAttribute(classidAttr);
setNeedsWidgetUpdate(true);
} else if (name == dataAttr) {
m_url = stripLeadingAndTrailingHTMLSpaces(value);
- setNeedsWidgetUpdate(true);
document().updateStyleIfNeeded();
- if (renderer()) {
- if (isImageType()) {
- if (!m_imageLoader)
- m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
- m_imageLoader->updateFromElementIgnoringPreviousError();
- }
+ if (isImageType() && renderer()) {
+ if (!m_imageLoader)
+ m_imageLoader = std::make_unique<HTMLImageLoader>(*this);
+ m_imageLoader->updateFromElementIgnoringPreviousError();
}
- } else if (name == classidAttr)
+ invalidateRenderer = !fastHasAttribute(classidAttr);
setNeedsWidgetUpdate(true);
- else if (name == onbeforeloadAttr)
+ } else if (name == classidAttr) {
+ invalidateRenderer = true;
+ setNeedsWidgetUpdate(true);
+ } else if (name == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, name, value);
else
HTMLPlugInImageElement::parseAttribute(name, value);
+
+ if (!invalidateRenderer || !inDocument() || !renderer())
+ return;
+
+ clearUseFallbackContent();
+ setNeedsStyleRecalc(SyntheticStyleChange);
}
static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues)
Modified: trunk/Source/WebCore/html/HTMLObjectElement.h (180682 => 180683)
--- trunk/Source/WebCore/html/HTMLObjectElement.h 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/Source/WebCore/html/HTMLObjectElement.h 2015-02-26 18:34:51 UTC (rev 180683)
@@ -85,6 +85,7 @@
bool shouldAllowQuickTimeClassIdQuirk();
bool hasValidClassId();
+ void clearUseFallbackContent() { m_useFallbackContent = false; }
virtual void refFormAssociatedElement() override { ref(); }
virtual void derefFormAssociatedElement() override { deref(); }
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (180682 => 180683)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2015-02-26 18:33:38 UTC (rev 180682)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2015-02-26 18:34:51 UTC (rev 180683)
@@ -237,7 +237,7 @@
// FIXME: There shoudn't be need to force render tree reconstruction here.
// It is only done because loading and load event dispatching is tied to render tree construction.
- if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && (displayState() != DisplayingSnapshot))
+ if (!useFallbackContent() && needsWidgetUpdate() && renderer() && (displayState() != DisplayingSnapshot))
setNeedsStyleRecalc(ReconstructRenderTree);
return true;
}