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_decodePromiseResolver); |
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_decodePromiseResolver); |
| 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_decodePromiseResolver) |
| 152 return; |
| 153 if (success) { |
| 154 m_decodePromiseResolver->resolve(); |
| 155 } else { |
| 156 m_decodePromiseResolver->reject(DOMException::create( |
| 157 EncodingError, "The source image cannot be decoded")); |
| 158 } |
| 159 m_decodePromiseResolver = nullptr; |
| 160 } |
| 161 |
128 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) { | 162 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) { |
129 HTMLImageElement* image = new HTMLImageElement(document); | 163 HTMLImageElement* image = new HTMLImageElement(document); |
130 image->m_elementCreatedByParser = false; | 164 image->m_elementCreatedByParser = false; |
131 return image; | 165 return image; |
132 } | 166 } |
133 | 167 |
134 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document, | 168 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document, |
135 unsigned width) { | 169 unsigned width) { |
136 HTMLImageElement* image = new HTMLImageElement(document); | 170 HTMLImageElement* image = new HTMLImageElement(document); |
137 image->setWidth(width); | 171 image->setWidth(width); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const QualifiedName& name = params.name; | 287 const QualifiedName& name = params.name; |
254 if (name == altAttr || name == titleAttr) { | 288 if (name == altAttr || name == titleAttr) { |
255 if (userAgentShadowRoot()) { | 289 if (userAgentShadowRoot()) { |
256 Element* text = userAgentShadowRoot()->getElementById("alttext"); | 290 Element* text = userAgentShadowRoot()->getElementById("alttext"); |
257 String value = altText(); | 291 String value = altText(); |
258 if (text && text->textContent() != params.newValue) | 292 if (text && text->textContent() != params.newValue) |
259 text->setTextContent(altText()); | 293 text->setTextContent(altText()); |
260 } | 294 } |
261 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { | 295 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { |
262 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); | 296 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); |
| 297 // Ensure to fail any pending decodes on possible source changes. |
| 298 if (m_decodePromiseResolver && params.oldValue != params.newValue) { |
| 299 didDecode(false); |
| 300 m_weakPtrFactory.revokeAll(); |
| 301 } |
263 } else if (name == usemapAttr) { | 302 } else if (name == usemapAttr) { |
264 setIsLink(!params.newValue.isNull()); | 303 setIsLink(!params.newValue.isNull()); |
265 } else if (name == referrerpolicyAttr) { | 304 } else if (name == referrerpolicyAttr) { |
266 m_referrerPolicy = ReferrerPolicyDefault; | 305 m_referrerPolicy = ReferrerPolicyDefault; |
267 if (!params.newValue.isNull()) { | 306 if (!params.newValue.isNull()) { |
268 SecurityPolicy::referrerPolicyFromString( | 307 SecurityPolicy::referrerPolicyFromString( |
269 params.newValue, SupportReferrerPolicyLegacyKeywords, | 308 params.newValue, SupportReferrerPolicyLegacyKeywords, |
270 &m_referrerPolicy); | 309 &m_referrerPolicy); |
271 UseCounter::count(document(), | 310 UseCounter::count(document(), |
272 UseCounter::HTMLImageElementReferrerPolicyAttribute); | 311 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. | 447 // our loader may have not fetched the image, so do it now. |
409 if ((insertionPoint->isConnected() && !imageLoader().image()) || | 448 if ((insertionPoint->isConnected() && !imageLoader().image()) || |
410 imageWasModified) | 449 imageWasModified) |
411 imageLoader().updateFromElement(ImageLoader::UpdateNormal, | 450 imageLoader().updateFromElement(ImageLoader::UpdateNormal, |
412 m_referrerPolicy); | 451 m_referrerPolicy); |
413 | 452 |
414 return HTMLElement::insertedInto(insertionPoint); | 453 return HTMLElement::insertedInto(insertionPoint); |
415 } | 454 } |
416 | 455 |
417 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) { | 456 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) { |
418 if (!m_form || | 457 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != |
419 NodeTraversal::highestAncestorOrSelf(*m_form.get()) != | 458 NodeTraversal::highestAncestorOrSelf(*this)) |
420 NodeTraversal::highestAncestorOrSelf(*this)) | |
421 resetFormOwner(); | 459 resetFormOwner(); |
422 if (m_listener) { | 460 if (m_listener) { |
423 document().mediaQueryMatcher().removeViewportListener(m_listener); | 461 document().mediaQueryMatcher().removeViewportListener(m_listener); |
424 Node* parent = parentNode(); | 462 Node* parent = parentNode(); |
425 if (parent && isHTMLPictureElement(*parent)) | 463 if (parent && isHTMLPictureElement(*parent)) |
426 toHTMLPictureElement(parent)->removeListenerFromSourceChildren(); | 464 toHTMLPictureElement(parent)->removeListenerFromSourceChildren(); |
427 } | 465 } |
428 HTMLElement::removedFrom(insertionPoint); | 466 HTMLElement::removedFrom(insertionPoint); |
429 } | 467 } |
430 | 468 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 } | 555 } |
518 | 556 |
519 const String& HTMLImageElement::currentSrc() const { | 557 const String& HTMLImageElement::currentSrc() const { |
520 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#dom-
img-currentsrc | 558 // 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 | 559 // The currentSrc IDL attribute must return the img element's current |
522 // request's current URL. | 560 // request's current URL. |
523 | 561 |
524 // Return the picked URL string in case of load error. | 562 // Return the picked URL string in case of load error. |
525 if (imageLoader().hadError()) | 563 if (imageLoader().hadError()) |
526 return m_bestFitImageURL; | 564 return m_bestFitImageURL; |
527 // Initially, the pending request turns into current request when it is either | 565 // 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 | 566 // either available or broken. We use the image's dimensions as a proxy to |
529 // in any of these states. | 567 // it being in any of these states. |
530 if (!imageLoader().image() || !imageLoader().image()->getImage() || | 568 if (!imageLoader().image() || !imageLoader().image()->getImage() || |
531 !imageLoader().image()->getImage()->width()) | 569 !imageLoader().image()->getImage()->width()) |
532 return emptyAtom; | 570 return emptyAtom; |
533 | 571 |
534 return imageLoader().image()->url().getString(); | 572 return imageLoader().image()->url().getString(); |
535 } | 573 } |
536 | 574 |
537 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const { | 575 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const { |
538 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr || | 576 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr || |
539 attribute.name() == longdescAttr || | 577 attribute.name() == longdescAttr || |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 623 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
586 LayoutObject* r = layoutObject(); | 624 LayoutObject* r = layoutObject(); |
587 if (!r) | 625 if (!r) |
588 return 0; | 626 return 0; |
589 | 627 |
590 // FIXME: This doesn't work correctly with transforms. | 628 // FIXME: This doesn't work correctly with transforms. |
591 FloatPoint absPos = r->localToAbsolute(); | 629 FloatPoint absPos = r->localToAbsolute(); |
592 return absPos.y(); | 630 return absPos.y(); |
593 } | 631 } |
594 | 632 |
| 633 ScriptPromise HTMLImageElement::decode(ScriptState* scriptState, |
| 634 ExceptionState& exceptionState) { |
| 635 exceptionState.clearException(); |
| 636 if (!m_decodePromiseResolver) |
| 637 m_decodePromiseResolver = ScriptPromiseResolver::create(scriptState); |
| 638 ScriptPromise promise = m_decodePromiseResolver->promise(); |
| 639 if (complete()) |
| 640 requestDecode(); |
| 641 return promise; |
| 642 } |
| 643 |
595 bool HTMLImageElement::complete() const { | 644 bool HTMLImageElement::complete() const { |
596 return imageLoader().imageComplete(); | 645 return imageLoader().imageComplete(); |
597 } | 646 } |
598 | 647 |
599 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) { | 648 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) { |
600 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); | 649 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); |
601 imageLoader().elementDidMoveToNewDocument(); | 650 imageLoader().elementDidMoveToNewDocument(); |
602 HTMLElement::didMoveToNewDocument(oldDocument); | 651 HTMLElement::didMoveToNewDocument(oldDocument); |
603 } | 652 } |
604 | 653 |
605 bool HTMLImageElement::isServerMap() const { | 654 bool HTMLImageElement::isServerMap() const { |
606 if (!fastHasAttribute(ismapAttr)) | 655 if (!fastHasAttribute(ismapAttr)) |
607 return false; | 656 return false; |
608 | 657 |
609 const AtomicString& usemap = fastGetAttribute(usemapAttr); | 658 const AtomicString& usemap = fastGetAttribute(usemapAttr); |
610 | 659 |
611 // If the usemap attribute starts with '#', it refers to a map element in the | 660 // If the usemap attribute starts with '#', it refers to a map element in |
612 // document. | 661 // the document. |
613 if (usemap[0] == '#') | 662 if (usemap[0] == '#') |
614 return false; | 663 return false; |
615 | 664 |
616 return document() | 665 return document() |
617 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)) | 666 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)) |
618 .isEmpty(); | 667 .isEmpty(); |
619 } | 668 } |
620 | 669 |
621 Image* HTMLImageElement::imageContents() { | 670 Image* HTMLImageElement::imageContents() { |
622 if (!imageLoader().imageComplete()) | 671 if (!imageLoader().imageComplete()) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 return m_layoutDisposition == LayoutDisposition::Collapsed; | 902 return m_layoutDisposition == LayoutDisposition::Collapsed; |
854 } | 903 } |
855 | 904 |
856 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition, | 905 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition, |
857 bool forceReattach) { | 906 bool forceReattach) { |
858 if (m_layoutDisposition == layoutDisposition && !forceReattach) | 907 if (m_layoutDisposition == layoutDisposition && !forceReattach) |
859 return; | 908 return; |
860 | 909 |
861 m_layoutDisposition = layoutDisposition; | 910 m_layoutDisposition = layoutDisposition; |
862 | 911 |
863 // This can happen inside of attachLayoutTree() in the middle of a recalcStyle | 912 // This can happen inside of attachLayoutTree() in the middle of a |
864 // so we need to reattach synchronously here. | 913 // recalcStyle so we need to reattach synchronously here. |
865 if (document().inStyleRecalc()) { | 914 if (document().inStyleRecalc()) { |
866 reattachLayoutTree(); | 915 reattachLayoutTree(); |
867 } else { | 916 } else { |
868 if (m_layoutDisposition == LayoutDisposition::FallbackContent) { | 917 if (m_layoutDisposition == LayoutDisposition::FallbackContent) { |
869 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; | 918 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; |
870 ensureUserAgentShadowRoot(); | 919 ensureUserAgentShadowRoot(); |
871 } | 920 } |
872 lazyReattachIfAttached(); | 921 lazyReattachIfAttached(); |
873 } | 922 } |
874 } | 923 } |
875 | 924 |
876 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() { | 925 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() { |
877 switch (m_layoutDisposition) { | 926 switch (m_layoutDisposition) { |
878 case LayoutDisposition::PrimaryContent: // Fall through. | 927 case LayoutDisposition::PrimaryContent: // Fall through. |
879 case LayoutDisposition::Collapsed: | 928 case LayoutDisposition::Collapsed: |
880 return originalStyleForLayoutObject(); | 929 return originalStyleForLayoutObject(); |
881 case LayoutDisposition::FallbackContent: | 930 case LayoutDisposition::FallbackContent: |
882 return HTMLImageFallbackHelper::customStyleForAltText( | 931 return HTMLImageFallbackHelper::customStyleForAltText( |
883 *this, ComputedStyle::clone(*originalStyleForLayoutObject())); | 932 *this, ComputedStyle::clone(*originalStyleForLayoutObject())); |
884 default: | 933 default: |
885 NOTREACHED(); | 934 NOTREACHED(); |
886 return nullptr; | 935 return nullptr; |
887 } | 936 } |
888 } | 937 } |
889 | 938 |
| 939 void HTMLImageElement::defaultEventHandler(Event* event) { |
| 940 HTMLElement::defaultEventHandler(event); |
| 941 if (!m_decodePromiseResolver) |
| 942 return; |
| 943 |
| 944 if (event->type() == EventTypeNames::load) { |
| 945 requestDecode(); |
| 946 } else if (event->type() == EventTypeNames::error) { |
| 947 didDecode(false); |
| 948 } |
| 949 } |
| 950 |
890 bool HTMLImageElement::isOpaque() const { | 951 bool HTMLImageElement::isOpaque() const { |
891 Image* image = const_cast<HTMLImageElement*>(this)->imageContents(); | 952 Image* image = const_cast<HTMLImageElement*>(this)->imageContents(); |
892 return image && image->currentFrameKnownToBeOpaque(); | 953 return image && image->currentFrameKnownToBeOpaque(); |
893 } | 954 } |
894 | 955 |
895 int HTMLImageElement::sourceWidth() { | 956 int HTMLImageElement::sourceWidth() { |
896 SourceImageStatus status; | 957 SourceImageStatus status; |
897 FloatSize defaultObjectSize(width(), height()); | 958 FloatSize defaultObjectSize(width(), height()); |
898 RefPtr<Image> image = getSourceImageForCanvas( | 959 RefPtr<Image> image = getSourceImageForCanvas( |
899 &status, PreferNoAcceleration, SnapshotReasonUnknown, defaultObjectSize); | 960 &status, PreferNoAcceleration, SnapshotReasonUnknown, defaultObjectSize); |
(...skipping 21 matching lines...) Expand all Loading... |
921 void HTMLImageElement::associateWith(HTMLFormElement* form) { | 982 void HTMLImageElement::associateWith(HTMLFormElement* form) { |
922 if (form && form->isConnected()) { | 983 if (form && form->isConnected()) { |
923 m_form = form; | 984 m_form = form; |
924 m_formWasSetByParser = true; | 985 m_formWasSetByParser = true; |
925 m_form->associate(*this); | 986 m_form->associate(*this); |
926 m_form->didAssociateByParser(); | 987 m_form->didAssociateByParser(); |
927 } | 988 } |
928 }; | 989 }; |
929 | 990 |
930 } // namespace blink | 991 } // namespace blink |
OLD | NEW |