Reviewed by Darin.
- fix http://bugs.webkit.org/show_bug.cgi?id=14899
!d->m_view->needsLayout() in Frame::paint() (Causes assert)
WebKit copies the width and height attributes of an <embed> to its
nearest <object> ancestor. This used to be done in updateWidget(), but
that could lead to the document being dirty right after layout and
before painting. The patch moves the copying of the attributes to when
the <embed> is inserted into the document or its attributes change.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::insertedIntoDocument):
(WebCore::HTMLEmbedElement::attributeChanged):
* html/HTMLEmbedElement.h:
* manual-tests/bugzilla-14899.html: Added.
* rendering/RenderPartObject.cpp:
(WebCore::RenderPartObject::updateWidget):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25197
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-08-23 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Darin.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=14899
+ !d->m_view->needsLayout() in Frame::paint() (Causes assert)
+
+ WebKit copies the width and height attributes of an <embed> to its
+ nearest <object> ancestor. This used to be done in updateWidget(), but
+ that could lead to the document being dirty right after layout and
+ before painting. The patch moves the copying of the attributes to when
+ the <embed> is inserted into the document or its attributes change.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::insertedIntoDocument):
+ (WebCore::HTMLEmbedElement::attributeChanged):
+ * html/HTMLEmbedElement.h:
+ * manual-tests/bugzilla-14899.html: Added.
+ * rendering/RenderPartObject.cpp:
+ (WebCore::RenderPartObject::updateWidget):
+
2007-08-22 Anders Carlsson <andersca@apple.com>
Reviewed by Darin and Oliver.
#include "Frame.h"
#include "FrameView.h"
#include "HTMLDocument.h"
+#include "HTMLObjectElement.h"
#include "HTMLNames.h"
#include "RenderPartObject.h"
doc->addNamedItem(oldNameAttr);
}
+ String width = getAttribute(widthAttr);
+ String height = getAttribute(heightAttr);
+ if (!width.isEmpty() || !height.isEmpty()) {
+ Node* n = parent();
+ while (n && !n->hasTagName(objectTag))
+ n = n->parent();
+ if (n) {
+ if (!width.isEmpty())
+ static_cast<HTMLObjectElement*>(n)->setAttribute(widthAttr, width);
+ if (!height.isEmpty())
+ static_cast<HTMLObjectElement*>(n)->setAttribute(heightAttr, height);
+ }
+ }
+
HTMLPlugInElement::insertedIntoDocument();
}
HTMLPlugInElement::removedFromDocument();
}
+void HTMLEmbedElement::attributeChanged(Attribute* attr, bool preserveDecls)
+{
+ HTMLPlugInElement::attributeChanged(attr, preserveDecls);
+
+ if ((attr->name() == widthAttr || attr->name() == heightAttr) && !attr->isEmpty()) {
+ Node* n = parent();
+ while (n && !n->hasTagName(objectTag))
+ n = n->parent();
+ if (n)
+ static_cast<HTMLObjectElement*>(n)->setAttribute(attr->name(), attr->value());
+ }
+}
+
bool HTMLEmbedElement::isURLAttribute(Attribute *attr) const
{
return attr->name() == srcAttr;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
+ virtual void attributeChanged(Attribute*, bool preserveDecls = false);
virtual bool isURLAttribute(Attribute*) const;
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+ <script>
+ function test()
+ {
+ document.getElementById("z").style.display='block';
+ open("data:text/html,SUCCESS");
+ }
+ </script>
+</head>
+<body>
+ <p><b>BUG ID:</b> <a href="http://bugs.webkit.org/show_bug.cgi?id=14899">Bugzilla bug 14899</a> !d->m_view->needsLayout() in Frame::paint() (Causes assert)</p>
+
+ <p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b>
+ Make sure you are using a debug build of the Web Kit framework. Click the Test button below.
+ </p>
+
+ <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
+ A new window will open.
+ </p>
+
+ <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
+ An assertion failure will occur.
+ </p>
+ <button onclick="test()">Test</button>
+ <div id="z" style="display: none;">
+ <object>
+ <embed width="40" src="resources/orange.mov" controller="false">
+ </object>
+ </div>
+</body>
HTMLElement *embedOrObject;
if (embed) {
embedOrObject = (HTMLElement *)embed;
- String attribute = embedOrObject->getAttribute(widthAttr);
- if (!attribute.isEmpty())
- o->setAttribute(widthAttr, attribute);
- attribute = embedOrObject->getAttribute(heightAttr);
- if (!attribute.isEmpty())
- o->setAttribute(heightAttr, attribute);
url = embed->url;
serviceType = embed->m_serviceType;
} else