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 30 matching lines...) Expand all Loading... | |
41 #include "core/html/HTMLFormElement.h" | 41 #include "core/html/HTMLFormElement.h" |
42 #include "core/html/HTMLImageFallbackHelper.h" | 42 #include "core/html/HTMLImageFallbackHelper.h" |
43 #include "core/html/HTMLSourceElement.h" | 43 #include "core/html/HTMLSourceElement.h" |
44 #include "core/html/parser/HTMLParserIdioms.h" | 44 #include "core/html/parser/HTMLParserIdioms.h" |
45 #include "core/html/parser/HTMLSrcsetParser.h" | 45 #include "core/html/parser/HTMLSrcsetParser.h" |
46 #include "core/inspector/ConsoleMessage.h" | 46 #include "core/inspector/ConsoleMessage.h" |
47 #include "core/layout/LayoutBlockFlow.h" | 47 #include "core/layout/LayoutBlockFlow.h" |
48 #include "core/layout/LayoutImage.h" | 48 #include "core/layout/LayoutImage.h" |
49 #include "core/page/Page.h" | 49 #include "core/page/Page.h" |
50 #include "core/style/ContentData.h" | 50 #include "core/style/ContentData.h" |
51 #include "core/svg/graphics/SVGImageForContainer.h" | |
51 #include "platform/ContentType.h" | 52 #include "platform/ContentType.h" |
52 #include "platform/EventDispatchForbiddenScope.h" | 53 #include "platform/EventDispatchForbiddenScope.h" |
53 #include "platform/MIMETypeRegistry.h" | 54 #include "platform/MIMETypeRegistry.h" |
54 #include "platform/RuntimeEnabledFeatures.h" | 55 #include "platform/RuntimeEnabledFeatures.h" |
55 #include "platform/weborigin/SecurityPolicy.h" | 56 #include "platform/weborigin/SecurityPolicy.h" |
56 | 57 |
57 namespace blink { | 58 namespace blink { |
58 | 59 |
59 using namespace HTMLNames; | 60 using namespace HTMLNames; |
60 | 61 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 if (!complete() || !cachedImage()) { | 598 if (!complete() || !cachedImage()) { |
598 *status = IncompleteSourceImageStatus; | 599 *status = IncompleteSourceImageStatus; |
599 return nullptr; | 600 return nullptr; |
600 } | 601 } |
601 | 602 |
602 if (cachedImage()->errorOccurred()) { | 603 if (cachedImage()->errorOccurred()) { |
603 *status = UndecodableSourceImageStatus; | 604 *status = UndecodableSourceImageStatus; |
604 return nullptr; | 605 return nullptr; |
605 } | 606 } |
606 | 607 |
607 RefPtr<Image> sourceImage = cachedImage()->image(); | 608 RefPtr<Image> sourceImage; |
608 | 609 if (cachedImage()->image()->isSVGImage()) { |
609 // We need to synthesize a container size if a layoutObject is not available to provide one. | 610 sourceImage = SVGImageForContainer::create(toSVGImage(cachedImage()->ima ge()), |
fs
2015/12/01 14:23:21
I get a feeling that it would be better to do the
davve
2015/12/01 14:54:16
Extracting the url would have to go though the Can
davve
2015/12/01 14:57:38
Oh, CanvasImageSource has sourceURL already. I dou
fs
2015/12/01 14:59:22
Cumbersome, yes...
fs
2015/12/01 15:12:17
Considering how it's used I'd suspect it doesn't,
| |
610 if (!layoutObject() && sourceImage->usesContainerSize()) | 611 cachedImage()->image()->size(), 1, document().completeURL(imageSourc eURL())); |
611 sourceImage->setContainerSize(sourceImage->size()); | 612 } else { |
613 sourceImage = cachedImage()->image(); | |
614 } | |
612 | 615 |
613 *status = NormalSourceImageStatus; | 616 *status = NormalSourceImageStatus; |
614 return sourceImage->imageForDefaultFrame(); | 617 return sourceImage->imageForDefaultFrame(); |
615 } | 618 } |
616 | 619 |
617 bool HTMLImageElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const | 620 bool HTMLImageElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const |
618 { | 621 { |
619 ImageResource* image = cachedImage(); | 622 ImageResource* image = cachedImage(); |
620 if (!image) | 623 if (!image) |
621 return false; | 624 return false; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 { | 810 { |
808 ImageResource* image = cachedImage(); | 811 ImageResource* image = cachedImage(); |
809 if (!image) | 812 if (!image) |
810 return IntSize(); | 813 return IntSize(); |
811 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); | 814 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); |
812 ASSERT(lSize.fraction().isZero()); | 815 ASSERT(lSize.fraction().isZero()); |
813 return IntSize(lSize.width(), lSize.height()); | 816 return IntSize(lSize.width(), lSize.height()); |
814 } | 817 } |
815 | 818 |
816 } | 819 } |
OLD | NEW |