| 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 , m_imageLoader(HTMLImageLoader::create(this)) | 89 , m_imageLoader(HTMLImageLoader::create(this)) |
| 90 , m_imageDevicePixelRatio(1.0f) | 90 , m_imageDevicePixelRatio(1.0f) |
| 91 , m_source(nullptr) | 91 , m_source(nullptr) |
| 92 , m_formWasSetByParser(false) | 92 , m_formWasSetByParser(false) |
| 93 , m_elementCreatedByParser(createdByParser) | 93 , m_elementCreatedByParser(createdByParser) |
| 94 , m_useFallbackContent(false) | 94 , m_useFallbackContent(false) |
| 95 , m_isFallbackImage(false) | 95 , m_isFallbackImage(false) |
| 96 , m_referrerPolicy(ReferrerPolicyDefault) | 96 , m_referrerPolicy(ReferrerPolicyDefault) |
| 97 { | 97 { |
| 98 setHasCustomStyleCallbacks(); | 98 setHasCustomStyleCallbacks(); |
| 99 if (form && form->inShadowIncludingDocument()) { | 99 if (form && form->isConnected()) { |
| 100 m_form = form; | 100 m_form = form; |
| 101 m_formWasSetByParser = true; | 101 m_formWasSetByParser = true; |
| 102 m_form->associate(*this); | 102 m_form->associate(*this); |
| 103 m_form->didAssociateByParser(); | 103 m_form->didAssociateByParser(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 HTMLImageElement* HTMLImageElement::create(Document& document) | 107 HTMLImageElement* HTMLImageElement::create(Document& document) |
| 108 { | 108 { |
| 109 return new HTMLImageElement(document); | 109 return new HTMLImageElement(document); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 if (document().isActive()) { | 382 if (document().isActive()) { |
| 383 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 383 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
| 384 if (!candidate.isEmpty()) { | 384 if (!candidate.isEmpty()) { |
| 385 setBestFitURLAndDPRFromImageCandidate(candidate); | 385 setBestFitURLAndDPRFromImageCandidate(candidate); |
| 386 imageWasModified = true; | 386 imageWasModified = true; |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 | 389 |
| 390 // If we have been inserted from a layoutObject-less document, | 390 // If we have been inserted from a layoutObject-less document, |
| 391 // our loader may have not fetched the image, so do it now. | 391 // our loader may have not fetched the image, so do it now. |
| 392 if ((insertionPoint->inShadowIncludingDocument() && !imageLoader().image())
|| imageWasModified) | 392 if ((insertionPoint->isConnected() && !imageLoader().image()) || imageWasMod
ified) |
| 393 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPol
icy); | 393 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPol
icy); |
| 394 | 394 |
| 395 return HTMLElement::insertedInto(insertionPoint); | 395 return HTMLElement::insertedInto(insertionPoint); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) | 398 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
| 399 { | 399 { |
| 400 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) | 400 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) |
| 401 resetFormOwner(); | 401 resetFormOwner(); |
| 402 if (m_listener) | 402 if (m_listener) |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 { | 827 { |
| 828 ImageResource* image = cachedImage(); | 828 ImageResource* image = cachedImage(); |
| 829 if (!image) | 829 if (!image) |
| 830 return IntSize(); | 830 return IntSize(); |
| 831 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 831 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 832 ASSERT(lSize.fraction().isZero()); | 832 ASSERT(lSize.fraction().isZero()); |
| 833 return IntSize(lSize.width(), lSize.height()); | 833 return IntSize(lSize.width(), lSize.height()); |
| 834 } | 834 } |
| 835 | 835 |
| 836 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |