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

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

Issue 205523003: Remove beforeload events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove more tests Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | Source/core/html/HTMLPlugInElement.h » ('j') | 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 setNeedsWidgetUpdate(true); 104 setNeedsWidgetUpdate(true);
105 if (!m_imageLoader) 105 if (!m_imageLoader)
106 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); 106 m_imageLoader = adoptPtr(new HTMLImageLoader(this));
107 m_imageLoader->updateFromElementIgnoringPreviousError(); 107 m_imageLoader->updateFromElementIgnoringPreviousError();
108 } else { 108 } else {
109 reloadPluginOnAttributeChange(name); 109 reloadPluginOnAttributeChange(name);
110 } 110 }
111 } else if (name == classidAttr) { 111 } else if (name == classidAttr) {
112 m_classId = value; 112 m_classId = value;
113 reloadPluginOnAttributeChange(name); 113 reloadPluginOnAttributeChange(name);
114 } else if (name == onbeforeloadAttr) {
115 setAttributeEventListener(EventTypeNames::beforeload, createAttributeEve ntListener(this, name, value));
116 } else { 114 } else {
117 HTMLPlugInElement::parseAttribute(name, value); 115 HTMLPlugInElement::parseAttribute(name, value);
118 } 116 }
119 } 117 }
120 118
121 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV alues) 119 static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramV alues)
122 { 120 {
123 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e . Real and WMP 121 // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e . Real and WMP
124 // require "src" attribute). 122 // require "src" attribute).
125 int srcIndex = -1, dataIndex = -1; 123 int srcIndex = -1, dataIndex = -1;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 310
313 // Note: url is modified above by parametersForPlugin. 311 // Note: url is modified above by parametersForPlugin.
314 if (!allowedToLoadFrameURL(url)) { 312 if (!allowedToLoadFrameURL(url)) {
315 dispatchErrorEvent(); 313 dispatchErrorEvent();
316 return; 314 return;
317 } 315 }
318 316
319 bool fallbackContent = hasFallbackContent(); 317 bool fallbackContent = hasFallbackContent();
320 renderEmbeddedObject()->setHasFallbackContent(fallbackContent); 318 renderEmbeddedObject()->setHasFallbackContent(fallbackContent);
321 319
322 RefPtr<HTMLObjectElement> protect(this); // beforeload and plugin loading ca n make arbitrary DOM mutations. 320 // FIXME: Is it possible to get here without a renderer now that we don't ha ve beforeload events?
323 bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url); 321 if (!renderer())
324 if (!renderer()) // Do not load the plugin if beforeload removed this elemen t or its renderer.
325 return; 322 return;
326 323
327 if (!beforeLoadAllowedLoad || !hasValidClassId() || !requestObject(url, serv iceType, paramNames, paramValues)) { 324 if (!hasValidClassId() || !requestObject(url, serviceType, paramNames, param Values)) {
328 if (!url.isEmpty()) 325 if (!url.isEmpty())
329 dispatchErrorEvent(); 326 dispatchErrorEvent();
330 if (fallbackContent) 327 if (fallbackContent)
331 renderFallbackContent(); 328 renderFallbackContent();
332 } 329 }
333 } 330 }
334 331
335 bool HTMLObjectElement::rendererIsNeeded(const RenderStyle& style) 332 bool HTMLObjectElement::rendererIsNeeded(const RenderStyle& style)
336 { 333 {
337 // FIXME: This check should not be needed, detached documents never render! 334 // FIXME: This check should not be needed, detached documents never render!
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 { 480 {
484 return fastHasAttribute(usemapAttr); 481 return fastHasAttribute(usemapAttr);
485 } 482 }
486 483
487 bool HTMLObjectElement::useFallbackContent() const 484 bool HTMLObjectElement::useFallbackContent() const
488 { 485 {
489 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; 486 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent;
490 } 487 }
491 488
492 } 489 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.cpp ('k') | Source/core/html/HTMLPlugInElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698