Diff
Modified: trunk/Source/WebCore/ChangeLog (103477 => 103478)
--- trunk/Source/WebCore/ChangeLog 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/ChangeLog 2011-12-22 01:36:40 UTC (rev 103478)
@@ -1,3 +1,50 @@
+2011-12-21 Andreas Kling <kl...@webkit.org>
+
+ Unreviewed, rolling out r103473.
+ http://trac.webkit.org/changeset/103473
+ https://bugs.webkit.org/show_bug.cgi?id=74991
+
+ Overestimated my superpowers a bit here.
+
+ * dom/Element.cpp:
+ (WebCore::Element::attributeChanged):
+ (WebCore::Element::insertedIntoDocument):
+ (WebCore::Element::removedFromDocument):
+ * dom/Element.h:
+ (WebCore::Element::updateId):
+ (WebCore::Element::willModifyAttribute):
+ * dom/NamedNodeMap.cpp:
+ (WebCore::NamedNodeMap::setAttributes):
+ * dom/Node.h:
+ * html/HTMLAppletElement.cpp:
+ (WebCore::HTMLAppletElement::parseMappedAttribute):
+ (WebCore::HTMLAppletElement::insertedIntoDocument):
+ (WebCore::HTMLAppletElement::removedFromDocument):
+ * html/HTMLAppletElement.h:
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::parseMappedAttribute):
+ (WebCore::HTMLEmbedElement::insertedIntoDocument):
+ (WebCore::HTMLEmbedElement::removedFromDocument):
+ * html/HTMLEmbedElement.h:
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::insertedIntoDocument):
+ (WebCore::HTMLFormElement::removedFromDocument):
+ (WebCore::HTMLFormElement::parseMappedAttribute):
+ * html/HTMLFormElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseMappedAttribute):
+ (WebCore::HTMLImageElement::insertedIntoDocument):
+ (WebCore::HTMLImageElement::removedFromDocument):
+ * html/HTMLImageElement.h:
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::parseMappedAttribute):
+ (WebCore::HTMLObjectElement::insertedIntoDocument):
+ (WebCore::HTMLObjectElement::removedFromDocument):
+ (WebCore::HTMLObjectElement::updateDocNamedItem):
+ (WebCore::HTMLObjectElement::formControlName):
+ * html/HTMLObjectElement.h:
+ * html/HTMLPlugInElement.h:
+
2011-12-21 Simon Fraser <simon.fra...@apple.com>
Clean up RenderLayer code that applies filters and transforms
Modified: trunk/Source/WebCore/dom/Element.cpp (103477 => 103478)
--- trunk/Source/WebCore/dom/Element.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/dom/Element.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -43,7 +43,6 @@
#include "FocusController.h"
#include "Frame.h"
#include "FrameView.h"
-#include "HTMLDocument.h"
#include "HTMLElement.h"
#include "HTMLFrameOwnerElement.h"
#include "HTMLNames.h"
@@ -705,8 +704,6 @@
{
if (isIdAttributeName(attr->name()))
idAttributeChanged(attr);
- else if (attr->name() == HTMLNames::nameAttr)
- setHasName(!attr->isNull());
recalcStyleIfNeededAfterAttributeChanged(attr);
updateAfterAttributeChanged(attr);
}
@@ -919,33 +916,23 @@
if (ShadowRoot* shadow = shadowRoot())
shadow->insertedIntoDocument();
- if (m_attributeMap) {
- if (hasID()) {
+ if (hasID()) {
+ if (m_attributeMap) {
Attribute* idItem = m_attributeMap->getAttributeItem(document()->idAttributeName());
if (idItem && !idItem->isNull())
updateId(nullAtom, idItem->value());
}
- if (hasName()) {
- Attribute* nameItem = m_attributeMap->getAttributeItem(HTMLNames::nameAttr);
- if (nameItem && !nameItem->isNull())
- updateName(nullAtom, nameItem->value());
- }
}
}
void Element::removedFromDocument()
{
- if (m_attributeMap) {
- if (hasID()) {
+ if (hasID()) {
+ if (m_attributeMap) {
Attribute* idItem = m_attributeMap->getAttributeItem(document()->idAttributeName());
if (idItem && !idItem->isNull())
updateId(idItem->value(), nullAtom);
}
- if (hasName()) {
- Attribute* nameItem = m_attributeMap->getAttributeItem(HTMLNames::nameAttr);
- if (nameItem && !nameItem->isNull())
- updateName(nameItem->value(), nullAtom);
- }
}
ContainerNode::removedFromDocument();
@@ -2005,28 +1992,4 @@
}
#endif
-void Element::updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName)
-{
- if (!document()->isHTMLDocument())
- return;
-
- if (!oldName.isEmpty())
- static_cast<HTMLDocument*>(document())->removeNamedItem(oldName);
-
- if (!newName.isEmpty())
- static_cast<HTMLDocument*>(document())->addNamedItem(newName);
-}
-
-void Element::updateExtraNamedItemRegistration(const AtomicString& oldId, const AtomicString& newId)
-{
- if (!document()->isHTMLDocument())
- return;
-
- if (!oldId.isEmpty())
- static_cast<HTMLDocument*>(document())->removeExtraNamedItem(oldId);
-
- if (!newId.isEmpty())
- static_cast<HTMLDocument*>(document())->addExtraNamedItem(newId);
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Element.h (103477 => 103478)
--- trunk/Source/WebCore/dom/Element.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/dom/Element.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -27,7 +27,6 @@
#include "Document.h"
#include "FragmentScriptingPermission.h"
-#include "HTMLNames.h"
#include "NamedNodeMap.h"
#include "ScrollTypes.h"
@@ -266,7 +265,6 @@
virtual String title() const;
void updateId(const AtomicString& oldId, const AtomicString& newId);
- void updateName(const AtomicString& oldName, const AtomicString& newName);
void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
LayoutSize minimumSizeForResizing() const;
@@ -383,9 +381,6 @@
virtual void didRecalcStyle(StyleChange) { }
virtual PassRefPtr<RenderStyle> customStyleForRenderer();
- virtual bool shouldRegisterAsNamedItem() const { return false; }
- virtual bool shouldRegisterAsExtraNamedItem() const { return false; }
-
// The implementation of Element::attributeChanged() calls the following two functions.
// They are separated to allow a different flow of control in StyledElement::attributeChanged().
void recalcStyleIfNeededAfterAttributeChanged(Attribute*);
@@ -442,9 +437,6 @@
void enqueueAttributesMutationRecordIfRequested(const QualifiedName&, const AtomicString& oldValue);
#endif
- void updateNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName);
- void updateExtraNamedItemRegistration(const AtomicString& oldName, const AtomicString& newName);
-
private:
mutable RefPtr<NamedNodeMap> m_attributeMap;
};
@@ -524,29 +516,12 @@
scope->removeElementById(oldId, this);
if (!newId.isEmpty())
scope->addElementById(newId, this);
-
- if (shouldRegisterAsExtraNamedItem())
- updateExtraNamedItemRegistration(oldId, newId);
}
-inline void Element::updateName(const AtomicString& oldName, const AtomicString& newName)
-{
- if (!inDocument())
- return;
-
- if (oldName == newName)
- return;
-
- if (shouldRegisterAsNamedItem())
- updateNamedItemRegistration(oldName, newName);
-}
-
inline void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
{
if (isIdAttributeName(name))
updateId(oldValue, newValue);
- else if (name == HTMLNames::nameAttr)
- updateName(oldValue, newValue);
// FIXME: Should probably call InspectorInstrumentation::willModifyDOMAttr here.
Modified: trunk/Source/WebCore/dom/NamedNodeMap.cpp (103477 => 103478)
--- trunk/Source/WebCore/dom/NamedNodeMap.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/dom/NamedNodeMap.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -240,12 +240,6 @@
if (oldId || newId)
m_element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
- Attribute* oldName = getAttributeItem(HTMLNames::nameAttr);
- Attribute* newName = other.getAttributeItem(HTMLNames::nameAttr);
-
- if (oldName || newName)
- m_element->updateName(oldName ? oldName->value() : nullAtom, newName ? newName->value() : nullAtom);
-
clearAttributes();
unsigned newLength = other.length();
m_attributes.resize(newLength);
Modified: trunk/Source/WebCore/dom/Node.h (103477 => 103478)
--- trunk/Source/WebCore/dom/Node.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/dom/Node.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -295,7 +295,6 @@
virtual bool sheetLoaded() { return true; }
virtual void startLoadingDynamicSheet() { ASSERT_NOT_REACHED(); }
- bool hasName() const { return getFlag(HasNameFlag); }
bool hasID() const { return getFlag(HasIDFlag); }
bool hasClass() const { return getFlag(HasClassFlag); }
bool active() const { return getFlag(IsActiveFlag); }
@@ -310,7 +309,6 @@
bool childNeedsStyleRecalc() const { return getFlag(ChildNeedsStyleRecalcFlag); }
bool isLink() const { return getFlag(IsLinkFlag); }
- void setHasName(bool f) { setFlag(f, HasNameFlag); }
void setHasID(bool f) { setFlag(f, HasIDFlag); }
void setHasClass(bool f) { setFlag(f, HasClassFlag); }
void setChildNeedsStyleRecalc() { setFlag(ChildNeedsStyleRecalcFlag); }
@@ -647,8 +645,6 @@
HasCustomWillOrDidRecalcStyleFlag = 1 << 28,
HasCustomStyleForRendererFlag = 1 << 29,
- HasNameFlag = 1 << 30,
-
#if ENABLE(SVG)
DefaultNodeFlags = IsParsingChildrenFinishedFlag | IsStyleAttributeValidFlag | AreSVGAttributesValidFlag
#else
@@ -656,7 +652,7 @@
#endif
};
- // 1 bit remaining
+ // 2 bits remaining
bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }
Modified: trunk/Source/WebCore/html/HTMLAppletElement.cpp (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLAppletElement.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLAppletElement.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -56,10 +56,50 @@
attr->name() == mayscriptAttr ||
attr->name() == objectAttr) {
// Do nothing.
+ } else if (attr->name() == nameAttr) {
+ const AtomicString& newName = attr->value();
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->addNamedItem(newName);
+ }
+ m_name = newName;
+ } else if (isIdAttributeName(attr->name())) {
+ const AtomicString& newId = attr->value();
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeExtraNamedItem(m_id);
+ document->addExtraNamedItem(newId);
+ }
+ m_id = newId;
+ // also call superclass
+ HTMLPlugInElement::parseMappedAttribute(attr);
} else
HTMLPlugInElement::parseMappedAttribute(attr);
}
+void HTMLAppletElement::insertedIntoDocument()
+{
+ if (document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->addNamedItem(m_name);
+ document->addExtraNamedItem(m_id);
+ }
+
+ HTMLPlugInElement::insertedIntoDocument();
+}
+
+void HTMLAppletElement::removedFromDocument()
+{
+ if (document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->removeExtraNamedItem(m_id);
+ }
+
+ HTMLPlugInElement::removedFromDocument();
+}
+
bool HTMLAppletElement::rendererIsNeeded(const NodeRenderingContext& context)
{
if (!fastHasAttribute(codeAttr))
Modified: trunk/Source/WebCore/html/HTMLAppletElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLAppletElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLAppletElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -47,8 +47,10 @@
void setupApplet() const;
bool canEmbedJava() const;
- virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
- virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
+ virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
+
+ AtomicString m_id;
};
}
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -111,6 +111,13 @@
addCSSLength(attr, CSSPropertyWidth, "0");
addCSSLength(attr, CSSPropertyHeight, "0");
}
+ } else if (attr->name() == nameAttr) {
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->addNamedItem(value);
+ }
+ m_name = value;
} else
HTMLPlugInImageElement::parseMappedAttribute(attr);
}
@@ -212,6 +219,9 @@
if (!inDocument())
return;
+ if (document()->isHTMLDocument())
+ static_cast<HTMLDocument*>(document())->addNamedItem(m_name);
+
String width = getAttribute(widthAttr);
String height = getAttribute(heightAttr);
if (!width.isEmpty() || !height.isEmpty()) {
@@ -227,6 +237,14 @@
}
}
+void HTMLEmbedElement::removedFromDocument()
+{
+ if (document()->isHTMLDocument())
+ static_cast<HTMLDocument*>(document())->removeNamedItem(m_name);
+
+ HTMLPlugInImageElement::removedFromDocument();
+}
+
void HTMLEmbedElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
HTMLPlugInImageElement::attributeChanged(attr, preserveDecls);
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLEmbedElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -39,6 +39,7 @@
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
virtual void attributeChanged(Attribute*, bool preserveDecls = false);
virtual bool isURLAttribute(Attribute*) const;
@@ -56,8 +57,6 @@
virtual String itemValueText() const OVERRIDE;
virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
#endif
-
- virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
};
}
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -132,6 +132,9 @@
void HTMLFormElement::insertedIntoDocument()
{
+ if (document()->isHTMLDocument())
+ static_cast<HTMLDocument*>(document())->addNamedItem(m_name);
+
HTMLElement::insertedIntoDocument();
if (hasID())
@@ -140,6 +143,9 @@
void HTMLFormElement::removedFromDocument()
{
+ if (document()->isHTMLDocument())
+ static_cast<HTMLDocument*>(document())->removeNamedItem(m_name);
+
HTMLElement::removedFromDocument();
if (hasID())
@@ -378,7 +384,15 @@
setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onresetAttr)
setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attr));
- else
+ else if (attr->name() == nameAttr) {
+ const AtomicString& newName = attr->value();
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->addNamedItem(newName);
+ }
+ m_name = newName;
+ } else
HTMLElement::parseMappedAttribute(attr);
}
Modified: trunk/Source/WebCore/html/HTMLFormElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLFormElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLFormElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -131,8 +131,6 @@
virtual void willMoveToNewOwnerDocument();
virtual void didMoveToNewOwnerDocument();
- virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
-
void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
unsigned formElementIndexWithFormAttribute(Element*);
@@ -169,6 +167,8 @@
bool m_wasMalformed;
bool m_wasDemoted;
+
+ AtomicString m_name;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -133,6 +133,24 @@
else if (attrName == compositeAttr) {
if (!parseCompositeOperator(attr->value(), m_compositeOperator))
m_compositeOperator = CompositeSourceOver;
+ } else if (attrName == nameAttr) {
+ const AtomicString& newName = attr->value();
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->addNamedItem(newName);
+ }
+ m_name = newName;
+ } else if (isIdAttributeName(attr->name())) {
+ const AtomicString& newId = attr->value();
+ if (inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeExtraNamedItem(m_id);
+ document->addExtraNamedItem(newId);
+ }
+ m_id = newId;
+ // also call superclass
+ HTMLElement::parseMappedAttribute(attr);
} else
HTMLElement::parseMappedAttribute(attr);
}
@@ -179,6 +197,12 @@
void HTMLImageElement::insertedIntoDocument()
{
+ if (document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->addNamedItem(m_name);
+ document->addExtraNamedItem(m_id);
+ }
+
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
if (!m_imageLoader.image())
@@ -187,6 +211,17 @@
HTMLElement::insertedIntoDocument();
}
+void HTMLImageElement::removedFromDocument()
+{
+ if (document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->removeExtraNamedItem(m_id);
+ }
+
+ HTMLElement::removedFromDocument();
+}
+
void HTMLImageElement::insertedIntoTree(bool deep)
{
if (!m_form) {
Modified: trunk/Source/WebCore/html/HTMLImageElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLImageElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLImageElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -98,12 +98,10 @@
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
virtual void insertedIntoDocument();
+ virtual void removedFromDocument();
virtual void insertedIntoTree(bool deep);
virtual void removedFromTree(bool deep);
- virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return true; }
- virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return true; }
-
#if ENABLE(MICRODATA)
virtual String itemValueText() const OVERRIDE;
virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
@@ -111,6 +109,8 @@
HTMLImageLoader m_imageLoader;
HTMLFormElement* m_form;
+ AtomicString m_name;
+ AtomicString m_id;
CompositeOperator m_compositeOperator;
};
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-12-22 01:36:40 UTC (rev 103478)
@@ -114,10 +114,28 @@
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == borderAttr)
+ else if (attr->name() == nameAttr) {
+ const AtomicString& newName = attr->value();
+ if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->addNamedItem(newName);
+ }
+ m_name = newName;
+ } else if (attr->name() == borderAttr)
applyBorderAttribute(attr);
- else
+ else if (isIdAttributeName(attr->name())) {
+ const AtomicString& newId = attr->value();
+ if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeExtraNamedItem(m_id);
+ document->addExtraNamedItem(newId);
+ }
+ m_id = newId;
+ // also call superclass
HTMLPlugInImageElement::parseMappedAttribute(attr);
+ } else
+ HTMLPlugInImageElement::parseMappedAttribute(attr);
}
static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues)
@@ -328,11 +346,26 @@
void HTMLObjectElement::insertedIntoDocument()
{
HTMLPlugInImageElement::insertedIntoDocument();
+ if (!inDocument())
+ return;
+
+ if (isDocNamedItem() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->addNamedItem(m_name);
+ document->addExtraNamedItem(m_id);
+ }
+
FormAssociatedElement::insertedIntoDocument();
}
void HTMLObjectElement::removedFromDocument()
{
+ if (isDocNamedItem() && document()->isHTMLDocument()) {
+ HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
+ document->removeNamedItem(m_name);
+ document->removeExtraNamedItem(m_id);
+ }
+
HTMLPlugInImageElement::removedFromDocument();
FormAssociatedElement::removedFromDocument();
}
@@ -433,11 +466,11 @@
if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
if (isNamedItem) {
- document->addNamedItem(fastGetAttribute(nameAttr));
- document->addExtraNamedItem(getIdAttribute());
+ document->addNamedItem(m_name);
+ document->addExtraNamedItem(m_id);
} else {
- document->removeNamedItem(fastGetAttribute(nameAttr));
- document->removeExtraNamedItem(getIdAttribute());
+ document->removeNamedItem(m_name);
+ document->removeExtraNamedItem(m_id);
}
}
m_docNamedItem = isNamedItem;
@@ -511,8 +544,7 @@
const AtomicString& HTMLObjectElement::formControlName() const
{
- const AtomicString& name = fastGetAttribute(nameAttr);
- return name.isNull() ? emptyAtom : name;
+ return m_name.isNull() ? emptyAtom : m_name;
}
HTMLFormElement* HTMLObjectElement::virtualForm() const
Modified: trunk/Source/WebCore/html/HTMLObjectElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLObjectElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLObjectElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -107,9 +107,7 @@
virtual void setItemValueText(const String&, ExceptionCode&) OVERRIDE;
#endif
- virtual bool shouldRegisterAsNamedItem() const OVERRIDE { return isDocNamedItem(); }
- virtual bool shouldRegisterAsExtraNamedItem() const OVERRIDE { return isDocNamedItem(); }
-
+ AtomicString m_id;
String m_classId;
bool m_docNamedItem : 1;
bool m_useFallbackContent : 1;
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (103477 => 103478)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2011-12-22 01:29:17 UTC (rev 103477)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2011-12-22 01:36:40 UTC (rev 103478)
@@ -68,6 +68,9 @@
virtual RenderWidget* renderWidgetForJSBindings() = 0;
+protected:
+ AtomicString m_name;
+
private:
mutable ScriptInstance m_instance;
#if ENABLE(NETSCAPE_PLUGIN_API)