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 | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * Copyright (C) 2010 Google Inc. All rights reserved. | 6 * Copyright (C) 2010 Google Inc. All rights reserved. |
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 13 matching lines...) Expand all Loading... | |
24 #include "core/html/HTMLImageElement.h" | 24 #include "core/html/HTMLImageElement.h" |
25 | 25 |
26 #include "bindings/core/v8/ScriptEventListener.h" | 26 #include "bindings/core/v8/ScriptEventListener.h" |
27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/MediaTypeNames.h" | 29 #include "core/MediaTypeNames.h" |
30 #include "core/css/MediaQueryMatcher.h" | 30 #include "core/css/MediaQueryMatcher.h" |
31 #include "core/css/MediaValuesDynamic.h" | 31 #include "core/css/MediaValuesDynamic.h" |
32 #include "core/css/parser/SizesAttributeParser.h" | 32 #include "core/css/parser/SizesAttributeParser.h" |
33 #include "core/dom/Attribute.h" | 33 #include "core/dom/Attribute.h" |
34 #include "core/dom/DOMException.h" | |
34 #include "core/dom/NodeTraversal.h" | 35 #include "core/dom/NodeTraversal.h" |
35 #include "core/dom/shadow/ShadowRoot.h" | 36 #include "core/dom/shadow/ShadowRoot.h" |
36 #include "core/frame/Deprecation.h" | 37 #include "core/frame/Deprecation.h" |
37 #include "core/frame/ImageBitmap.h" | 38 #include "core/frame/ImageBitmap.h" |
38 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
39 #include "core/html/FormAssociated.h" | 40 #include "core/html/FormAssociated.h" |
40 #include "core/html/HTMLAnchorElement.h" | 41 #include "core/html/HTMLAnchorElement.h" |
41 #include "core/html/HTMLCanvasElement.h" | 42 #include "core/html/HTMLCanvasElement.h" |
42 #include "core/html/HTMLFormElement.h" | 43 #include "core/html/HTMLFormElement.h" |
43 #include "core/html/HTMLImageFallbackHelper.h" | 44 #include "core/html/HTMLImageFallbackHelper.h" |
44 #include "core/html/HTMLPictureElement.h" | 45 #include "core/html/HTMLPictureElement.h" |
45 #include "core/html/HTMLSourceElement.h" | 46 #include "core/html/HTMLSourceElement.h" |
46 #include "core/html/parser/HTMLParserIdioms.h" | 47 #include "core/html/parser/HTMLParserIdioms.h" |
47 #include "core/html/parser/HTMLSrcsetParser.h" | 48 #include "core/html/parser/HTMLSrcsetParser.h" |
48 #include "core/imagebitmap/ImageBitmapOptions.h" | 49 #include "core/imagebitmap/ImageBitmapOptions.h" |
49 #include "core/inspector/ConsoleMessage.h" | 50 #include "core/inspector/ConsoleMessage.h" |
50 #include "core/layout/LayoutBlockFlow.h" | 51 #include "core/layout/LayoutBlockFlow.h" |
51 #include "core/layout/LayoutImage.h" | 52 #include "core/layout/LayoutImage.h" |
52 #include "core/layout/api/LayoutImageItem.h" | 53 #include "core/layout/api/LayoutImageItem.h" |
53 #include "core/loader/resource/ImageResourceContent.h" | 54 #include "core/loader/resource/ImageResourceContent.h" |
55 #include "core/page/ChromeClient.h" | |
54 #include "core/page/Page.h" | 56 #include "core/page/Page.h" |
55 #include "core/style/ContentData.h" | 57 #include "core/style/ContentData.h" |
56 #include "core/svg/graphics/SVGImageForContainer.h" | 58 #include "core/svg/graphics/SVGImageForContainer.h" |
57 #include "platform/EventDispatchForbiddenScope.h" | 59 #include "platform/EventDispatchForbiddenScope.h" |
58 #include "platform/network/mime/ContentType.h" | 60 #include "platform/network/mime/ContentType.h" |
59 #include "platform/network/mime/MIMETypeRegistry.h" | 61 #include "platform/network/mime/MIMETypeRegistry.h" |
60 #include "platform/weborigin/SecurityPolicy.h" | 62 #include "platform/weborigin/SecurityPolicy.h" |
61 | 63 |
62 namespace blink { | 64 namespace blink { |
63 | 65 |
(...skipping 24 matching lines...) Expand all Loading... | |
88 | 90 |
89 HTMLImageElement::HTMLImageElement(Document& document, bool createdByParser) | 91 HTMLImageElement::HTMLImageElement(Document& document, bool createdByParser) |
90 : HTMLElement(imgTag, document), | 92 : HTMLElement(imgTag, document), |
91 m_imageLoader(HTMLImageLoader::create(this)), | 93 m_imageLoader(HTMLImageLoader::create(this)), |
92 m_imageDevicePixelRatio(1.0f), | 94 m_imageDevicePixelRatio(1.0f), |
93 m_source(nullptr), | 95 m_source(nullptr), |
94 m_layoutDisposition(LayoutDisposition::PrimaryContent), | 96 m_layoutDisposition(LayoutDisposition::PrimaryContent), |
95 m_formWasSetByParser(false), | 97 m_formWasSetByParser(false), |
96 m_elementCreatedByParser(createdByParser), | 98 m_elementCreatedByParser(createdByParser), |
97 m_isFallbackImage(false), | 99 m_isFallbackImage(false), |
98 m_referrerPolicy(ReferrerPolicyDefault) { | 100 m_referrerPolicy(ReferrerPolicyDefault), |
101 m_weakPtrFactory(this) { | |
99 setHasCustomStyleCallbacks(); | 102 setHasCustomStyleCallbacks(); |
100 } | 103 } |
101 | 104 |
102 HTMLImageElement* HTMLImageElement::create(Document& document) { | 105 HTMLImageElement* HTMLImageElement::create(Document& document) { |
103 return new HTMLImageElement(document); | 106 return new HTMLImageElement(document); |
104 } | 107 } |
105 | 108 |
106 HTMLImageElement* HTMLImageElement::create(Document& document, | 109 HTMLImageElement* HTMLImageElement::create(Document& document, |
107 bool createdByParser) { | 110 bool createdByParser) { |
108 return new HTMLImageElement(document, createdByParser); | 111 return new HTMLImageElement(document, createdByParser); |
109 } | 112 } |
110 | 113 |
111 HTMLImageElement::~HTMLImageElement() {} | 114 HTMLImageElement::~HTMLImageElement() { |
115 m_weakPtrFactory.revokeAll(); | |
116 } | |
112 | 117 |
113 DEFINE_TRACE(HTMLImageElement) { | 118 DEFINE_TRACE(HTMLImageElement) { |
114 visitor->trace(m_imageLoader); | 119 visitor->trace(m_imageLoader); |
115 visitor->trace(m_listener); | 120 visitor->trace(m_listener); |
116 visitor->trace(m_form); | 121 visitor->trace(m_form); |
117 visitor->trace(m_source); | 122 visitor->trace(m_source); |
123 visitor->trace(m_decodePromiseResolvers); | |
118 HTMLElement::trace(visitor); | 124 HTMLElement::trace(visitor); |
119 } | 125 } |
120 | 126 |
121 void HTMLImageElement::notifyViewportChanged() { | 127 void HTMLImageElement::notifyViewportChanged() { |
122 // Re-selecting the source URL in order to pick a more fitting resource | 128 // Re-selecting the source URL in order to pick a more fitting resource |
123 // And update the image's intrinsic dimensions when the viewport changes. | 129 // And update the image's intrinsic dimensions when the viewport changes. |
124 // Picking of a better fitting resource is UA dependant, not spec required. | 130 // Picking of a better fitting resource is UA dependant, not spec required. |
125 selectSourceURL(ImageLoader::UpdateSizeChanged); | 131 selectSourceURL(ImageLoader::UpdateSizeChanged); |
126 } | 132 } |
127 | 133 |
134 void HTMLImageElement::requestDecode() { | |
135 DCHECK(!m_decodePromiseResolvers.isEmpty()); | |
136 if (!imageLoader().image() || !imageLoader().image()->getImage()) { | |
137 didDecode(false); | |
138 return; | |
139 } | |
140 Image* image = imageLoader().image()->getImage(); | |
141 auto* page = document().page(); | |
142 if (page) { | |
143 page->chromeClient().requestDecode( | |
144 image->imageForCurrentFrame(), | |
145 WTF::bind(&HTMLImageElement::didDecode, | |
146 m_weakPtrFactory.createWeakPtr())); | |
147 } | |
148 } | |
149 | |
150 void HTMLImageElement::didDecode(bool success) { | |
151 if (m_decodePromiseResolvers.isEmpty()) | |
152 return; | |
153 static auto resolve = [](ScriptPromiseResolver* resolver) { | |
154 resolver->resolve(); | |
155 }; | |
156 static auto reject = [](ScriptPromiseResolver* resolver) { | |
157 resolver->reject(DOMException::create( | |
158 EncodingError, "The source image cannot be decoded")); | |
159 }; | |
160 auto process = success ? resolve : reject; | |
161 for (auto& resolver : m_decodePromiseResolvers) | |
162 process(resolver); | |
163 m_decodePromiseResolvers.clear(); | |
164 } | |
165 | |
128 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) { | 166 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) { |
129 HTMLImageElement* image = new HTMLImageElement(document); | 167 HTMLImageElement* image = new HTMLImageElement(document); |
130 image->m_elementCreatedByParser = false; | 168 image->m_elementCreatedByParser = false; |
131 return image; | 169 return image; |
132 } | 170 } |
133 | 171 |
134 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document, | 172 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document, |
135 unsigned width) { | 173 unsigned width) { |
136 HTMLImageElement* image = new HTMLImageElement(document); | 174 HTMLImageElement* image = new HTMLImageElement(document); |
137 image->setWidth(width); | 175 image->setWidth(width); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 const QualifiedName& name = params.name; | 291 const QualifiedName& name = params.name; |
254 if (name == altAttr || name == titleAttr) { | 292 if (name == altAttr || name == titleAttr) { |
255 if (userAgentShadowRoot()) { | 293 if (userAgentShadowRoot()) { |
256 Element* text = userAgentShadowRoot()->getElementById("alttext"); | 294 Element* text = userAgentShadowRoot()->getElementById("alttext"); |
257 String value = altText(); | 295 String value = altText(); |
258 if (text && text->textContent() != params.newValue) | 296 if (text && text->textContent() != params.newValue) |
259 text->setTextContent(altText()); | 297 text->setTextContent(altText()); |
260 } | 298 } |
261 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { | 299 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { |
262 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); | 300 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); |
301 // Ensure to fail any pending decodes on possible source changes. | |
302 if (!m_decodePromiseResolvers.isEmpty() && | |
303 params.oldValue != params.newValue) { | |
304 didDecode(false); | |
305 m_weakPtrFactory.revokeAll(); | |
306 } | |
263 } else if (name == usemapAttr) { | 307 } else if (name == usemapAttr) { |
264 setIsLink(!params.newValue.isNull()); | 308 setIsLink(!params.newValue.isNull()); |
265 } else if (name == referrerpolicyAttr) { | 309 } else if (name == referrerpolicyAttr) { |
266 m_referrerPolicy = ReferrerPolicyDefault; | 310 m_referrerPolicy = ReferrerPolicyDefault; |
267 if (!params.newValue.isNull()) { | 311 if (!params.newValue.isNull()) { |
268 SecurityPolicy::referrerPolicyFromString( | 312 SecurityPolicy::referrerPolicyFromString( |
269 params.newValue, SupportReferrerPolicyLegacyKeywords, | 313 params.newValue, SupportReferrerPolicyLegacyKeywords, |
270 &m_referrerPolicy); | 314 &m_referrerPolicy); |
271 UseCounter::count(document(), | 315 UseCounter::count(document(), |
272 UseCounter::HTMLImageElementReferrerPolicyAttribute); | 316 UseCounter::HTMLImageElementReferrerPolicyAttribute); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
408 // our loader may have not fetched the image, so do it now. | 452 // our loader may have not fetched the image, so do it now. |
409 if ((insertionPoint->isConnected() && !imageLoader().image()) || | 453 if ((insertionPoint->isConnected() && !imageLoader().image()) || |
410 imageWasModified) | 454 imageWasModified) |
411 imageLoader().updateFromElement(ImageLoader::UpdateNormal, | 455 imageLoader().updateFromElement(ImageLoader::UpdateNormal, |
412 m_referrerPolicy); | 456 m_referrerPolicy); |
413 | 457 |
414 return HTMLElement::insertedInto(insertionPoint); | 458 return HTMLElement::insertedInto(insertionPoint); |
415 } | 459 } |
416 | 460 |
417 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) { | 461 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) { |
418 if (!m_form || | 462 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != |
419 NodeTraversal::highestAncestorOrSelf(*m_form.get()) != | 463 NodeTraversal::highestAncestorOrSelf(*this)) |
420 NodeTraversal::highestAncestorOrSelf(*this)) | |
421 resetFormOwner(); | 464 resetFormOwner(); |
422 if (m_listener) { | 465 if (m_listener) { |
423 document().mediaQueryMatcher().removeViewportListener(m_listener); | 466 document().mediaQueryMatcher().removeViewportListener(m_listener); |
424 Node* parent = parentNode(); | 467 Node* parent = parentNode(); |
425 if (parent && isHTMLPictureElement(*parent)) | 468 if (parent && isHTMLPictureElement(*parent)) |
426 toHTMLPictureElement(parent)->removeListenerFromSourceChildren(); | 469 toHTMLPictureElement(parent)->removeListenerFromSourceChildren(); |
427 } | 470 } |
428 HTMLElement::removedFrom(insertionPoint); | 471 HTMLElement::removedFrom(insertionPoint); |
429 } | 472 } |
430 | 473 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 } | 560 } |
518 | 561 |
519 const String& HTMLImageElement::currentSrc() const { | 562 const String& HTMLImageElement::currentSrc() const { |
520 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#dom- img-currentsrc | 563 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#dom- img-currentsrc |
521 // The currentSrc IDL attribute must return the img element's current | 564 // The currentSrc IDL attribute must return the img element's current |
522 // request's current URL. | 565 // request's current URL. |
523 | 566 |
524 // Return the picked URL string in case of load error. | 567 // Return the picked URL string in case of load error. |
525 if (imageLoader().hadError()) | 568 if (imageLoader().hadError()) |
526 return m_bestFitImageURL; | 569 return m_bestFitImageURL; |
527 // Initially, the pending request turns into current request when it is either | 570 // Initially, the pending request turns into current request when it is |
528 // available or broken. We use the image's dimensions as a proxy to it being | 571 // either available or broken. We use the image's dimensions as a proxy to |
529 // in any of these states. | 572 // it being in any of these states. |
530 if (!imageLoader().image() || !imageLoader().image()->getImage() || | 573 if (!imageLoader().image() || !imageLoader().image()->getImage() || |
531 !imageLoader().image()->getImage()->width()) | 574 !imageLoader().image()->getImage()->width()) |
532 return emptyAtom; | 575 return emptyAtom; |
533 | 576 |
534 return imageLoader().image()->url().getString(); | 577 return imageLoader().image()->url().getString(); |
535 } | 578 } |
536 | 579 |
537 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const { | 580 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const { |
538 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr || | 581 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr || |
539 attribute.name() == longdescAttr || | 582 attribute.name() == longdescAttr || |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
585 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 628 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
586 LayoutObject* r = layoutObject(); | 629 LayoutObject* r = layoutObject(); |
587 if (!r) | 630 if (!r) |
588 return 0; | 631 return 0; |
589 | 632 |
590 // FIXME: This doesn't work correctly with transforms. | 633 // FIXME: This doesn't work correctly with transforms. |
591 FloatPoint absPos = r->localToAbsolute(); | 634 FloatPoint absPos = r->localToAbsolute(); |
592 return absPos.y(); | 635 return absPos.y(); |
593 } | 636 } |
594 | 637 |
638 ScriptPromise HTMLImageElement::decode(ScriptState* scriptState, | |
639 ExceptionState& exceptionState) { | |
640 exceptionState.clearException(); | |
641 m_decodePromiseResolvers.push_back( | |
642 ScriptPromiseResolver::create(scriptState)); | |
643 ScriptPromise promise = m_decodePromiseResolvers.back()->promise(); | |
644 if (complete()) | |
645 requestDecode(); | |
646 return promise; | |
647 } | |
648 | |
595 bool HTMLImageElement::complete() const { | 649 bool HTMLImageElement::complete() const { |
596 return imageLoader().imageComplete(); | 650 return imageLoader().imageComplete(); |
597 } | 651 } |
598 | 652 |
599 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) { | 653 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) { |
600 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); | 654 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); |
601 imageLoader().elementDidMoveToNewDocument(); | 655 imageLoader().elementDidMoveToNewDocument(); |
602 HTMLElement::didMoveToNewDocument(oldDocument); | 656 HTMLElement::didMoveToNewDocument(oldDocument); |
603 } | 657 } |
604 | 658 |
605 bool HTMLImageElement::isServerMap() const { | 659 bool HTMLImageElement::isServerMap() const { |
606 if (!fastHasAttribute(ismapAttr)) | 660 if (!fastHasAttribute(ismapAttr)) |
607 return false; | 661 return false; |
608 | 662 |
609 const AtomicString& usemap = fastGetAttribute(usemapAttr); | 663 const AtomicString& usemap = fastGetAttribute(usemapAttr); |
610 | 664 |
611 // If the usemap attribute starts with '#', it refers to a map element in the | 665 // If the usemap attribute starts with '#', it refers to a map element in |
612 // document. | 666 // the document. |
613 if (usemap[0] == '#') | 667 if (usemap[0] == '#') |
614 return false; | 668 return false; |
615 | 669 |
616 return document() | 670 return document() |
617 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)) | 671 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)) |
618 .isEmpty(); | 672 .isEmpty(); |
619 } | 673 } |
620 | 674 |
621 Image* HTMLImageElement::imageContents() { | 675 Image* HTMLImageElement::imageContents() { |
622 if (!imageLoader().imageComplete()) | 676 if (!imageLoader().imageComplete()) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
792 return m_layoutDisposition == LayoutDisposition::Collapsed; | 846 return m_layoutDisposition == LayoutDisposition::Collapsed; |
793 } | 847 } |
794 | 848 |
795 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition, | 849 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition, |
796 bool forceReattach) { | 850 bool forceReattach) { |
797 if (m_layoutDisposition == layoutDisposition && !forceReattach) | 851 if (m_layoutDisposition == layoutDisposition && !forceReattach) |
798 return; | 852 return; |
799 | 853 |
800 m_layoutDisposition = layoutDisposition; | 854 m_layoutDisposition = layoutDisposition; |
801 | 855 |
802 // This can happen inside of attachLayoutTree() in the middle of a recalcStyle | 856 // This can happen inside of attachLayoutTree() in the middle of a |
803 // so we need to reattach synchronously here. | 857 // recalcStyle so we need to reattach synchronously here. |
804 if (document().inStyleRecalc()) { | 858 if (document().inStyleRecalc()) { |
805 reattachLayoutTree(); | 859 reattachLayoutTree(); |
806 } else { | 860 } else { |
807 if (m_layoutDisposition == LayoutDisposition::FallbackContent) { | 861 if (m_layoutDisposition == LayoutDisposition::FallbackContent) { |
808 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; | 862 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; |
809 ensureUserAgentShadowRoot(); | 863 ensureUserAgentShadowRoot(); |
810 } | 864 } |
811 lazyReattachIfAttached(); | 865 lazyReattachIfAttached(); |
812 } | 866 } |
813 } | 867 } |
814 | 868 |
815 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() { | 869 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() { |
816 switch (m_layoutDisposition) { | 870 switch (m_layoutDisposition) { |
817 case LayoutDisposition::PrimaryContent: // Fall through. | 871 case LayoutDisposition::PrimaryContent: // Fall through. |
818 case LayoutDisposition::Collapsed: | 872 case LayoutDisposition::Collapsed: |
819 return originalStyleForLayoutObject(); | 873 return originalStyleForLayoutObject(); |
820 case LayoutDisposition::FallbackContent: | 874 case LayoutDisposition::FallbackContent: |
821 return HTMLImageFallbackHelper::customStyleForAltText( | 875 return HTMLImageFallbackHelper::customStyleForAltText( |
822 *this, ComputedStyle::clone(*originalStyleForLayoutObject())); | 876 *this, ComputedStyle::clone(*originalStyleForLayoutObject())); |
823 default: | 877 default: |
824 NOTREACHED(); | 878 NOTREACHED(); |
825 return nullptr; | 879 return nullptr; |
826 } | 880 } |
827 } | 881 } |
828 | 882 |
883 void HTMLImageElement::defaultEventHandler(Event* event) { | |
884 HTMLElement::defaultEventHandler(event); | |
885 if (m_decodePromiseResolvers.isEmpty()) | |
886 return; | |
887 | |
888 if (event->type() == EventTypeNames::load) { | |
889 requestDecode(); | |
hiroshige
2017/03/31 08:24:24
This always causes ChromeClient's requestDecode()
vmpstr
2017/03/31 17:00:16
This only passes here if line 885 is false, which
| |
890 } else if (event->type() == EventTypeNames::error) { | |
891 didDecode(false); | |
892 } | |
893 } | |
894 | |
829 IntSize HTMLImageElement::bitmapSourceSize() const { | 895 IntSize HTMLImageElement::bitmapSourceSize() const { |
830 ImageResourceContent* image = cachedImage(); | 896 ImageResourceContent* image = cachedImage(); |
831 if (!image) | 897 if (!image) |
832 return IntSize(); | 898 return IntSize(); |
833 LayoutSize lSize = image->imageSize( | 899 LayoutSize lSize = image->imageSize( |
834 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f); | 900 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f); |
835 DCHECK(lSize.fraction().isZero()); | 901 DCHECK(lSize.fraction().isZero()); |
836 return IntSize(lSize.width().toInt(), lSize.height().toInt()); | 902 return IntSize(lSize.width().toInt(), lSize.height().toInt()); |
837 } | 903 } |
838 | 904 |
839 void HTMLImageElement::associateWith(HTMLFormElement* form) { | 905 void HTMLImageElement::associateWith(HTMLFormElement* form) { |
840 if (form && form->isConnected()) { | 906 if (form && form->isConnected()) { |
841 m_form = form; | 907 m_form = form; |
842 m_formWasSetByParser = true; | 908 m_formWasSetByParser = true; |
843 m_form->associate(*this); | 909 m_form->associate(*this); |
844 m_form->didAssociateByParser(); | 910 m_form->didAssociateByParser(); |
845 } | 911 } |
846 }; | 912 }; |
847 | 913 |
848 FloatSize HTMLImageElement::sourceDefaultObjectSize() { | 914 FloatSize HTMLImageElement::sourceDefaultObjectSize() { |
849 return FloatSize(width(), height()); | 915 return FloatSize(width(), height()); |
850 } | 916 } |
851 | 917 |
852 } // namespace blink | 918 } // namespace blink |
OLD | NEW |