Chromium Code Reviews| 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, 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 void HTMLObjectElement::reattachFallbackContent() | 353 void HTMLObjectElement::reattachFallbackContent() |
| 354 { | 354 { |
| 355 // This can happen inside of attach() in the middle of a recalcStyle so we n eed to | 355 // This can happen inside of attach() in the middle of a recalcStyle so we n eed to |
| 356 // reattach synchronously here. | 356 // reattach synchronously here. |
| 357 if (document().inStyleRecalc()) | 357 if (document().inStyleRecalc()) |
| 358 reattach(); | 358 reattach(); |
| 359 else | 359 else |
| 360 lazyReattachIfAttached(); | 360 lazyReattachIfAttached(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void HTMLObjectElement::renderFallbackContent() | 363 bool HTMLObjectElement::renderFallbackContent() |
| 364 { | 364 { |
| 365 if (!inDocument()) | |
| 366 return false; | |
|
dcheng
2015/05/06 18:57:38
I moved this check because if it's not in a docume
Nate Chapin
2015/05/06 20:15:05
My guess is it's irrelevant. I'd think that any ca
| |
| 367 | |
| 365 if (useFallbackContent()) | 368 if (useFallbackContent()) |
| 366 return; | 369 return true; |
| 367 | |
| 368 if (!inDocument()) | |
| 369 return; | |
| 370 | 370 |
| 371 // Before we give up and use fallback content, check to see if this is a MIM E type issue. | 371 // Before we give up and use fallback content, check to see if this is a MIM E type issue. |
| 372 if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->statu s() != Resource::LoadError) { | 372 if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->statu s() != Resource::LoadError) { |
| 373 m_serviceType = m_imageLoader->image()->response().mimeType(); | 373 m_serviceType = m_imageLoader->image()->response().mimeType(); |
| 374 if (!isImageType()) { | 374 if (!isImageType()) { |
| 375 // If we don't think we have an image type anymore, then clear the i mage from the loader. | 375 // If we don't think we have an image type anymore, then clear the i mage from the loader. |
| 376 m_imageLoader->setImage(0); | 376 m_imageLoader->setImage(0); |
| 377 reattachFallbackContent(); | 377 reattachFallbackContent(); |
| 378 return; | 378 return true; |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 | 381 |
| 382 m_useFallbackContent = true; | 382 m_useFallbackContent = true; |
| 383 | 383 |
| 384 // FIXME: Style gets recalculated which is suboptimal. | 384 // FIXME: Style gets recalculated which is suboptimal. |
| 385 reattachFallbackContent(); | 385 reattachFallbackContent(); |
| 386 return true; | |
| 386 } | 387 } |
| 387 | 388 |
| 388 bool HTMLObjectElement::isExposed() const | 389 bool HTMLObjectElement::isExposed() const |
| 389 { | 390 { |
| 390 // http://www.whatwg.org/specs/web-apps/current-work/#exposed | 391 // http://www.whatwg.org/specs/web-apps/current-work/#exposed |
| 391 for (HTMLObjectElement* ancestor = Traversal<HTMLObjectElement>::firstAncest or(*this); ancestor; ancestor = Traversal<HTMLObjectElement>::firstAncestor(*anc estor)) { | 392 for (HTMLObjectElement* ancestor = Traversal<HTMLObjectElement>::firstAncest or(*this); ancestor; ancestor = Traversal<HTMLObjectElement>::firstAncestor(*anc estor)) { |
| 392 if (ancestor->isExposed()) | 393 if (ancestor->isExposed()) |
| 393 return false; | 394 return false; |
| 394 } | 395 } |
| 395 for (HTMLElement& element : Traversal<HTMLElement>::descendantsOf(*this)) { | 396 for (HTMLElement& element : Traversal<HTMLElement>::descendantsOf(*this)) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 { | 451 { |
| 451 return fastHasAttribute(usemapAttr); | 452 return fastHasAttribute(usemapAttr); |
| 452 } | 453 } |
| 453 | 454 |
| 454 bool HTMLObjectElement::useFallbackContent() const | 455 bool HTMLObjectElement::useFallbackContent() const |
| 455 { | 456 { |
| 456 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; | 457 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; |
| 457 } | 458 } |
| 458 | 459 |
| 459 } | 460 } |
| OLD | NEW |