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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(Document& document, bool c
reatedByParser) | 48 PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(Document& document, bool c
reatedByParser) |
49 { | 49 { |
50 RefPtr<HTMLEmbedElement> element = adoptRef(new HTMLEmbedElement(document, c
reatedByParser)); | 50 RefPtr<HTMLEmbedElement> element = adoptRef(new HTMLEmbedElement(document, c
reatedByParser)); |
51 element->ensureUserAgentShadowRoot(); | 51 element->ensureUserAgentShadowRoot(); |
52 return element.release(); | 52 return element.release(); |
53 } | 53 } |
54 | 54 |
55 static inline RenderWidget* findWidgetRenderer(const Node* n) | 55 static inline RenderWidget* findWidgetRenderer(const Node* n) |
56 { | 56 { |
57 if (!n->renderer()) | 57 if (!n->renderer()) { |
58 do | 58 do { |
59 n = n->parentNode(); | 59 n = n->parentNode(); |
60 while (n && !n->hasTagName(objectTag)); | 60 } while (n && !isHTMLObjectElement(*n)); |
| 61 } |
61 | 62 |
62 if (n && n->renderer() && n->renderer()->isWidget()) | 63 if (n && n->renderer() && n->renderer()->isWidget()) |
63 return toRenderWidget(n->renderer()); | 64 return toRenderWidget(n->renderer()); |
64 | 65 |
65 return 0; | 66 return 0; |
66 } | 67 } |
67 | 68 |
68 RenderWidget* HTMLEmbedElement::existingRenderWidget() const | 69 RenderWidget* HTMLEmbedElement::existingRenderWidget() const |
69 { | 70 { |
70 return findWidgetRenderer(this); | 71 return findWidgetRenderer(this); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (isImageType()) | 168 if (isImageType()) |
168 return HTMLPlugInElement::rendererIsNeeded(style); | 169 return HTMLPlugInElement::rendererIsNeeded(style); |
169 | 170 |
170 LocalFrame* frame = document().frame(); | 171 LocalFrame* frame = document().frame(); |
171 if (!frame) | 172 if (!frame) |
172 return false; | 173 return false; |
173 | 174 |
174 // If my parent is an <object> and is not set to use fallback content, I | 175 // If my parent is an <object> and is not set to use fallback content, I |
175 // should be ignored and not get a renderer. | 176 // should be ignored and not get a renderer. |
176 ContainerNode* p = parentNode(); | 177 ContainerNode* p = parentNode(); |
177 if (p && p->hasTagName(objectTag)) { | 178 if (isHTMLObjectElement(p)) { |
178 ASSERT(p->renderer()); | 179 ASSERT(p->renderer()); |
179 if (!toHTMLObjectElement(p)->useFallbackContent()) { | 180 if (!toHTMLObjectElement(p)->useFallbackContent()) { |
180 ASSERT(!p->renderer()->isEmbeddedObject()); | 181 ASSERT(!p->renderer()->isEmbeddedObject()); |
181 return false; | 182 return false; |
182 } | 183 } |
183 } | 184 } |
184 return HTMLPlugInElement::rendererIsNeeded(style); | 185 return HTMLPlugInElement::rendererIsNeeded(style); |
185 } | 186 } |
186 | 187 |
187 bool HTMLEmbedElement::isURLAttribute(const Attribute& attribute) const | 188 bool HTMLEmbedElement::isURLAttribute(const Attribute& attribute) const |
188 { | 189 { |
189 return attribute.name() == srcAttr || HTMLPlugInElement::isURLAttribute(attr
ibute); | 190 return attribute.name() == srcAttr || HTMLPlugInElement::isURLAttribute(attr
ibute); |
190 } | 191 } |
191 | 192 |
192 const AtomicString HTMLEmbedElement::imageSourceURL() const | 193 const AtomicString HTMLEmbedElement::imageSourceURL() const |
193 { | 194 { |
194 return getAttribute(srcAttr); | 195 return getAttribute(srcAttr); |
195 } | 196 } |
196 | 197 |
197 bool HTMLEmbedElement::isInteractiveContent() const | 198 bool HTMLEmbedElement::isInteractiveContent() const |
198 { | 199 { |
199 return true; | 200 return true; |
200 } | 201 } |
201 | 202 |
202 bool HTMLEmbedElement::isExposed() const | 203 bool HTMLEmbedElement::isExposed() const |
203 { | 204 { |
204 // http://www.whatwg.org/specs/web-apps/current-work/#exposed | 205 // http://www.whatwg.org/specs/web-apps/current-work/#exposed |
205 for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNod
e()) { | 206 for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNod
e()) { |
206 if (ancestor->hasTagName(objectTag) && toHTMLObjectElement(ancestor)->is
Exposed()) | 207 if (isHTMLObjectElement(*ancestor) && toHTMLObjectElement(*ancestor).isE
xposed()) |
207 return false; | 208 return false; |
208 } | 209 } |
209 return true; | 210 return true; |
210 } | 211 } |
211 | 212 |
212 } | 213 } |
OLD | NEW |