Chromium Code Reviews

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

Issue 1455763002: Use union type in ImageBitmapFactories.idl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix errors Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 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 612 matching lines...)
623 623
624 FloatSize HTMLImageElement::elementSize() const 624 FloatSize HTMLImageElement::elementSize() const
625 { 625 {
626 ImageResource* image = cachedImage(); 626 ImageResource* image = cachedImage();
627 if (!image) 627 if (!image)
628 return FloatSize(); 628 return FloatSize();
629 629
630 return FloatSize(image->imageSizeForLayoutObject(layoutObject(), 1.0f)); 630 return FloatSize(image->imageSizeForLayoutObject(layoutObject(), 1.0f));
631 } 631 }
632 632
633 IntSize HTMLImageElement::bitmapSourceSize() const
634 {
635 ImageResource* image = cachedImage();
636 if (!image)
637 return IntSize();
638 LayoutSize lSize = image->imageSizeForLayoutObject(layoutObject(), 1.0f);
Justin Novosad 2015/11/24 17:03:13 This should not depend on layout. We want access t
davve 2015/11/24 19:51:30 ImageResource::imageSizeForLayoutObject() doesn't
Justin Novosad 2015/11/24 20:14:58 Ah, that CL is a great readability improvement. X
xidachen 2015/11/25 17:01:54 Done.
639 return IntSize(lSize.width(), lSize.height());
640 }
641
633 FloatSize HTMLImageElement::defaultDestinationSize() const 642 FloatSize HTMLImageElement::defaultDestinationSize() const
634 { 643 {
635 ImageResource* image = cachedImage(); 644 ImageResource* image = cachedImage();
636 if (!image) 645 if (!image)
637 return FloatSize(); 646 return FloatSize();
638 LayoutSize size; 647 LayoutSize size;
639 size = image->imageSizeForLayoutObject(layoutObject(), 1.0f); 648 size = image->imageSizeForLayoutObject(layoutObject(), 1.0f);
640 if (layoutObject() && layoutObject()->isLayoutImage() && image->image() && ! image->image()->hasRelativeWidth()) 649 if (layoutObject() && layoutObject()->isLayoutImage() && image->image() && ! image->image()->hasRelativeWidth())
641 size.scale(toLayoutImage(layoutObject())->imageDevicePixelRatio()); 650 size.scale(toLayoutImage(layoutObject())->imageDevicePixelRatio());
642 return FloatSize(size); 651 return FloatSize(size);
(...skipping 126 matching lines...)
769 ensureUserAgentShadowRoot(); 778 ensureUserAgentShadowRoot();
770 } 779 }
771 780
772 bool HTMLImageElement::isOpaque() const 781 bool HTMLImageElement::isOpaque() const
773 { 782 {
774 Image* image = const_cast<HTMLImageElement*>(this)->imageContents(); 783 Image* image = const_cast<HTMLImageElement*>(this)->imageContents();
775 return image && image->currentFrameKnownToBeOpaque(); 784 return image && image->currentFrameKnownToBeOpaque();
776 } 785 }
777 786
778 } 787 }
OLDNEW

Powered by Google App Engine