[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
eric at webkit.org
eric at webkit.org
Wed Dec 22 12:56:20 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 0f33ce8e35040682d08030f324c0f7eb032ab712
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 2 11:29:26 2010 +0000
2010-09-02 Eric Seidel <eric at webkit.org>
Reviewed by Dimitri Glazkov.
Share more code between HTMLObjectElement and HTMLEmbedElement
https://bugs.webkit.org/show_bug.cgi?id=45054
This pushes more of HTMLObjectElement code down into
HTMLPlugInImageElement so that it can be shared with
HTMLEmbedElement.
The most notable changes are:
- HTMLEmbedElement now "delays" updating the widget until
all of its children are parsed (this matches HTMLObjectElement).
However, since HTMLEmbedElement can't have children, this is actually
no delay.
- useFallbackContent is now virtual, allowing HTMLEmbedElement and
HTMLObjectElement to share the same code paths, and the <embed>
case to just always return false for useFallbackContent().
This is the final (fourth) part of this change.
No functional change, thus no tests.
* html/HTMLEmbedElement.cpp:
* html/HTMLEmbedElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::rendererIsNeeded):
* html/HTMLObjectElement.h:
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
(WebCore::HTMLPlugInImageElement::recalcStyle):
(WebCore::HTMLPlugInImageElement::attach):
(WebCore::HTMLPlugInImageElement::detach):
(WebCore::HTMLPlugInImageElement::finishParsingChildren):
* html/HTMLPlugInImageElement.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b98aff2..3615992 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2010-09-02 Eric Seidel <eric at webkit.org>
+
+ Reviewed by Dimitri Glazkov.
+
+ Share more code between HTMLObjectElement and HTMLEmbedElement
+ https://bugs.webkit.org/show_bug.cgi?id=45054
+
+ This pushes more of HTMLObjectElement code down into
+ HTMLPlugInImageElement so that it can be shared with
+ HTMLEmbedElement.
+
+ The most notable changes are:
+ - HTMLEmbedElement now "delays" updating the widget until
+ all of its children are parsed (this matches HTMLObjectElement).
+ However, since HTMLEmbedElement can't have children, this is actually
+ no delay.
+ - useFallbackContent is now virtual, allowing HTMLEmbedElement and
+ HTMLObjectElement to share the same code paths, and the <embed>
+ case to just always return false for useFallbackContent().
+
+ This is the final (fourth) part of this change.
+
+ No functional change, thus no tests.
+
+ * html/HTMLEmbedElement.cpp:
+ * html/HTMLEmbedElement.h:
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::rendererIsNeeded):
+ * html/HTMLObjectElement.h:
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement):
+ (WebCore::HTMLPlugInImageElement::recalcStyle):
+ (WebCore::HTMLPlugInImageElement::attach):
+ (WebCore::HTMLPlugInImageElement::detach):
+ (WebCore::HTMLPlugInImageElement::finishParsingChildren):
+ * html/HTMLPlugInImageElement.h:
+
2010-09-02 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
diff --git a/WebCore/html/HTMLEmbedElement.cpp b/WebCore/html/HTMLEmbedElement.cpp
index c2ca671..eeb28e7 100644
--- a/WebCore/html/HTMLEmbedElement.cpp
+++ b/WebCore/html/HTMLEmbedElement.cpp
@@ -151,27 +151,6 @@ bool HTMLEmbedElement::rendererIsNeeded(RenderStyle* style)
return HTMLPlugInImageElement::rendererIsNeeded(style);
}
-void HTMLEmbedElement::attach()
-{
- setNeedsWidgetUpdate(true);
-
- bool isImage = isImageType();
-
- if (!isImage)
- queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, this);
-
- HTMLPlugInImageElement::attach();
-
- if (isImage && renderer()) {
- if (!m_imageLoader)
- m_imageLoader = adoptPtr(new HTMLImageLoader(this));
- m_imageLoader->updateFromElement();
-
- if (renderer())
- toRenderImage(renderer())->imageResource()->setCachedImage(m_imageLoader->image());
- }
-}
-
void HTMLEmbedElement::insertedIntoDocument()
{
if (document()->isHTMLDocument())
diff --git a/WebCore/html/HTMLEmbedElement.h b/WebCore/html/HTMLEmbedElement.h
index c71fb1d..e27b717 100644
--- a/WebCore/html/HTMLEmbedElement.h
+++ b/WebCore/html/HTMLEmbedElement.h
@@ -37,7 +37,6 @@ private:
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(Attribute*);
- virtual void attach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index 250930e..e8884ef 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -117,6 +117,7 @@ void HTMLObjectElement::parseMappedAttribute(Attribute* attr)
bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style)
{
+ // FIXME: This check should not be needed, detached documents never render!
Frame* frame = document()->frame();
if (!frame)
return false;
@@ -128,22 +129,6 @@ bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style)
return isGearsPlugin || HTMLPlugInImageElement::rendererIsNeeded(style);
}
-void HTMLObjectElement::attach()
-{
- bool isImage = isImageType();
-
- if (!isImage)
- queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, this);
-
- HTMLPlugInImageElement::attach();
-
- if (isImage && renderer() && !useFallbackContent()) {
- if (!m_imageLoader)
- m_imageLoader = adoptPtr(new HTMLImageLoader(this));
- m_imageLoader->updateFromElement();
- }
-}
-
void HTMLObjectElement::insertedIntoDocument()
{
if (isDocNamedItem() && document()->isHTMLDocument()) {
@@ -166,15 +151,6 @@ void HTMLObjectElement::removedFromDocument()
HTMLPlugInImageElement::removedFromDocument();
}
-void HTMLObjectElement::recalcStyle(StyleChange ch)
-{
- if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType()) {
- detach();
- attach();
- }
- HTMLPlugInImageElement::recalcStyle(ch);
-}
-
void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
updateDocNamedItem();
diff --git a/WebCore/html/HTMLObjectElement.h b/WebCore/html/HTMLObjectElement.h
index 4dc69af..9fafae9 100644
--- a/WebCore/html/HTMLObjectElement.h
+++ b/WebCore/html/HTMLObjectElement.h
@@ -46,12 +46,10 @@ private:
virtual void parseMappedAttribute(Attribute*);
- virtual void attach();
virtual bool rendererIsNeeded(RenderStyle*);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
- virtual void recalcStyle(StyleChange);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual bool isURLAttribute(Attribute*) const;
diff --git a/WebCore/html/HTMLPlugInImageElement.cpp b/WebCore/html/HTMLPlugInImageElement.cpp
index 51c29e2..75407dd 100644
--- a/WebCore/html/HTMLPlugInImageElement.cpp
+++ b/WebCore/html/HTMLPlugInImageElement.cpp
@@ -37,7 +37,7 @@ HTMLPlugInImageElement::HTMLPlugInImageElement(const QualifiedName& tagName, Doc
// widget updates until after all children are parsed. For HTMLEmbedElement
// this delay is unnecessary, but it is simpler to make both classes share
// the same codepath in this class.
- , m_needsWidgetUpdate(!createdByParser)
+ , m_needsWidgetUpdate(!createdByParser)
{
}
@@ -78,8 +78,37 @@ RenderObject* HTMLPlugInImageElement::createRenderer(RenderArena* arena, RenderS
return new (arena) RenderEmbeddedObject(this);
}
+void HTMLPlugInImageElement::recalcStyle(StyleChange ch)
+{
+ // FIXME: Why is this necessary? Manual re-attach is almost always wrong.
+ if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType()) {
+ detach();
+ attach();
+ }
+ HTMLPlugInElement::recalcStyle(ch);
+}
+
+void HTMLPlugInImageElement::attach()
+{
+ bool isImage = isImageType();
+
+ if (!isImage)
+ queuePostAttachCallback(&HTMLPlugInImageElement::updateWidgetCallback, this);
+
+ HTMLPlugInElement::attach();
+
+ if (isImage && renderer() && !useFallbackContent()) {
+ if (!m_imageLoader)
+ m_imageLoader = adoptPtr(new HTMLImageLoader(this));
+ m_imageLoader->updateFromElement();
+ }
+}
+
void HTMLPlugInImageElement::detach()
{
+ // FIXME: Because of the insanity that is HTMLObjectElement::recalcStyle,
+ // we can end up detaching during an attach() call, before we even have a
+ // renderer. In that case, don't mark the widget for update.
if (attached() && renderer() && !useFallbackContent())
// Update the widget the next time we attach (detaching destroys the plugin).
setNeedsWidgetUpdate(true);
@@ -96,11 +125,12 @@ void HTMLPlugInImageElement::updateWidget()
void HTMLPlugInImageElement::finishParsingChildren()
{
HTMLPlugInElement::finishParsingChildren();
- if (!useFallbackContent()) {
- setNeedsWidgetUpdate(true);
- if (inDocument())
- setNeedsStyleRecalc();
- }
+ if (useFallbackContent())
+ return;
+
+ setNeedsWidgetUpdate(true);
+ if (inDocument())
+ setNeedsStyleRecalc();
}
void HTMLPlugInImageElement::willMoveToNewOwnerDocument()
diff --git a/WebCore/html/HTMLPlugInImageElement.h b/WebCore/html/HTMLPlugInImageElement.h
index 94e6094..65c5f37 100644
--- a/WebCore/html/HTMLPlugInImageElement.h
+++ b/WebCore/html/HTMLPlugInImageElement.h
@@ -47,13 +47,15 @@ protected:
OwnPtr<HTMLImageLoader> m_imageLoader;
String m_serviceType;
String m_url;
-
+
static void updateWidgetCallback(Node*);
+ virtual void attach();
virtual void detach();
private:
virtual bool canLazyAttach() { return false; }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+ virtual void recalcStyle(StyleChange);
virtual void finishParsingChildren();
virtual void willMoveToNewOwnerDocument();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list