| Index: Source/core/html/HTMLObjectElement.cpp
|
| diff --git a/Source/core/html/HTMLObjectElement.cpp b/Source/core/html/HTMLObjectElement.cpp
|
| index 1d9a87adf4b710dde3c07f6c878c1e374f067b53..e6f66a85f54d830dfe1570869cbf558b2cd01d3e 100644
|
| --- a/Source/core/html/HTMLObjectElement.cpp
|
| +++ b/Source/core/html/HTMLObjectElement.cpp
|
| @@ -50,6 +50,7 @@ using namespace HTMLNames;
|
|
|
| inline HTMLObjectElement::HTMLObjectElement(Document& document, HTMLFormElement* form, bool createdByParser)
|
| : HTMLPlugInElement(objectTag, document, createdByParser, ShouldNotPreferPlugInsForImages)
|
| + , m_docNamedItem(true)
|
| , m_useFallbackContent(false)
|
| {
|
| setForm(form ? form : findFormAncestor());
|
| @@ -333,6 +334,7 @@ void HTMLObjectElement::removedFrom(ContainerNode* insertionPoint)
|
|
|
| void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
|
| {
|
| + updateDocNamedItem();
|
| if (inDocument() && !useFallbackContent()) {
|
| setNeedsWidgetUpdate(true);
|
| setNeedsStyleRecalc();
|
| @@ -386,6 +388,66 @@ void HTMLObjectElement::renderFallbackContent()
|
| reattachFallbackContent();
|
| }
|
|
|
| +// FIXME: This should be removed, all callers are almost certainly wrong.
|
| +static bool isRecognizedTagName(const QualifiedName& tagName)
|
| +{
|
| + DEFINE_STATIC_LOCAL(HashSet<StringImpl*>, tagList, ());
|
| + if (tagList.isEmpty()) {
|
| + const QualifiedName* const* tags = HTMLNames::getHTMLTags();
|
| + for (size_t i = 0; i < HTMLNames::HTMLTagsCount; i++) {
|
| + if (*tags[i] == bgsoundTag
|
| + || *tags[i] == commandTag
|
| + || *tags[i] == detailsTag
|
| + || *tags[i] == figcaptionTag
|
| + || *tags[i] == figureTag
|
| + || *tags[i] == summaryTag
|
| + || *tags[i] == trackTag) {
|
| + // Even though we have atoms for these tags, we don't want to
|
| + // treat them as "recognized tags" for the purpose of parsing
|
| + // because that changes how we parse documents.
|
| + continue;
|
| + }
|
| + tagList.add(tags[i]->localName().impl());
|
| + }
|
| + }
|
| + return tagList.contains(tagName.localName().impl());
|
| +}
|
| +
|
| +void HTMLObjectElement::updateDocNamedItem()
|
| +{
|
| + // The rule is "<object> elements with no children other than
|
| + // <param> elements, unknown elements and whitespace can be
|
| + // found by name in a document, and other <object> elements cannot."
|
| + bool wasNamedItem = m_docNamedItem;
|
| + bool isNamedItem = true;
|
| + Node* child = firstChild();
|
| + while (child && isNamedItem) {
|
| + if (child->isElementNode()) {
|
| + Element* element = toElement(child);
|
| + // FIXME: Use of isRecognizedTagName is almost certainly wrong here.
|
| + if (isRecognizedTagName(element->tagQName()) && !element->hasTagName(paramTag))
|
| + isNamedItem = false;
|
| + } else if (child->isTextNode()) {
|
| + if (!toText(child)->containsOnlyWhitespace())
|
| + isNamedItem = false;
|
| + } else {
|
| + isNamedItem = false;
|
| + }
|
| + child = child->nextSibling();
|
| + }
|
| + if (isNamedItem != wasNamedItem && document().isHTMLDocument()) {
|
| + HTMLDocument& document = toHTMLDocument(this->document());
|
| + if (isNamedItem) {
|
| + document.addNamedItem(getNameAttribute());
|
| + document.addExtraNamedItem(getIdAttribute());
|
| + } else {
|
| + document.removeNamedItem(getNameAttribute());
|
| + document.removeExtraNamedItem(getIdAttribute());
|
| + }
|
| + }
|
| + m_docNamedItem = isNamedItem;
|
| +}
|
| +
|
| bool HTMLObjectElement::containsJavaApplet() const
|
| {
|
| if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr)))
|
|
|