Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLImageElement.cpp

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: update Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 using ResolverFunc = void (*)(ScriptPromiseResolver*);
154 static ResolverFunc resolve = [](ScriptPromiseResolver* resolver) {
155 resolver->resolve();
156 };
157 static ResolverFunc reject = [](ScriptPromiseResolver* resolver) {
158 resolver->reject(DOMException::create(
159 EncodingError, "The source image cannot be decoded"));
160 };
161 ResolverFunc process = success ? resolve : reject;
162 for (auto& resolver : m_decodePromiseResolvers)
kouhei (in TOK) 2017/04/04 02:55:14 Can we simply if (success) and do two for loops?
vmpstr 2017/04/04 20:52:22 Done.
163 process(resolver);
164 m_decodePromiseResolvers.clear();
165 }
166
128 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) { 167 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document) {
129 HTMLImageElement* image = new HTMLImageElement(document); 168 HTMLImageElement* image = new HTMLImageElement(document);
130 image->m_elementCreatedByParser = false; 169 image->m_elementCreatedByParser = false;
131 return image; 170 return image;
132 } 171 }
133 172
134 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document, 173 HTMLImageElement* HTMLImageElement::createForJSConstructor(Document& document,
135 unsigned width) { 174 unsigned width) {
136 HTMLImageElement* image = new HTMLImageElement(document); 175 HTMLImageElement* image = new HTMLImageElement(document);
137 image->setWidth(width); 176 image->setWidth(width);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 const QualifiedName& name = params.name; 292 const QualifiedName& name = params.name;
254 if (name == altAttr || name == titleAttr) { 293 if (name == altAttr || name == titleAttr) {
255 if (userAgentShadowRoot()) { 294 if (userAgentShadowRoot()) {
256 Element* text = userAgentShadowRoot()->getElementById("alttext"); 295 Element* text = userAgentShadowRoot()->getElementById("alttext");
257 String value = altText(); 296 String value = altText();
258 if (text && text->textContent() != params.newValue) 297 if (text && text->textContent() != params.newValue)
259 text->setTextContent(altText()); 298 text->setTextContent(altText());
260 } 299 }
261 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { 300 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
262 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); 301 selectSourceURL(ImageLoader::UpdateIgnorePreviousError);
302 // Ensure to fail any pending decodes on possible source changes.
303 if (!m_decodePromiseResolvers.isEmpty() &&
304 params.oldValue != params.newValue) {
305 didDecode(false);
306 m_weakPtrFactory.revokeAll();
307 }
263 } else if (name == usemapAttr) { 308 } else if (name == usemapAttr) {
264 setIsLink(!params.newValue.isNull()); 309 setIsLink(!params.newValue.isNull());
265 } else if (name == referrerpolicyAttr) { 310 } else if (name == referrerpolicyAttr) {
266 m_referrerPolicy = ReferrerPolicyDefault; 311 m_referrerPolicy = ReferrerPolicyDefault;
267 if (!params.newValue.isNull()) { 312 if (!params.newValue.isNull()) {
268 SecurityPolicy::referrerPolicyFromString( 313 SecurityPolicy::referrerPolicyFromString(
269 params.newValue, SupportReferrerPolicyLegacyKeywords, 314 params.newValue, SupportReferrerPolicyLegacyKeywords,
270 &m_referrerPolicy); 315 &m_referrerPolicy);
271 UseCounter::count(document(), 316 UseCounter::count(document(),
272 UseCounter::HTMLImageElementReferrerPolicyAttribute); 317 UseCounter::HTMLImageElementReferrerPolicyAttribute);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // our loader may have not fetched the image, so do it now. 453 // our loader may have not fetched the image, so do it now.
409 if ((insertionPoint->isConnected() && !imageLoader().image()) || 454 if ((insertionPoint->isConnected() && !imageLoader().image()) ||
410 imageWasModified) 455 imageWasModified)
411 imageLoader().updateFromElement(ImageLoader::UpdateNormal, 456 imageLoader().updateFromElement(ImageLoader::UpdateNormal,
412 m_referrerPolicy); 457 m_referrerPolicy);
413 458
414 return HTMLElement::insertedInto(insertionPoint); 459 return HTMLElement::insertedInto(insertionPoint);
415 } 460 }
416 461
417 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) { 462 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) {
418 if (!m_form || 463 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) !=
419 NodeTraversal::highestAncestorOrSelf(*m_form.get()) != 464 NodeTraversal::highestAncestorOrSelf(*this))
420 NodeTraversal::highestAncestorOrSelf(*this))
421 resetFormOwner(); 465 resetFormOwner();
422 if (m_listener) { 466 if (m_listener) {
423 document().mediaQueryMatcher().removeViewportListener(m_listener); 467 document().mediaQueryMatcher().removeViewportListener(m_listener);
424 Node* parent = parentNode(); 468 Node* parent = parentNode();
425 if (parent && isHTMLPictureElement(*parent)) 469 if (parent && isHTMLPictureElement(*parent))
426 toHTMLPictureElement(parent)->removeListenerFromSourceChildren(); 470 toHTMLPictureElement(parent)->removeListenerFromSourceChildren();
427 } 471 }
428 HTMLElement::removedFrom(insertionPoint); 472 HTMLElement::removedFrom(insertionPoint);
429 } 473 }
430 474
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 561 }
518 562
519 const String& HTMLImageElement::currentSrc() const { 563 const String& HTMLImageElement::currentSrc() const {
520 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#dom- img-currentsrc 564 // 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 565 // The currentSrc IDL attribute must return the img element's current
522 // request's current URL. 566 // request's current URL.
523 567
524 // Return the picked URL string in case of load error. 568 // Return the picked URL string in case of load error.
525 if (imageLoader().hadError()) 569 if (imageLoader().hadError())
526 return m_bestFitImageURL; 570 return m_bestFitImageURL;
527 // Initially, the pending request turns into current request when it is either 571 // 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 572 // either available or broken. We use the image's dimensions as a proxy to
529 // in any of these states. 573 // it being in any of these states.
530 if (!imageLoader().image() || !imageLoader().image()->getImage() || 574 if (!imageLoader().image() || !imageLoader().image()->getImage() ||
531 !imageLoader().image()->getImage()->width()) 575 !imageLoader().image()->getImage()->width())
532 return emptyAtom; 576 return emptyAtom;
533 577
534 return imageLoader().image()->url().getString(); 578 return imageLoader().image()->url().getString();
535 } 579 }
536 580
537 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const { 581 bool HTMLImageElement::isURLAttribute(const Attribute& attribute) const {
538 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr || 582 return attribute.name() == srcAttr || attribute.name() == lowsrcAttr ||
539 attribute.name() == longdescAttr || 583 attribute.name() == longdescAttr ||
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 document().updateStyleAndLayoutIgnorePendingStylesheets(); 629 document().updateStyleAndLayoutIgnorePendingStylesheets();
586 LayoutObject* r = layoutObject(); 630 LayoutObject* r = layoutObject();
587 if (!r) 631 if (!r)
588 return 0; 632 return 0;
589 633
590 // FIXME: This doesn't work correctly with transforms. 634 // FIXME: This doesn't work correctly with transforms.
591 FloatPoint absPos = r->localToAbsolute(); 635 FloatPoint absPos = r->localToAbsolute();
592 return absPos.y(); 636 return absPos.y();
593 } 637 }
594 638
639 ScriptPromise HTMLImageElement::decode(ScriptState* scriptState,
640 ExceptionState& exceptionState) {
641 exceptionState.clearException();
642 m_decodePromiseResolvers.push_back(
643 ScriptPromiseResolver::create(scriptState));
644 ScriptPromise promise = m_decodePromiseResolvers.back()->promise();
645 if (complete())
646 requestDecode();
647 return promise;
648 }
649
595 bool HTMLImageElement::complete() const { 650 bool HTMLImageElement::complete() const {
596 return imageLoader().imageComplete(); 651 return imageLoader().imageComplete();
597 } 652 }
598 653
599 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) { 654 void HTMLImageElement::didMoveToNewDocument(Document& oldDocument) {
600 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); 655 selectSourceURL(ImageLoader::UpdateIgnorePreviousError);
601 imageLoader().elementDidMoveToNewDocument(); 656 imageLoader().elementDidMoveToNewDocument();
602 HTMLElement::didMoveToNewDocument(oldDocument); 657 HTMLElement::didMoveToNewDocument(oldDocument);
603 } 658 }
604 659
605 bool HTMLImageElement::isServerMap() const { 660 bool HTMLImageElement::isServerMap() const {
606 if (!fastHasAttribute(ismapAttr)) 661 if (!fastHasAttribute(ismapAttr))
607 return false; 662 return false;
608 663
609 const AtomicString& usemap = fastGetAttribute(usemapAttr); 664 const AtomicString& usemap = fastGetAttribute(usemapAttr);
610 665
611 // If the usemap attribute starts with '#', it refers to a map element in the 666 // If the usemap attribute starts with '#', it refers to a map element in
612 // document. 667 // the document.
613 if (usemap[0] == '#') 668 if (usemap[0] == '#')
614 return false; 669 return false;
615 670
616 return document() 671 return document()
617 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)) 672 .completeURL(stripLeadingAndTrailingHTMLSpaces(usemap))
618 .isEmpty(); 673 .isEmpty();
619 } 674 }
620 675
621 Image* HTMLImageElement::imageContents() { 676 Image* HTMLImageElement::imageContents() {
622 if (!imageLoader().imageComplete()) 677 if (!imageLoader().imageComplete())
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 return m_layoutDisposition == LayoutDisposition::Collapsed; 847 return m_layoutDisposition == LayoutDisposition::Collapsed;
793 } 848 }
794 849
795 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition, 850 void HTMLImageElement::setLayoutDisposition(LayoutDisposition layoutDisposition,
796 bool forceReattach) { 851 bool forceReattach) {
797 if (m_layoutDisposition == layoutDisposition && !forceReattach) 852 if (m_layoutDisposition == layoutDisposition && !forceReattach)
798 return; 853 return;
799 854
800 m_layoutDisposition = layoutDisposition; 855 m_layoutDisposition = layoutDisposition;
801 856
802 // This can happen inside of attachLayoutTree() in the middle of a recalcStyle 857 // This can happen inside of attachLayoutTree() in the middle of a
803 // so we need to reattach synchronously here. 858 // recalcStyle so we need to reattach synchronously here.
804 if (document().inStyleRecalc()) { 859 if (document().inStyleRecalc()) {
805 reattachLayoutTree(); 860 reattachLayoutTree();
806 } else { 861 } else {
807 if (m_layoutDisposition == LayoutDisposition::FallbackContent) { 862 if (m_layoutDisposition == LayoutDisposition::FallbackContent) {
808 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents; 863 EventDispatchForbiddenScope::AllowUserAgentEvents allowEvents;
809 ensureUserAgentShadowRoot(); 864 ensureUserAgentShadowRoot();
810 } 865 }
811 lazyReattachIfAttached(); 866 lazyReattachIfAttached();
812 } 867 }
813 } 868 }
814 869
815 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() { 870 PassRefPtr<ComputedStyle> HTMLImageElement::customStyleForLayoutObject() {
816 switch (m_layoutDisposition) { 871 switch (m_layoutDisposition) {
817 case LayoutDisposition::PrimaryContent: // Fall through. 872 case LayoutDisposition::PrimaryContent: // Fall through.
818 case LayoutDisposition::Collapsed: 873 case LayoutDisposition::Collapsed:
819 return originalStyleForLayoutObject(); 874 return originalStyleForLayoutObject();
820 case LayoutDisposition::FallbackContent: 875 case LayoutDisposition::FallbackContent:
821 return HTMLImageFallbackHelper::customStyleForAltText( 876 return HTMLImageFallbackHelper::customStyleForAltText(
822 *this, ComputedStyle::clone(*originalStyleForLayoutObject())); 877 *this, ComputedStyle::clone(*originalStyleForLayoutObject()));
823 default: 878 default:
824 NOTREACHED(); 879 NOTREACHED();
825 return nullptr; 880 return nullptr;
826 } 881 }
827 } 882 }
828 883
884 void HTMLImageElement::defaultEventHandler(Event* event) {
kouhei (in TOK) 2017/04/04 02:55:14 This is hook too generic to use. How about using {
vmpstr 2017/04/04 20:52:22 Done. I forwarded the call here (to a new HTMLImag
885 HTMLElement::defaultEventHandler(event);
886
887 // Note that the rest of the function here deals with events that can trigger
888 // a decode internally. We only need to check the events if we have a decode
889 // promise resolver (ie, ::decode was called).
890 if (m_decodePromiseResolvers.isEmpty())
891 return;
892
893 if (event->type() == EventTypeNames::load) {
894 requestDecode();
895 } else if (event->type() == EventTypeNames::error) {
896 didDecode(false);
897 }
898 }
899
829 IntSize HTMLImageElement::bitmapSourceSize() const { 900 IntSize HTMLImageElement::bitmapSourceSize() const {
830 ImageResourceContent* image = cachedImage(); 901 ImageResourceContent* image = cachedImage();
831 if (!image) 902 if (!image)
832 return IntSize(); 903 return IntSize();
833 LayoutSize lSize = image->imageSize( 904 LayoutSize lSize = image->imageSize(
834 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f); 905 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f);
835 DCHECK(lSize.fraction().isZero()); 906 DCHECK(lSize.fraction().isZero());
836 return IntSize(lSize.width().toInt(), lSize.height().toInt()); 907 return IntSize(lSize.width().toInt(), lSize.height().toInt());
837 } 908 }
838 909
839 void HTMLImageElement::associateWith(HTMLFormElement* form) { 910 void HTMLImageElement::associateWith(HTMLFormElement* form) {
840 if (form && form->isConnected()) { 911 if (form && form->isConnected()) {
841 m_form = form; 912 m_form = form;
842 m_formWasSetByParser = true; 913 m_formWasSetByParser = true;
843 m_form->associate(*this); 914 m_form->associate(*this);
844 m_form->didAssociateByParser(); 915 m_form->didAssociateByParser();
845 } 916 }
846 }; 917 };
847 918
848 FloatSize HTMLImageElement::sourceDefaultObjectSize() { 919 FloatSize HTMLImageElement::sourceDefaultObjectSize() {
849 return FloatSize(width(), height()); 920 return FloatSize(width(), height());
850 } 921 }
851 922
852 } // namespace blink 923 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageElement.h ('k') | third_party/WebKit/Source/core/html/HTMLImageElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698