diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-09-28 16:39:37 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:31:01 +0000 |
commit | 9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c (patch) | |
tree | 322337ad0acbc75732f916376ec6d36e7ec0e5bc /Source/WebCore/rendering/RenderImage.cpp | |
parent | 6882a04fb36642862b11efe514251d32070c3d65 (diff) | |
download | qtwebkit-9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c.tar.gz |
Imported WebKit commit eb954cdcf58f9b915b2fcb6f8e4cb3a60650a4f3
Change-Id: I8dda875c38075d43b76fe3a21acb0ffa102bb82d
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/rendering/RenderImage.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderImage.cpp | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index d8ee8150b..00d907829 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -294,29 +294,8 @@ void RenderImage::repaintOrMarkForLayout(ImageSizeChangeType imageSizeChange, co bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize || imageSizeChange != ImageSizeChangeNone; - if (imageSourceHasChangedSize) { - setPreferredLogicalWidthsDirty(true); - - // If the actual area occupied by the image has changed and it is not constrained by style then a layout is required. - bool imageSizeIsConstrained = style().logicalWidth().isSpecified() && style().logicalHeight().isSpecified(); - - // FIXME: We only need to recompute the containing block's preferred size - // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing). - // There's no easy way to detect that shrink-to-fit is needed, always force a layout. - bool containingBlockNeedsToRecomputePreferredSize = - style().logicalWidth().isPercentOrCalculated() - || style().logicalMaxWidth().isPercentOrCalculated() - || style().logicalMinWidth().isPercentOrCalculated(); - - bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic; - - if (!imageSizeIsConstrained || containingBlockNeedsToRecomputePreferredSize || layoutSizeDependsOnIntrinsicSize) { - // FIXME: It's not clear that triggering a layout guarantees a repaint in all cases. - // But many callers do depend on this code causing a layout. - setNeedsLayout(); - return; - } - } + if (imageSourceHasChangedSize && setNeedsLayoutIfNeededAfterIntrinsicSizeChange()) + return; if (everHadLayout() && !selfNeedsLayout()) { // The inner content rectangle is calculated during layout, but may need an update now @@ -574,6 +553,11 @@ bool RenderImage::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, ObjectFit objectFit = style().objectFit(); if (objectFit != ObjectFitFill && objectFit != ObjectFitCover) return false; + + LengthPoint objectPosition = style().objectPosition(); + if (objectPosition != RenderStyle::initialObjectPosition()) + return false; + // Check for image with alpha. return imageResource().cachedImage() && imageResource().cachedImage()->currentFrameKnownToBeOpaque(this); } |