Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: Source/core/html/HTMLObjectElement.cpp

Issue 135103003: Updating <object> upon changing "data", "classid", "type" attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + method rename Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLObjectElement.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 92 void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
93 { 93 {
94 if (name == formAttr) 94 if (name == formAttr)
95 formAttributeChanged(); 95 formAttributeChanged();
96 else if (name == typeAttr) { 96 else if (name == typeAttr) {
97 m_serviceType = value.lower(); 97 m_serviceType = value.lower();
98 size_t pos = m_serviceType.find(";"); 98 size_t pos = m_serviceType.find(";");
99 if (pos != kNotFound) 99 if (pos != kNotFound)
100 m_serviceType = m_serviceType.left(pos); 100 m_serviceType = m_serviceType.left(pos);
101 if (renderer()) 101 reloadPluginOnAttributeChange(name);
102 setNeedsWidgetUpdate(true);
103 } else if (name == dataAttr) { 102 } else if (name == dataAttr) {
104 m_url = stripLeadingAndTrailingHTMLSpaces(value); 103 m_url = stripLeadingAndTrailingHTMLSpaces(value);
105 if (renderer()) { 104 if (renderer() && isImageType()) {
106 setNeedsWidgetUpdate(true); 105 setNeedsWidgetUpdate(true);
107 if (isImageType()) { 106 if (!m_imageLoader)
108 if (!m_imageLoader) 107 m_imageLoader = adoptPtr(new HTMLImageLoader(this));
109 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); 108 m_imageLoader->updateFromElementIgnoringPreviousError();
110 m_imageLoader->updateFromElementIgnoringPreviousError(); 109 } else {
111 } 110 reloadPluginOnAttributeChange(name);
112 } 111 }
113 } else if (name == classidAttr) { 112 } else if (name == classidAttr) {
114 m_classId = value; 113 m_classId = value;
115 if (renderer()) 114 reloadPluginOnAttributeChange(name);
116 setNeedsWidgetUpdate(true);
117 } else if (name == onbeforeloadAttr) { 115 } else if (name == onbeforeloadAttr) {
118 setAttributeEventListener(EventTypeNames::beforeload, createAttributeEve ntListener(this, name, value)); 116 setAttributeEventListener(EventTypeNames::beforeload, createAttributeEve ntListener(this, name, value));
119 } else { 117 } else {
120 HTMLPlugInElement::parseAttribute(name, value); 118 HTMLPlugInElement::parseAttribute(name, value);
121 } 119 }
122 } 120 }
123 121
124 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV alues) 122 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV alues)
125 { 123 {
126 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e . Real and WMP 124 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e . Real and WMP
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return true; 253 return true;
256 254
257 if (shouldAllowQuickTimeClassIdQuirk()) 255 if (shouldAllowQuickTimeClassIdQuirk())
258 return true; 256 return true;
259 257
260 // HTML5 says that fallback content should be rendered if a non-empty 258 // HTML5 says that fallback content should be rendered if a non-empty
261 // classid is specified for which the UA can't find a suitable plug-in. 259 // classid is specified for which the UA can't find a suitable plug-in.
262 return classId().isEmpty(); 260 return classId().isEmpty();
263 } 261 }
264 262
263 void HTMLObjectElement::reloadPluginOnAttributeChange(const QualifiedName& name)
264 {
265 // Following,
266 // http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
267 // (Enumerated list below "Whenever one of the following conditions occur: ")
268 //
269 // the updating of certain attributes should bring about "redetermination"
270 // of what the element contains.
271 bool needsInvalidation;
272 if (name == typeAttr) {
273 needsInvalidation = !fastHasAttribute(classidAttr) && !fastHasAttribute( dataAttr);
274 } else if (name == dataAttr) {
275 needsInvalidation = !fastHasAttribute(classidAttr);
276 } else if (name == classidAttr) {
277 needsInvalidation = true;
278 } else {
279 ASSERT_NOT_REACHED();
280 needsInvalidation = false;
281 }
282 setNeedsWidgetUpdate(true);
283 if (needsInvalidation)
284 setNeedsStyleRecalc();
rune 2014/01/17 21:12:21 What's the recalc for? Is it the right tool here?
sof 2014/01/17 21:20:36 That's the prevalent mechanism for elements to tri
285 }
286
265 // FIXME: This should be unified with HTMLEmbedElement::updateWidget and 287 // FIXME: This should be unified with HTMLEmbedElement::updateWidget and
266 // moved down into HTMLPluginElement.cpp 288 // moved down into HTMLPluginElement.cpp
267 void HTMLObjectElement::updateWidgetInternal() 289 void HTMLObjectElement::updateWidgetInternal()
268 { 290 {
269 ASSERT(!renderEmbeddedObject()->showsUnavailablePluginIndicator()); 291 ASSERT(!renderEmbeddedObject()->showsUnavailablePluginIndicator());
270 ASSERT(needsWidgetUpdate()); 292 ASSERT(needsWidgetUpdate());
271 setNeedsWidgetUpdate(false); 293 setNeedsWidgetUpdate(false);
272 // FIXME: This should ASSERT isFinishedParsingChildren() instead. 294 // FIXME: This should ASSERT isFinishedParsingChildren() instead.
273 if (!isFinishedParsingChildren()) { 295 if (!isFinishedParsingChildren()) {
274 dispatchErrorEvent(); 296 dispatchErrorEvent();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 { 476 {
455 return fastHasAttribute(usemapAttr); 477 return fastHasAttribute(usemapAttr);
456 } 478 }
457 479
458 bool HTMLObjectElement::useFallbackContent() const 480 bool HTMLObjectElement::useFallbackContent() const
459 { 481 {
460 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; 482 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent;
461 } 483 }
462 484
463 } 485 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698