Commit 5b96ee12 authored by yoav@yoav.ws's avatar yoav@yoav.ws

Avoid scaling a zero-sized image

Since scaling a zero-sized image can result in dealing with NaNs (in case
that we're scaling it using an inf, which is fairly possible), we should
avoid doing that. This CL makes sure that we do.

As to why we're dealing with zero sized images to begin with, I've opened
crbug.com/522637, but it seems like something that can happen regardless,
when ImageResource doesn't have an Image.

BUG=521954

Review URL: https://codereview.chromium.org/1299493005

git-svn-id: svn://svn.chromium.org/blink/trunk@200879 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4b6c23a8
......@@ -347,7 +347,6 @@ crbug.com/490511 imported/web-platform-tests/html/rendering/non-replaced-element
crbug.com/490511 imported/web-platform-tests/html/rendering/non-replaced-elements/tables/table-border-2.html [ ImageOnlyFailure ]
crbug.com/490511 imported/web-platform-tests/html/semantics/document-metadata/styling/LinkStyle.html [ Failure Pass ]
crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-01.html [ ImageOnlyFailure ]
crbug.com/521954 imported/web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute.html [ Crash Failure Timeout ]
crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html [ Failure Timeout ]
crbug.com/490511 imported/web-platform-tests/html/semantics/text-level-semantics/the-wbr-element/wbr-element.html [ ImageOnlyFailure ]
crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ]
......
......@@ -100,7 +100,7 @@ LayoutSize LayoutImageResource::getImageSize(float multiplier, ImageResource::Si
if (!m_cachedImage)
return LayoutSize();
LayoutSize size = m_cachedImage->imageSizeForLayoutObject(m_layoutObject, multiplier, type);
if (m_layoutObject && m_layoutObject->isLayoutImage())
if (m_layoutObject && m_layoutObject->isLayoutImage() && size.width() && size.height())
size.scale(toLayoutImage(m_layoutObject)->imageDevicePixelRatio());
return size;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment