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

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

Issue 2927823002: Drop ImageLoader in plugins (Closed)
Patch Set: Drop ImageLoader in plugins Created 3 years, 6 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
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 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights
6 * reserved. 6 * reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // TODO(schenney): crbug.com/572908 What is the right thing to do here? 106 // TODO(schenney): crbug.com/572908 What is the right thing to do here?
107 // Should we suppress the reload stuff when a persistable widget-type is 107 // Should we suppress the reload stuff when a persistable widget-type is
108 // specified? 108 // specified?
109 ReloadPluginOnAttributeChange(name); 109 ReloadPluginOnAttributeChange(name);
110 if (!GetLayoutObject()) 110 if (!GetLayoutObject())
111 RequestPluginCreationWithoutLayoutObjectIfPossible(); 111 RequestPluginCreationWithoutLayoutObjectIfPossible();
112 } else if (name == dataAttr) { 112 } else if (name == dataAttr) {
113 url_ = StripLeadingAndTrailingHTMLSpaces(params.new_value); 113 url_ = StripLeadingAndTrailingHTMLSpaces(params.new_value);
114 if (GetLayoutObject() && IsImageType()) { 114 if (GetLayoutObject() && IsImageType()) {
115 SetNeedsPluginUpdate(true); 115 SetNeedsPluginUpdate(true);
116 if (!image_loader_)
117 image_loader_ = HTMLImageLoader::Create(this);
118 image_loader_->UpdateFromElement(ImageLoader::kUpdateIgnorePreviousError);
119 } else { 116 } else {
120 ReloadPluginOnAttributeChange(name); 117 ReloadPluginOnAttributeChange(name);
121 } 118 }
122 } else if (name == classidAttr) { 119 } else if (name == classidAttr) {
123 class_id_ = params.new_value; 120 class_id_ = params.new_value;
124 ReloadPluginOnAttributeChange(name); 121 ReloadPluginOnAttributeChange(name);
125 } else { 122 } else {
126 HTMLPlugInElement::ParseAttribute(params); 123 HTMLPlugInElement::ParseAttribute(params);
127 } 124 }
128 } 125 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 LazyReattachIfAttached(); 352 LazyReattachIfAttached();
356 } 353 }
357 354
358 void HTMLObjectElement::RenderFallbackContent() { 355 void HTMLObjectElement::RenderFallbackContent() {
359 if (UseFallbackContent()) 356 if (UseFallbackContent())
360 return; 357 return;
361 358
362 if (!isConnected()) 359 if (!isConnected())
363 return; 360 return;
364 361
365 // Before we give up and use fallback content, check to see if this is a MIME
366 // type issue.
367 if (image_loader_ && image_loader_->GetImage() &&
368 image_loader_->GetImage()->GetContentStatus() !=
369 ResourceStatus::kLoadError) {
370 service_type_ = image_loader_->GetImage()->GetResponse().MimeType();
371 if (!IsImageType()) {
372 // If we don't think we have an image type anymore, then clear the image
373 // from the loader.
374 image_loader_->ClearImage();
375 ReattachFallbackContent();
376 return;
377 }
378 }
379
380 use_fallback_content_ = true; 362 use_fallback_content_ = true;
381 363
382 // TODO(schenney): crbug.com/572908 Style gets recalculated which is 364 // TODO(schenney): crbug.com/572908 Style gets recalculated which is
383 // suboptimal. 365 // suboptimal.
384 ReattachFallbackContent(); 366 ReattachFallbackContent();
385 } 367 }
386 368
387 bool HTMLObjectElement::IsExposed() const { 369 bool HTMLObjectElement::IsExposed() const {
388 // http://www.whatwg.org/specs/web-apps/current-work/#exposed 370 // http://www.whatwg.org/specs/web-apps/current-work/#exposed
389 for (HTMLObjectElement* ancestor = 371 for (HTMLObjectElement* ancestor =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 419
438 bool HTMLObjectElement::WillUseFallbackContentAtLayout() const { 420 bool HTMLObjectElement::WillUseFallbackContentAtLayout() const {
439 return !HasValidClassId() && HasFallbackContent(); 421 return !HasValidClassId() && HasFallbackContent();
440 } 422 }
441 423
442 void HTMLObjectElement::AssociateWith(HTMLFormElement* form) { 424 void HTMLObjectElement::AssociateWith(HTMLFormElement* form) {
443 AssociateByParser(form); 425 AssociateByParser(form);
444 }; 426 };
445 427
446 } // namespace blink 428 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLEmbedElement.idl ('k') | third_party/WebKit/Source/core/html/HTMLObjectElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698