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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 | 358 |
359 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) | 359 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) |
360 { | 360 { |
361 if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertion
Point) != NodeTraversal::highestAncestorOrSelf(*m_form.get())) | 361 if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertion
Point) != NodeTraversal::highestAncestorOrSelf(*m_form.get())) |
362 resetFormOwner(); | 362 resetFormOwner(); |
363 if (m_listener) | 363 if (m_listener) |
364 document().mediaQueryMatcher().addViewportListener(m_listener); | 364 document().mediaQueryMatcher().addViewportListener(m_listener); |
365 | 365 |
366 bool imageWasModified = false; | 366 bool imageWasModified = false; |
367 if (RuntimeEnabledFeatures::pictureEnabled()) { | 367 if (RuntimeEnabledFeatures::pictureEnabled() && document().isActive()) { |
368 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 368 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
369 if (!candidate.isEmpty()) { | 369 if (!candidate.isEmpty()) { |
370 setBestFitURLAndDPRFromImageCandidate(candidate); | 370 setBestFitURLAndDPRFromImageCandidate(candidate); |
371 imageWasModified = true; | 371 imageWasModified = true; |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 // If we have been inserted from a renderer-less document, | 375 // If we have been inserted from a renderer-less document, |
376 // our loader may have not fetched the image, so do it now. | 376 // our loader may have not fetched the image, so do it now. |
377 if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModi
fied) | 377 if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModi
fied) |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 return FloatSize(); | 618 return FloatSize(); |
619 LayoutSize size; | 619 LayoutSize size; |
620 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. | 620 size = image->imageSizeForRenderer(renderer(), 1.0f); // FIXME: Not sure abo
ut this. |
621 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) | 621 if (renderer() && renderer()->isRenderImage() && image->image() && !image->i
mage()->hasRelativeWidth()) |
622 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); | 622 size.scale(toRenderImage(renderer())->imageDevicePixelRatio()); |
623 return size; | 623 return size; |
624 } | 624 } |
625 | 625 |
626 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 626 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
627 { | 627 { |
| 628 if (!document().isActive()) |
| 629 return; |
| 630 |
628 bool foundURL = false; | 631 bool foundURL = false; |
629 if (RuntimeEnabledFeatures::pictureEnabled()) { | 632 if (RuntimeEnabledFeatures::pictureEnabled()) { |
630 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 633 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
631 if (!candidate.isEmpty()) { | 634 if (!candidate.isEmpty()) { |
632 setBestFitURLAndDPRFromImageCandidate(candidate); | 635 setBestFitURLAndDPRFromImageCandidate(candidate); |
633 foundURL = true; | 636 foundURL = true; |
634 } | 637 } |
635 } | 638 } |
636 | 639 |
637 if (!foundURL) { | 640 if (!foundURL) { |
(...skipping 15 matching lines...) Expand all Loading... |
653 } | 656 } |
654 imageLoader().updateFromElement(behavior); | 657 imageLoader().updateFromElement(behavior); |
655 } | 658 } |
656 | 659 |
657 const KURL& HTMLImageElement::sourceURL() const | 660 const KURL& HTMLImageElement::sourceURL() const |
658 { | 661 { |
659 return cachedImage()->response().url(); | 662 return cachedImage()->response().url(); |
660 } | 663 } |
661 | 664 |
662 } | 665 } |
OLD | NEW |