darin | 9efc76e | 2007-05-29 17:41:17 +0000 | [diff] [blame] | 1 | /* |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 | * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
aestes@apple.com | 5e14373 | 2011-03-25 23:07:43 +0000 | [diff] [blame] | 5 | * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. |
hausmann@webkit.org | f696447 | 2008-09-29 12:47:08 +0000 | [diff] [blame] | 6 | * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Library General Public |
| 10 | * License as published by the Free Software Foundation; either |
| 11 | * version 2 of the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This library is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * Library General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU Library General Public License |
| 19 | * along with this library; see the file COPYING.LIB. If not, write to |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 20 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | * Boston, MA 02110-1301, USA. |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 22 | */ |
darin | 9efc76e | 2007-05-29 17:41:17 +0000 | [diff] [blame] | 23 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 24 | #include "config.h" |
| 25 | #include "HTMLObjectElement.h" |
| 26 | |
weinig@apple.com | c360893 | 2010-05-19 17:48:06 +0000 | [diff] [blame] | 27 | #include "Attribute.h" |
ddkilzer@apple.com | 3c25011 | 2011-01-04 06:20:17 +0000 | [diff] [blame] | 28 | #include "CSSValueKeywords.h" |
abarth@webkit.org | 401a379 | 2013-03-03 10:12:59 +0000 | [diff] [blame] | 29 | #include "CachedImage.h" |
jer.noble@apple.com | 63353b7 | 2012-07-26 19:01:20 +0000 | [diff] [blame] | 30 | #include "Chrome.h" |
| 31 | #include "ChromeClient.h" |
antti@apple.com | 0494cf8 | 2013-08-31 14:12:00 +0000 | [diff] [blame] | 32 | #include "ElementIterator.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 33 | #include "EventNames.h" |
eseidel | 3764f87 | 2006-07-27 05:26:00 +0000 | [diff] [blame] | 34 | #include "ExceptionCode.h" |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 35 | #include "FormDataList.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 36 | #include "Frame.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 37 | #include "HTMLDocument.h" |
weinig | e791808 | 2007-07-18 19:56:40 +0000 | [diff] [blame] | 38 | #include "HTMLFormElement.h" |
eseidel | 8494362 | 2006-05-15 23:23:42 +0000 | [diff] [blame] | 39 | #include "HTMLImageLoader.h" |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 40 | #include "HTMLMetaElement.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 41 | #include "HTMLNames.h" |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 42 | #include "HTMLParamElement.h" |
darin@apple.com | 7b7981b | 2010-10-01 00:04:02 +0000 | [diff] [blame] | 43 | #include "HTMLParserIdioms.h" |
weinig | 62f94be | 2007-07-18 20:37:20 +0000 | [diff] [blame] | 44 | #include "MIMETypeRegistry.h" |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 45 | #include "NodeList.h" |
| 46 | #include "Page.h" |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 47 | #include "PluginViewBase.h" |
simon.fraser@apple.com | 385f97e | 2010-01-07 21:57:12 +0000 | [diff] [blame] | 48 | #include "RenderEmbeddedObject.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 49 | #include "RenderImage.h" |
eseidel | 409f430 | 2006-05-12 22:56:41 +0000 | [diff] [blame] | 50 | #include "RenderWidget.h" |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 51 | #include "Settings.h" |
akling@apple.com | 7f81b1e | 2013-09-06 17:23:03 +0000 | [diff] [blame] | 52 | #include "SubframeLoader.h" |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 53 | #include "Text.h" |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 54 | #include "Widget.h" |
akling@apple.com | f851598 | 2013-09-02 18:50:01 +0000 | [diff] [blame] | 55 | #include <wtf/Ref.h> |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 56 | |
dbates@webkit.org | 1edd81d | 2013-12-18 00:15:02 +0000 | [diff] [blame] | 57 | #if PLATFORM(IOS) |
| 58 | #include "RuntimeApplicationChecksIOS.h" |
| 59 | #include "WebCoreSystemInterface.h" |
| 60 | #endif |
| 61 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 62 | namespace WebCore { |
| 63 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 64 | using namespace HTMLNames; |
| 65 | |
weinig@apple.com | 4917883 | 2013-09-15 00:39:29 +0000 | [diff] [blame] | 66 | inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser) |
weinig@apple.com | dedf67e | 2013-09-15 05:23:01 +0000 | [diff] [blame] | 67 | : HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages) |
ddkilzer@apple.com | d44054d | 2008-06-30 21:12:55 +0000 | [diff] [blame] | 68 | , m_docNamedItem(true) |
eseidel | 3764f87 | 2006-07-27 05:26:00 +0000 | [diff] [blame] | 69 | , m_useFallbackContent(false) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 70 | { |
jchaffraix@webkit.org | 94d95b0 | 2008-12-04 22:39:05 +0000 | [diff] [blame] | 71 | ASSERT(hasTagName(objectTag)); |
rniwa@webkit.org | f7bf376 | 2013-08-29 01:35:21 +0000 | [diff] [blame] | 72 | setForm(form ? form : HTMLFormElement::findClosestFormAncestor(*this)); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 73 | } |
| 74 | |
tkent@chromium.org | 995765c | 2010-12-07 09:40:23 +0000 | [diff] [blame] | 75 | inline HTMLObjectElement::~HTMLObjectElement() |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 76 | { |
tkent@chromium.org | 995765c | 2010-12-07 09:40:23 +0000 | [diff] [blame] | 77 | } |
| 78 | |
weinig@apple.com | 4917883 | 2013-09-15 00:39:29 +0000 | [diff] [blame] | 79 | PassRefPtr<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tagName, Document& document, HTMLFormElement* form, bool createdByParser) |
tkent@chromium.org | 995765c | 2010-12-07 09:40:23 +0000 | [diff] [blame] | 80 | { |
| 81 | return adoptRef(new HTMLObjectElement(tagName, document, form, createdByParser)); |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 82 | } |
| 83 | |
fsamuel@chromium.org | 8ecfba3 | 2012-08-08 00:54:36 +0000 | [diff] [blame] | 84 | RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 85 | { |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 86 | document().updateLayoutIgnorePendingStylesheets(); |
akling@apple.com | b95111f | 2013-09-12 05:21:14 +0000 | [diff] [blame] | 87 | return renderWidget(); // This will return 0 if the renderer is not a RenderWidget. |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 88 | } |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 89 | |
kling@webkit.org | 44bc0dd | 2012-02-28 22:21:02 +0000 | [diff] [blame] | 90 | bool HTMLObjectElement::isPresentationAttribute(const QualifiedName& name) const |
kling@webkit.org | 11f2556 | 2012-02-13 10:36:55 +0000 | [diff] [blame] | 91 | { |
kling@webkit.org | 44bc0dd | 2012-02-28 22:21:02 +0000 | [diff] [blame] | 92 | if (name == borderAttr) |
kling@webkit.org | 11f2556 | 2012-02-13 10:36:55 +0000 | [diff] [blame] | 93 | return true; |
kling@webkit.org | 44bc0dd | 2012-02-28 22:21:02 +0000 | [diff] [blame] | 94 | return HTMLPlugInImageElement::isPresentationAttribute(name); |
kling@webkit.org | 11f2556 | 2012-02-13 10:36:55 +0000 | [diff] [blame] | 95 | } |
| 96 | |
antti@apple.com | e5428c5 | 2013-11-28 20:53:22 +0000 | [diff] [blame] | 97 | void HTMLObjectElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style) |
kling@webkit.org | 8b0e843 | 2012-02-11 19:29:49 +0000 | [diff] [blame] | 98 | { |
akling@apple.com | b75eeea | 2013-02-23 17:57:50 +0000 | [diff] [blame] | 99 | if (name == borderAttr) |
| 100 | applyBorderAttributeToStyle(value, style); |
kling@webkit.org | 8b0e843 | 2012-02-11 19:29:49 +0000 | [diff] [blame] | 101 | else |
akling@apple.com | b75eeea | 2013-02-23 17:57:50 +0000 | [diff] [blame] | 102 | HTMLPlugInImageElement::collectStyleForPresentationAttribute(name, value, style); |
kling@webkit.org | 8b0e843 | 2012-02-11 19:29:49 +0000 | [diff] [blame] | 103 | } |
| 104 | |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 105 | void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 106 | { |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 107 | if (name == formAttr) |
adamk@chromium.org | f023653 | 2011-08-18 10:22:01 +0000 | [diff] [blame] | 108 | formAttributeChanged(); |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 109 | else if (name == typeAttr) { |
| 110 | m_serviceType = value.lower(); |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 111 | size_t pos = m_serviceType.find(";"); |
barraclough@apple.com | d643fde | 2010-08-16 23:31:33 +0000 | [diff] [blame] | 112 | if (pos != notFound) |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 113 | m_serviceType = m_serviceType.left(pos); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 114 | if (renderer()) |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 115 | setNeedsWidgetUpdate(true); |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 116 | } else if (name == dataAttr) { |
| 117 | m_url = stripLeadingAndTrailingHTMLSpaces(value); |
antti@apple.com | 4942ea5 | 2013-12-20 14:44:23 +0000 | [diff] [blame] | 118 | document().updateStyleIfNeeded(); |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 119 | if (renderer()) { |
| 120 | setNeedsWidgetUpdate(true); |
| 121 | if (isImageType()) { |
| 122 | if (!m_imageLoader) |
akling@apple.com | 68b7ee0 | 2014-02-05 18:25:26 +0000 | [diff] [blame] | 123 | m_imageLoader = adoptPtr(new HTMLImageLoader(*this)); |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 124 | m_imageLoader->updateFromElementIgnoringPreviousError(); |
| 125 | } |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 126 | } |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 127 | } else if (name == classidAttr) { |
| 128 | m_classId = value; |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 129 | if (renderer()) |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 130 | setNeedsWidgetUpdate(true); |
keishi@webkit.org | b61c383 | 2013-03-29 09:59:09 +0000 | [diff] [blame] | 131 | } else if (name == onbeforeloadAttr) |
darin@apple.com | 197597bb | 2013-09-21 18:25:43 +0000 | [diff] [blame] | 132 | setAttributeEventListener(eventNames().beforeloadEvent, name, value); |
kling@webkit.org | b897277 | 2011-12-23 21:36:59 +0000 | [diff] [blame] | 133 | else |
akling@apple.com | 43e9d04 | 2012-11-18 16:55:06 +0000 | [diff] [blame] | 134 | HTMLPlugInImageElement::parseAttribute(name, value); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 135 | } |
| 136 | |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 137 | static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues) |
| 138 | { |
| 139 | // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e. Real and WMP |
| 140 | // require "src" attribute). |
| 141 | int srcIndex = -1, dataIndex = -1; |
| 142 | for (unsigned int i = 0; i < paramNames->size(); ++i) { |
| 143 | if (equalIgnoringCase((*paramNames)[i], "src")) |
| 144 | srcIndex = i; |
| 145 | else if (equalIgnoringCase((*paramNames)[i], "data")) |
| 146 | dataIndex = i; |
| 147 | } |
| 148 | |
| 149 | if (srcIndex == -1 && dataIndex != -1) { |
| 150 | paramNames->append("src"); |
| 151 | paramValues->append((*paramValues)[dataIndex]); |
| 152 | } |
| 153 | } |
| 154 | |
dbates@webkit.org | 1edd81d | 2013-12-18 00:15:02 +0000 | [diff] [blame] | 155 | #if PLATFORM(IOS) |
| 156 | static bool shouldNotPerformURLAdjustment() |
| 157 | { |
| 158 | static bool shouldNotPerformURLAdjustment = applicationIsNASAHD() && !iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_5_0); |
| 159 | return shouldNotPerformURLAdjustment; |
| 160 | } |
| 161 | #endif |
| 162 | |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 163 | // FIXME: This function should not deal with url or serviceType! |
| 164 | void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType) |
| 165 | { |
| 166 | HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames; |
dpranke@chromium.org | 9a91c97 | 2010-09-10 07:48:20 +0000 | [diff] [blame] | 167 | String urlParameter; |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 168 | |
| 169 | // Scan the PARAM children and store their name/value pairs. |
| 170 | // Get the URL and type from the params if we don't already have them. |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 171 | for (auto& param : childrenOfType<HTMLParamElement>(*this)) { |
| 172 | String name = param.name(); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 173 | if (name.isEmpty()) |
| 174 | continue; |
| 175 | |
| 176 | uniqueParamNames.add(name.impl()); |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 177 | paramNames.append(param.name()); |
| 178 | paramValues.append(param.value()); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 179 | |
| 180 | // FIXME: url adjustment does not belong in this function. |
dpranke@chromium.org | 9a91c97 | 2010-09-10 07:48:20 +0000 | [diff] [blame] | 181 | if (url.isEmpty() && urlParameter.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url"))) |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 182 | urlParameter = stripLeadingAndTrailingHTMLSpaces(param.value()); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 183 | // FIXME: serviceType calculation does not belong in this function. |
| 184 | if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) { |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 185 | serviceType = param.value(); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 186 | size_t pos = serviceType.find(";"); |
| 187 | if (pos != notFound) |
| 188 | serviceType = serviceType.left(pos); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | // When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attribute in the tag |
| 193 | // points to the Java plugin itself (an ActiveX component) while the actual applet CODEBASE is |
| 194 | // in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means |
| 195 | // we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM, |
| 196 | // else our Java plugin will misinterpret it. [4004531] |
| 197 | String codebase; |
| 198 | if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) { |
| 199 | codebase = "codebase"; |
| 200 | uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already |
| 201 | } |
| 202 | |
| 203 | // Turn the attributes of the <object> element into arrays, but don't override <param> values. |
caio.oliveira@openbossa.org | 5fc3ab92 | 2012-02-06 20:42:40 +0000 | [diff] [blame] | 204 | if (hasAttributes()) { |
benjamin@webkit.org | 64c9533 | 2014-01-21 01:31:37 +0000 | [diff] [blame] | 205 | for (const Attribute& attribute : attributesIterator()) { |
akling@apple.com | ae4fef1 | 2013-08-08 17:25:50 +0000 | [diff] [blame] | 206 | const AtomicString& name = attribute.name().localName(); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 207 | if (!uniqueParamNames.contains(name.impl())) { |
| 208 | paramNames.append(name.string()); |
akling@apple.com | ae4fef1 | 2013-08-08 17:25:50 +0000 | [diff] [blame] | 209 | paramValues.append(attribute.value().string()); |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 210 | } |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | mapDataParamToSrc(¶mNames, ¶mValues); |
| 215 | |
dpranke@chromium.org | 9a91c97 | 2010-09-10 07:48:20 +0000 | [diff] [blame] | 216 | // HTML5 says that an object resource's URL is specified by the object's data |
| 217 | // attribute, not by a param element. However, for compatibility, allow the |
| 218 | // resource's URL to be given by a param named "src", "movie", "code" or "url" |
| 219 | // if we know that resource points to a plug-in. |
dbates@webkit.org | 1edd81d | 2013-12-18 00:15:02 +0000 | [diff] [blame] | 220 | #if PLATFORM(IOS) |
| 221 | if (shouldNotPerformURLAdjustment()) |
| 222 | return; |
| 223 | #endif |
| 224 | |
dpranke@chromium.org | 9a91c97 | 2010-09-10 07:48:20 +0000 | [diff] [blame] | 225 | if (url.isEmpty() && !urlParameter.isEmpty()) { |
akling@apple.com | 7f81b1e | 2013-09-06 17:23:03 +0000 | [diff] [blame] | 226 | SubframeLoader& loader = document().frame()->loader().subframeLoader(); |
| 227 | if (loader.resourceWillUsePlugin(urlParameter, serviceType, shouldPreferPlugInsForImages())) |
dpranke@chromium.org | 9a91c97 | 2010-09-10 07:48:20 +0000 | [diff] [blame] | 228 | url = urlParameter; |
| 229 | } |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | |
| 233 | bool HTMLObjectElement::hasFallbackContent() const |
| 234 | { |
| 235 | for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 236 | // Ignore whitespace-only text, and <param> tags, any other content is fallback content. |
| 237 | if (child->isTextNode()) { |
commit-queue@webkit.org | 9b335e4 | 2012-02-12 11:27:56 +0000 | [diff] [blame] | 238 | if (!toText(child)->containsOnlyWhitespace()) |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 239 | return true; |
| 240 | } else if (!child->hasTagName(paramTag)) |
| 241 | return true; |
| 242 | } |
| 243 | return false; |
| 244 | } |
aestes@apple.com | ad6310a | 2010-10-28 07:47:56 +0000 | [diff] [blame] | 245 | |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 246 | bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk() |
| 247 | { |
| 248 | // This site-specific hack maintains compatibility with Mac OS X Wiki Server, |
| 249 | // which embeds QuickTime movies using an object tag containing QuickTime's |
| 250 | // ActiveX classid. Treat this classid as valid only if OS X Server's unique |
| 251 | // 'generator' meta tag is present. Only apply this quirk if there is no |
| 252 | // fallback content, which ensures the quirk will disable itself if Wiki |
| 253 | // Server is updated to generate an alternate embed tag as fallback content. |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 254 | if (!document().page() |
| 255 | || !document().page()->settings().needsSiteSpecificQuirks() |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 256 | || hasFallbackContent() |
| 257 | || !equalIgnoringCase(classId(), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")) |
| 258 | return false; |
| 259 | |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 260 | RefPtr<NodeList> metaElements = document().getElementsByTagName(HTMLNames::metaTag.localName()); |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 261 | unsigned length = metaElements->length(); |
| 262 | for (unsigned i = 0; i < length; ++i) { |
gyuyoung.kim@samsung.com | b86fc58 | 2013-11-21 04:45:49 +0000 | [diff] [blame] | 263 | HTMLMetaElement& metaElement = toHTMLMetaElement(*metaElements->item(i)); |
| 264 | if (equalIgnoringCase(metaElement.name(), "generator") && metaElement.content().startsWith("Mac OS X Server Web Services Server", false)) |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 265 | return true; |
| 266 | } |
| 267 | |
| 268 | return false; |
| 269 | } |
| 270 | |
aestes@apple.com | 07b47f1 | 2011-04-01 00:12:53 +0000 | [diff] [blame] | 271 | bool HTMLObjectElement::hasValidClassId() |
aestes@apple.com | ad6310a | 2010-10-28 07:47:56 +0000 | [diff] [blame] | 272 | { |
aestes@apple.com | 07b47f1 | 2011-04-01 00:12:53 +0000 | [diff] [blame] | 273 | if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType()) && classId().startsWith("java:", false)) |
| 274 | return true; |
aestes@apple.com | 96eecde | 2011-05-25 00:48:00 +0000 | [diff] [blame] | 275 | |
| 276 | if (shouldAllowQuickTimeClassIdQuirk()) |
| 277 | return true; |
aestes@apple.com | 07b47f1 | 2011-04-01 00:12:53 +0000 | [diff] [blame] | 278 | |
aestes@apple.com | 9339cb0 | 2010-10-28 08:16:33 +0000 | [diff] [blame] | 279 | // HTML5 says that fallback content should be rendered if a non-empty |
| 280 | // classid is specified for which the UA can't find a suitable plug-in. |
commit-queue@webkit.org | 2d9e5b7 | 2011-05-24 01:52:11 +0000 | [diff] [blame] | 281 | return classId().isEmpty(); |
aestes@apple.com | ad6310a | 2010-10-28 07:47:56 +0000 | [diff] [blame] | 282 | } |
eric@webkit.org | 918affb | 2010-09-03 04:04:29 +0000 | [diff] [blame] | 283 | |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 284 | // FIXME: This should be unified with HTMLEmbedElement::updateWidget and |
| 285 | // moved down into HTMLPluginImageElement.cpp |
abarth@webkit.org | 12c7af0 | 2011-02-02 08:00:19 +0000 | [diff] [blame] | 286 | void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption) |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 287 | { |
timothy_horton@apple.com | 7adfc61 | 2013-07-23 01:02:59 +0000 | [diff] [blame] | 288 | ASSERT(!renderEmbeddedObject()->isPluginUnavailable()); |
eric@webkit.org | a4c0208 | 2011-12-15 22:00:09 +0000 | [diff] [blame] | 289 | ASSERT(needsWidgetUpdate()); |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 290 | setNeedsWidgetUpdate(false); |
| 291 | // FIXME: This should ASSERT isFinishedParsingChildren() instead. |
| 292 | if (!isFinishedParsingChildren()) |
| 293 | return; |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 294 | |
| 295 | // FIXME: I'm not sure it's ever possible to get into updateWidget during a |
| 296 | // removal, but just in case we should avoid loading the frame to prevent |
| 297 | // security bugs. |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 298 | if (!SubframeLoadingDisabler::canLoadFrame(*this)) |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 299 | return; |
| 300 | |
aestes@apple.com | 1177849 | 2010-10-28 06:15:09 +0000 | [diff] [blame] | 301 | String url = this->url(); |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 302 | String serviceType = this->serviceType(); |
| 303 | |
| 304 | // FIXME: These should be joined into a PluginParameters class. |
| 305 | Vector<String> paramNames; |
| 306 | Vector<String> paramValues; |
| 307 | parametersForPlugin(paramNames, paramValues, url, serviceType); |
| 308 | |
| 309 | // Note: url is modified above by parametersForPlugin. |
| 310 | if (!allowedToLoadFrameURL(url)) |
| 311 | return; |
| 312 | |
aestes@apple.com | 87b89d1 | 2012-02-08 20:20:41 +0000 | [diff] [blame] | 313 | // FIXME: It's sadness that we have this special case here. |
| 314 | // See http://trac.webkit.org/changeset/25128 and |
| 315 | // plugins/netscape-plugin-setwindow-size.html |
| 316 | if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) { |
| 317 | // Ensure updateWidget() is called again during layout to create the Netscape plug-in. |
| 318 | setNeedsWidgetUpdate(true); |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 319 | return; |
aestes@apple.com | 87b89d1 | 2012-02-08 20:20:41 +0000 | [diff] [blame] | 320 | } |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 321 | |
akling@apple.com | f851598 | 2013-09-02 18:50:01 +0000 | [diff] [blame] | 322 | Ref<HTMLObjectElement> protect(*this); // beforeload and plugin loading can make arbitrary DOM mutations. |
eric@webkit.org | ce44752 | 2012-01-25 23:29:53 +0000 | [diff] [blame] | 323 | bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url); |
eric@webkit.org | 1f8035c3 | 2012-01-26 00:00:03 +0000 | [diff] [blame] | 324 | if (!renderer()) // Do not load the plugin if beforeload removed this element or its renderer. |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 325 | return; |
| 326 | |
eric.carlson@apple.com | 6bfffe0 | 2013-11-28 01:05:35 +0000 | [diff] [blame] | 327 | bool success = beforeLoadAllowedLoad && hasValidClassId(); |
| 328 | if (success) |
| 329 | success = requestObject(url, serviceType, paramNames, paramValues); |
akling@apple.com | 2cbd1e9 | 2013-11-05 09:29:50 +0000 | [diff] [blame] | 330 | if (!success && hasFallbackContent()) |
eric@webkit.org | 4ffb1fe | 2010-09-03 04:28:12 +0000 | [diff] [blame] | 331 | renderFallbackContent(); |
| 332 | } |
| 333 | |
akling@apple.com | 2e55ebf | 2013-10-04 18:51:32 +0000 | [diff] [blame] | 334 | Node::InsertionNotificationRequest HTMLObjectElement::insertedInto(ContainerNode& insertionPoint) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 335 | { |
commit-queue@webkit.org | 9ea0080 | 2012-04-17 06:40:55 +0000 | [diff] [blame] | 336 | HTMLPlugInImageElement::insertedInto(insertionPoint); |
| 337 | FormAssociatedElement::insertedInto(insertionPoint); |
| 338 | return InsertionDone; |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 339 | } |
| 340 | |
akling@apple.com | 2e55ebf | 2013-10-04 18:51:32 +0000 | [diff] [blame] | 341 | void HTMLObjectElement::removedFrom(ContainerNode& insertionPoint) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 342 | { |
commit-queue@webkit.org | 9ea0080 | 2012-04-17 06:40:55 +0000 | [diff] [blame] | 343 | HTMLPlugInImageElement::removedFrom(insertionPoint); |
| 344 | FormAssociatedElement::removedFrom(insertionPoint); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 345 | } |
| 346 | |
antti@apple.com | 1acee92 | 2013-09-02 15:17:50 +0000 | [diff] [blame] | 347 | void HTMLObjectElement::childrenChanged(const ChildChange& change) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 348 | { |
| 349 | updateDocNamedItem(); |
eric@webkit.org | 0389292 | 2010-09-02 10:05:36 +0000 | [diff] [blame] | 350 | if (inDocument() && !useFallbackContent()) { |
eric@webkit.org | 1402eb4 | 2010-09-02 09:10:21 +0000 | [diff] [blame] | 351 | setNeedsWidgetUpdate(true); |
hyatt@apple.com | f6d72f3 | 2009-04-10 00:05:02 +0000 | [diff] [blame] | 352 | setNeedsStyleRecalc(); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 353 | } |
antti@apple.com | 1acee92 | 2013-09-02 15:17:50 +0000 | [diff] [blame] | 354 | HTMLPlugInImageElement::childrenChanged(change); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 355 | } |
| 356 | |
kling@webkit.org | d8a6d15 | 2012-05-08 16:27:04 +0000 | [diff] [blame] | 357 | bool HTMLObjectElement::isURLAttribute(const Attribute& attribute) const |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 358 | { |
kling@webkit.org | d8a6d15 | 2012-05-08 16:27:04 +0000 | [diff] [blame] | 359 | return attribute.name() == dataAttr || (attribute.name() == usemapAttr && attribute.value().string()[0] != '#') || HTMLPlugInImageElement::isURLAttribute(attribute); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 360 | } |
| 361 | |
commit-queue@webkit.org | 25fd37e | 2013-03-13 21:16:50 +0000 | [diff] [blame] | 362 | const AtomicString& HTMLObjectElement::imageSourceURL() const |
adele | ae488bf | 2007-11-06 05:43:16 +0000 | [diff] [blame] | 363 | { |
commit-queue@webkit.org | 25fd37e | 2013-03-13 21:16:50 +0000 | [diff] [blame] | 364 | return getAttribute(dataAttr); |
adele | ae488bf | 2007-11-06 05:43:16 +0000 | [diff] [blame] | 365 | } |
| 366 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 367 | void HTMLObjectElement::renderFallbackContent() |
| 368 | { |
eric@webkit.org | 0389292 | 2010-09-02 10:05:36 +0000 | [diff] [blame] | 369 | if (useFallbackContent()) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 370 | return; |
aestes@apple.com | 4000bef | 2010-06-23 20:03:40 +0000 | [diff] [blame] | 371 | |
| 372 | if (!inDocument()) |
| 373 | return; |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 374 | |
antti@apple.com | ef23976 | 2014-01-01 21:20:51 +0000 | [diff] [blame] | 375 | setNeedsStyleRecalc(ReconstructRenderTree); |
| 376 | |
hyatt@apple.com | 8be6225 | 2008-02-21 01:59:14 +0000 | [diff] [blame] | 377 | // Before we give up and use fallback content, check to see if this is a MIME type issue. |
inferno@chromium.org | 28ad8d8 | 2010-11-17 20:11:56 +0000 | [diff] [blame] | 378 | if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->status() != CachedResource::LoadError) { |
hyatt@apple.com | 8be6225 | 2008-02-21 01:59:14 +0000 | [diff] [blame] | 379 | m_serviceType = m_imageLoader->image()->response().mimeType(); |
| 380 | if (!isImageType()) { |
cdn@chromium.org | 88285f8 | 2011-05-18 00:53:22 +0000 | [diff] [blame] | 381 | // If we don't think we have an image type anymore, then clear the image from the loader. |
morrita@google.com | 75203b4 | 2011-05-24 03:31:34 +0000 | [diff] [blame] | 382 | m_imageLoader->setImage(0); |
hyatt@apple.com | 8be6225 | 2008-02-21 01:59:14 +0000 | [diff] [blame] | 383 | return; |
| 384 | } |
| 385 | } |
| 386 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 387 | m_useFallbackContent = true; |
antti@apple.com | 83cd80d | 2014-01-08 07:33:10 +0000 | [diff] [blame] | 388 | |
| 389 | // This is here mainly to keep acid2 non-flaky. A style recalc is required to make fallback resources to load. Without forcing |
| 390 | // this may happen after all the other resources have been loaded and the document is already considered complete. |
| 391 | // FIXME: Disentangle fallback content handling from style recalcs. |
| 392 | document().updateStyleIfNeeded(); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 393 | } |
| 394 | |
eric@webkit.org | ef17f4b | 2010-08-25 06:57:14 +0000 | [diff] [blame] | 395 | // FIXME: This should be removed, all callers are almost certainly wrong. |
| 396 | static bool isRecognizedTagName(const QualifiedName& tagName) |
| 397 | { |
| 398 | DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ()); |
| 399 | if (tagList.isEmpty()) { |
darin@apple.com | 5b7f307 | 2013-09-15 08:50:06 +0000 | [diff] [blame] | 400 | const QualifiedName* const * tags = HTMLNames::getHTMLTags(); |
benjamin@webkit.org | a7a9b07 | 2012-07-26 22:41:04 +0000 | [diff] [blame] | 401 | for (size_t i = 0; i < HTMLNames::HTMLTagsCount; i++) { |
eric@webkit.org | ef17f4b | 2010-08-25 06:57:14 +0000 | [diff] [blame] | 402 | if (*tags[i] == bgsoundTag |
| 403 | || *tags[i] == commandTag |
| 404 | || *tags[i] == detailsTag |
| 405 | || *tags[i] == figcaptionTag |
| 406 | || *tags[i] == figureTag |
| 407 | || *tags[i] == summaryTag |
| 408 | || *tags[i] == trackTag) { |
| 409 | // Even though we have atoms for these tags, we don't want to |
| 410 | // treat them as "recognized tags" for the purpose of parsing |
| 411 | // because that changes how we parse documents. |
| 412 | continue; |
| 413 | } |
| 414 | tagList.add(tags[i]->localName().impl()); |
| 415 | } |
| 416 | } |
| 417 | return tagList.contains(tagName.localName().impl()); |
| 418 | } |
| 419 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 420 | void HTMLObjectElement::updateDocNamedItem() |
| 421 | { |
| 422 | // The rule is "<object> elements with no children other than |
andersca | 30bcc78 | 2007-07-18 23:31:38 +0000 | [diff] [blame] | 423 | // <param> elements, unknown elements and whitespace can be |
| 424 | // found by name in a document, and other <object> elements cannot." |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 425 | bool wasNamedItem = m_docNamedItem; |
| 426 | bool isNamedItem = true; |
| 427 | Node* child = firstChild(); |
| 428 | while (child && isNamedItem) { |
| 429 | if (child->isElementNode()) { |
inferno@chromium.org | 9aa9e8d | 2013-03-14 16:08:06 +0000 | [diff] [blame] | 430 | Element* element = toElement(child); |
eric@webkit.org | ef17f4b | 2010-08-25 06:57:14 +0000 | [diff] [blame] | 431 | // FIXME: Use of isRecognizedTagName is almost certainly wrong here. |
| 432 | if (isRecognizedTagName(element->tagQName()) && !element->hasTagName(paramTag)) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 433 | isNamedItem = false; |
| 434 | } else if (child->isTextNode()) { |
commit-queue@webkit.org | 9b335e4 | 2012-02-12 11:27:56 +0000 | [diff] [blame] | 435 | if (!toText(child)->containsOnlyWhitespace()) |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 436 | isNamedItem = false; |
| 437 | } else |
| 438 | isNamedItem = false; |
| 439 | child = child->nextSibling(); |
| 440 | } |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 441 | if (isNamedItem != wasNamedItem && inDocument() && document().isHTMLDocument()) { |
| 442 | HTMLDocument* document = toHTMLDocument(&this->document()); |
rniwa@webkit.org | 068215b | 2013-05-07 00:20:05 +0000 | [diff] [blame] | 443 | |
| 444 | const AtomicString& id = getIdAttribute(); |
| 445 | if (!id.isEmpty()) { |
| 446 | if (isNamedItem) |
rniwa@webkit.org | 01ebac5 | 2013-10-05 02:59:02 +0000 | [diff] [blame] | 447 | document->addDocumentNamedItem(*id.impl(), *this); |
rniwa@webkit.org | 068215b | 2013-05-07 00:20:05 +0000 | [diff] [blame] | 448 | else |
rniwa@webkit.org | 01ebac5 | 2013-10-05 02:59:02 +0000 | [diff] [blame] | 449 | document->removeDocumentNamedItem(*id.impl(), *this); |
rniwa@webkit.org | 068215b | 2013-05-07 00:20:05 +0000 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | const AtomicString& name = getNameAttribute(); |
rniwa@webkit.org | b9e8c3f | 2013-05-10 16:38:21 +0000 | [diff] [blame] | 453 | if (!name.isEmpty() && id != name) { |
rniwa@webkit.org | 068215b | 2013-05-07 00:20:05 +0000 | [diff] [blame] | 454 | if (isNamedItem) |
rniwa@webkit.org | 01ebac5 | 2013-10-05 02:59:02 +0000 | [diff] [blame] | 455 | document->addDocumentNamedItem(*name.impl(), *this); |
rniwa@webkit.org | 068215b | 2013-05-07 00:20:05 +0000 | [diff] [blame] | 456 | else |
rniwa@webkit.org | 01ebac5 | 2013-10-05 02:59:02 +0000 | [diff] [blame] | 457 | document->removeDocumentNamedItem(*name.impl(), *this); |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 458 | } |
| 459 | } |
| 460 | m_docNamedItem = isNamedItem; |
| 461 | } |
| 462 | |
beidson | 1564c5e | 2007-05-10 08:55:44 +0000 | [diff] [blame] | 463 | bool HTMLObjectElement::containsJavaApplet() const |
| 464 | { |
commit-queue@webkit.org | 03477c8 | 2011-09-02 17:07:51 +0000 | [diff] [blame] | 465 | if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr))) |
beidson | 1564c5e | 2007-05-10 08:55:44 +0000 | [diff] [blame] | 466 | return true; |
antti@apple.com | 6005794 | 2013-08-28 19:43:51 +0000 | [diff] [blame] | 467 | |
antti@apple.com | 3eb8fea | 2014-01-01 21:48:13 +0000 | [diff] [blame] | 468 | for (auto& child : childrenOfType<Element>(*this)) { |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 469 | if (child.hasTagName(paramTag) && equalIgnoringCase(child.getNameAttribute(), "type") |
| 470 | && MIMETypeRegistry::isJavaAppletMIMEType(child.getAttribute(valueAttr).string())) |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 471 | return true; |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 472 | if (child.hasTagName(objectTag) && toHTMLObjectElement(child).containsJavaApplet()) |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 473 | return true; |
weinig@apple.com | c77041e | 2013-12-14 18:05:45 +0000 | [diff] [blame] | 474 | if (child.hasTagName(appletTag)) |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 475 | return true; |
beidson | 1564c5e | 2007-05-10 08:55:44 +0000 | [diff] [blame] | 476 | } |
| 477 | |
| 478 | return false; |
| 479 | } |
| 480 | |
darin@apple.com | 5ffbb5c | 2013-09-27 16:39:41 +0000 | [diff] [blame] | 481 | void HTMLObjectElement::addSubresourceAttributeURLs(ListHashSet<URL>& urls) const |
beidson@apple.com | a4fb38f | 2008-03-27 04:08:17 +0000 | [diff] [blame] | 482 | { |
commit-queue@webkit.org | bd9bc9a | 2012-05-30 20:50:31 +0000 | [diff] [blame] | 483 | HTMLPlugInImageElement::addSubresourceAttributeURLs(urls); |
ddkilzer@apple.com | e9a5504 | 2008-12-23 00:00:14 +0000 | [diff] [blame] | 484 | |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 485 | addSubresourceURL(urls, document().completeURL(getAttribute(dataAttr))); |
darin@apple.com | 3a3edd4 | 2009-08-19 00:17:59 +0000 | [diff] [blame] | 486 | |
| 487 | // FIXME: Passing a string that starts with "#" to the completeURL function does |
| 488 | // not seem like it would work. The image element has similar but not identical code. |
commit-queue@webkit.org | 03477c8 | 2011-09-02 17:07:51 +0000 | [diff] [blame] | 489 | const AtomicString& useMap = getAttribute(usemapAttr); |
benjamin@webkit.org | 127cec2c | 2012-04-30 21:32:44 +0000 | [diff] [blame] | 490 | if (useMap.startsWith('#')) |
akling@apple.com | 622b1a4 | 2013-08-30 14:30:12 +0000 | [diff] [blame] | 491 | addSubresourceURL(urls, document().completeURL(useMap)); |
beidson@apple.com | a4fb38f | 2008-03-27 04:08:17 +0000 | [diff] [blame] | 492 | } |
| 493 | |
commit-queue@webkit.org | 774c7f6 | 2011-12-26 07:05:00 +0000 | [diff] [blame] | 494 | void HTMLObjectElement::didMoveToNewDocument(Document* oldDocument) |
tkent@chromium.org | d408e11 | 2011-01-13 03:48:42 +0000 | [diff] [blame] | 495 | { |
commit-queue@webkit.org | 774c7f6 | 2011-12-26 07:05:00 +0000 | [diff] [blame] | 496 | FormAssociatedElement::didMoveToNewDocument(oldDocument); |
| 497 | HTMLPlugInImageElement::didMoveToNewDocument(oldDocument); |
tkent@chromium.org | d408e11 | 2011-01-13 03:48:42 +0000 | [diff] [blame] | 498 | } |
| 499 | |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 500 | bool HTMLObjectElement::appendFormData(FormDataList& encoding, bool) |
tkent@chromium.org | 995765c | 2010-12-07 09:40:23 +0000 | [diff] [blame] | 501 | { |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 502 | if (name().isEmpty()) |
| 503 | return false; |
| 504 | |
| 505 | Widget* widget = pluginWidget(); |
| 506 | if (!widget || !widget->isPluginViewBase()) |
| 507 | return false; |
| 508 | String value; |
inferno@chromium.org | 92242cb | 2013-03-15 17:31:20 +0000 | [diff] [blame] | 509 | if (!toPluginViewBase(widget)->getFormValue(value)) |
bashi@chromium.org | dcda5d9 | 2011-07-11 02:28:59 +0000 | [diff] [blame] | 510 | return false; |
| 511 | encoding.appendData(name(), value); |
| 512 | return true; |
tkent@chromium.org | 995765c | 2010-12-07 09:40:23 +0000 | [diff] [blame] | 513 | } |
| 514 | |
tkent@chromium.org | 38d5f63 | 2011-02-08 05:28:19 +0000 | [diff] [blame] | 515 | HTMLFormElement* HTMLObjectElement::virtualForm() const |
| 516 | { |
| 517 | return FormAssociatedElement::form(); |
| 518 | } |
| 519 | |
eseidel | d2f36a1 | 2006-05-12 18:14:17 +0000 | [diff] [blame] | 520 | } |