| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
| 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Apple Inc. All rights reserv
ed. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 { | 45 { |
| 46 } | 46 } |
| 47 | 47 |
| 48 PassRefPtrWillBeRawPtr<HTMLEmbedElement> HTMLEmbedElement::create(Document& docu
ment, bool createdByParser) | 48 PassRefPtrWillBeRawPtr<HTMLEmbedElement> HTMLEmbedElement::create(Document& docu
ment, bool createdByParser) |
| 49 { | 49 { |
| 50 RefPtrWillBeRawPtr<HTMLEmbedElement> element = adoptRefWillBeNoop(new HTMLEm
bedElement(document, createdByParser)); | 50 RefPtrWillBeRawPtr<HTMLEmbedElement> element = adoptRefWillBeNoop(new HTMLEm
bedElement(document, createdByParser)); |
| 51 element->ensureUserAgentShadowRoot(); | 51 element->ensureUserAgentShadowRoot(); |
| 52 return element.release(); | 52 return element.release(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 static inline LayoutPart* findPartRenderer(const Node* n) | 55 static inline LayoutPart* findPartLayoutObject(const Node* n) |
| 56 { | 56 { |
| 57 if (!n->layoutObject()) | 57 if (!n->layoutObject()) |
| 58 n = Traversal<HTMLObjectElement>::firstAncestor(*n); | 58 n = Traversal<HTMLObjectElement>::firstAncestor(*n); |
| 59 | 59 |
| 60 if (n && n->layoutObject() && n->layoutObject()->isLayoutPart()) | 60 if (n && n->layoutObject() && n->layoutObject()->isLayoutPart()) |
| 61 return toLayoutPart(n->layoutObject()); | 61 return toLayoutPart(n->layoutObject()); |
| 62 | 62 |
| 63 return nullptr; | 63 return nullptr; |
| 64 } | 64 } |
| 65 | 65 |
| 66 LayoutPart* HTMLEmbedElement::existingLayoutPart() const | 66 LayoutPart* HTMLEmbedElement::existingLayoutPart() const |
| 67 { | 67 { |
| 68 return findPartRenderer(this); | 68 return findPartLayoutObject(this); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool HTMLEmbedElement::isPresentationAttribute(const QualifiedName& name) const | 71 bool HTMLEmbedElement::isPresentationAttribute(const QualifiedName& name) const |
| 72 { | 72 { |
| 73 if (name == hiddenAttr) | 73 if (name == hiddenAttr) |
| 74 return true; | 74 return true; |
| 75 return HTMLPlugInElement::isPresentationAttribute(name); | 75 return HTMLPlugInElement::isPresentationAttribute(name); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void HTMLEmbedElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) | 78 void HTMLEmbedElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
| 79 { | 79 { |
| 80 if (name == hiddenAttr) { | 80 if (name == hiddenAttr) { |
| 81 if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "true"))
{ | 81 if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "true"))
{ |
| 82 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 0,
CSSPrimitiveValue::CSS_PX); | 82 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 0,
CSSPrimitiveValue::CSS_PX); |
| 83 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, 0,
CSSPrimitiveValue::CSS_PX); | 83 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, 0,
CSSPrimitiveValue::CSS_PX); |
| 84 } | 84 } |
| 85 } else { | 85 } else { |
| 86 HTMLPlugInElement::collectStyleForPresentationAttribute(name, value, sty
le); | 86 HTMLPlugInElement::collectStyleForPresentationAttribute(name, value, sty
le); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 void HTMLEmbedElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 90 void HTMLEmbedElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
| 91 { | 91 { |
| 92 if (name == typeAttr) { | 92 if (name == typeAttr) { |
| 93 m_serviceType = value.lower(); | 93 m_serviceType = value.lower(); |
| 94 size_t pos = m_serviceType.find(";"); | 94 size_t pos = m_serviceType.find(";"); |
| 95 if (pos != kNotFound) | 95 if (pos != kNotFound) |
| 96 m_serviceType = m_serviceType.left(pos); | 96 m_serviceType = m_serviceType.left(pos); |
| 97 if (!layoutObject()) | 97 if (!layoutObject()) |
| 98 requestPluginCreationWithoutRendererIfPossible(); | 98 requestPluginCreationWithoutLayoutObjectIfPossible(); |
| 99 } else if (name == codeAttr) { | 99 } else if (name == codeAttr) { |
| 100 m_url = stripLeadingAndTrailingHTMLSpaces(value); | 100 m_url = stripLeadingAndTrailingHTMLSpaces(value); |
| 101 } else if (name == srcAttr) { | 101 } else if (name == srcAttr) { |
| 102 m_url = stripLeadingAndTrailingHTMLSpaces(value); | 102 m_url = stripLeadingAndTrailingHTMLSpaces(value); |
| 103 if (layoutObject() && isImageType()) { | 103 if (layoutObject() && isImageType()) { |
| 104 if (!m_imageLoader) | 104 if (!m_imageLoader) |
| 105 m_imageLoader = HTMLImageLoader::create(this); | 105 m_imageLoader = HTMLImageLoader::create(this); |
| 106 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); | 106 m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousEr
ror); |
| 107 } | 107 } |
| 108 } else { | 108 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 135 if (!allowedToLoadFrameURL(m_url)) | 135 if (!allowedToLoadFrameURL(m_url)) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 // FIXME: These should be joined into a PluginParameters class. | 138 // FIXME: These should be joined into a PluginParameters class. |
| 139 Vector<String> paramNames; | 139 Vector<String> paramNames; |
| 140 Vector<String> paramValues; | 140 Vector<String> paramValues; |
| 141 parametersForPlugin(paramNames, paramValues); | 141 parametersForPlugin(paramNames, paramValues); |
| 142 | 142 |
| 143 RefPtrWillBeRawPtr<HTMLEmbedElement> protect(this); // Loading the plugin mi
ght remove us from the document. | 143 RefPtrWillBeRawPtr<HTMLEmbedElement> protect(this); // Loading the plugin mi
ght remove us from the document. |
| 144 | 144 |
| 145 // FIXME: Can we not have renderer here now that beforeload events are gone? | 145 // FIXME: Can we not have layoutObject here now that beforeload events are g
one? |
| 146 if (!layoutObject()) | 146 if (!layoutObject()) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 requestObject(m_url, m_serviceType, paramNames, paramValues); | 149 requestObject(m_url, m_serviceType, paramNames, paramValues); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool HTMLEmbedElement::layoutObjectIsNeeded(const ComputedStyle& style) | 152 bool HTMLEmbedElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 153 { | 153 { |
| 154 if (isImageType()) | 154 if (isImageType()) |
| 155 return HTMLPlugInElement::layoutObjectIsNeeded(style); | 155 return HTMLPlugInElement::layoutObjectIsNeeded(style); |
| 156 | 156 |
| 157 // If my parent is an <object> and is not set to use fallback content, I | 157 // If my parent is an <object> and is not set to use fallback content, I |
| 158 // should be ignored and not get a renderer. | 158 // should be ignored and not get a layoutObject. |
| 159 ContainerNode* p = parentNode(); | 159 ContainerNode* p = parentNode(); |
| 160 if (isHTMLObjectElement(p)) { | 160 if (isHTMLObjectElement(p)) { |
| 161 ASSERT(p->layoutObject()); | 161 ASSERT(p->layoutObject()); |
| 162 if (!toHTMLObjectElement(p)->useFallbackContent()) { | 162 if (!toHTMLObjectElement(p)->useFallbackContent()) { |
| 163 ASSERT(!p->layoutObject()->isEmbeddedObject()); | 163 ASSERT(!p->layoutObject()->isEmbeddedObject()); |
| 164 return false; | 164 return false; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 return HTMLPlugInElement::layoutObjectIsNeeded(style); | 167 return HTMLPlugInElement::layoutObjectIsNeeded(style); |
| 168 } | 168 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 186 { | 186 { |
| 187 // http://www.whatwg.org/specs/web-apps/current-work/#exposed | 187 // http://www.whatwg.org/specs/web-apps/current-work/#exposed |
| 188 for (HTMLObjectElement* object = Traversal<HTMLObjectElement>::firstAncestor
(*this); object; object = Traversal<HTMLObjectElement>::firstAncestor(*object))
{ | 188 for (HTMLObjectElement* object = Traversal<HTMLObjectElement>::firstAncestor
(*this); object; object = Traversal<HTMLObjectElement>::firstAncestor(*object))
{ |
| 189 if (object->isExposed()) | 189 if (object->isExposed()) |
| 190 return false; | 190 return false; |
| 191 } | 191 } |
| 192 return true; | 192 return true; |
| 193 } | 193 } |
| 194 | 194 |
| 195 } | 195 } |
| OLD | NEW |