Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLImageElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp |
| index ae94760df80dc15558cfd47ca4327036312ba7e1..5df5f10b3b93adbc35f0b5932b801d82c5d59db5 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp |
| @@ -57,6 +57,18 @@ namespace blink { |
| using namespace HTMLNames; |
| +namespace { |
| + |
| +RespectImageOrientationEnum shouldRespectImageOrientation(LayoutObject* layoutObject) |
| +{ |
| + if (layoutObject) |
| + return layoutObject->shouldRespectImageOrientation(); |
| + |
| + return DoNotRespectImageOrientation; |
| +} |
| + |
| +} // anonymous namespace |
| + |
| class HTMLImageElement::ViewportChangeListener final : public MediaQueryListListener { |
| public: |
| static RefPtrWillBeRawPtr<ViewportChangeListener> create(HTMLImageElement* element) |
| @@ -427,7 +439,7 @@ int HTMLImageElement::width() |
| // if the image is available, use its width |
| if (imageLoader().image()) |
| - return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), 1.0f).width(); |
| + return imageLoader().image()->imageSize(DoNotRespectImageOrientation, 1.0f).width(); |
|
Yoav Weiss
2015/11/24 10:29:07
Are you sure this does not change behavior?
I'd
davve
2015/11/24 12:49:13
This is the layoutObject() == null code path.
The
Yoav Weiss
2015/11/24 13:06:56
Fair enough. I would prefer shouldRespectImageOrie
|
| } |
| LayoutBox* box = layoutBox(); |
| @@ -448,7 +460,7 @@ int HTMLImageElement::height() |
| // if the image is available, use its height |
| if (imageLoader().image()) |
| - return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), 1.0f).height(); |
| + return imageLoader().image()->imageSize(DoNotRespectImageOrientation, 1.0f).height(); |
|
Yoav Weiss
2015/11/24 10:29:07
ditto
davve
2015/11/24 12:49:13
See other reply.
|
| } |
| LayoutBox* box = layoutBox(); |
| @@ -460,7 +472,7 @@ int HTMLImageElement::naturalWidth() const |
| if (!imageLoader().image()) |
| return 0; |
| - return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), m_imageDevicePixelRatio, ImageResource::IntrinsicCorrectedToDPR).width(); |
| + return imageLoader().image()->imageSize(shouldRespectImageOrientation(layoutObject()), m_imageDevicePixelRatio, ImageResource::IntrinsicCorrectedToDPR).width(); |
| } |
| int HTMLImageElement::naturalHeight() const |
| @@ -468,7 +480,7 @@ int HTMLImageElement::naturalHeight() const |
| if (!imageLoader().image()) |
| return 0; |
| - return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), m_imageDevicePixelRatio, ImageResource::IntrinsicCorrectedToDPR).height(); |
| + return imageLoader().image()->imageSize(shouldRespectImageOrientation(layoutObject()), m_imageDevicePixelRatio, ImageResource::IntrinsicCorrectedToDPR).height(); |
| } |
| const String& HTMLImageElement::currentSrc() const |
| @@ -627,7 +639,7 @@ FloatSize HTMLImageElement::elementSize() const |
| if (!image) |
| return FloatSize(); |
| - return FloatSize(image->imageSizeForLayoutObject(layoutObject(), 1.0f)); |
| + return FloatSize(image->imageSize(shouldRespectImageOrientation(layoutObject()), 1.0f)); |
| } |
| FloatSize HTMLImageElement::defaultDestinationSize() const |
| @@ -636,7 +648,7 @@ FloatSize HTMLImageElement::defaultDestinationSize() const |
| if (!image) |
| return FloatSize(); |
| LayoutSize size; |
| - size = image->imageSizeForLayoutObject(layoutObject(), 1.0f); |
| + size = image->imageSize(shouldRespectImageOrientation(layoutObject()), 1.0f); |
| if (layoutObject() && layoutObject()->isLayoutImage() && image->image() && !image->image()->hasRelativeWidth()) |
| size.scale(toLayoutImage(layoutObject())->imageDevicePixelRatio()); |
| return FloatSize(size); |