Changeset 201889 in webkit
- Timestamp:
- Jun 9, 2016 3:34:41 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201887 r201889 1 2016-06-09 Antoine Quint <graouts@apple.com> 2 3 Changing canvas height immediately after page load does not relayout canvas 4 https://bugs.webkit.org/show_bug.cgi?id=156097 5 6 Reviewed by Zalan Bujtas. 7 8 * fast/canvas/canvas-css-size-after-height-change-with-display-flex-expected.html: Added. 9 * fast/canvas/canvas-css-size-after-height-change-with-display-flex.html: Added. 10 1 11 2016-06-09 Myles C. Maxfield <mmaxfield@apple.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r201887 r201889 1 2016-06-09 Antoine Quint <graouts@apple.com> 2 3 Changing canvas height immediately after page load does not relayout canvas 4 https://bugs.webkit.org/show_bug.cgi?id=156097 5 6 Reviewed by Zalan Bujtas. 7 8 Promote the logic use to identify whether we should perform a layout after a change of 9 intrinsic size from RenderImage to RenderReplaced such that RenderCanvas may use it 10 in canvasSizeChanged() and correctly update its layout in the case where the width 11 or height attribute is updated and there are no explicit sizing performed with CSS. 12 Additionally, this will also account for the object-fix property to only perform 13 a layout if necessary. 14 15 Test: fast/canvas/canvas-css-size-after-height-change-with-display-flex.html 16 17 * rendering/RenderHTMLCanvas.cpp: 18 (WebCore::RenderHTMLCanvas::canvasSizeChanged): 19 * rendering/RenderImage.cpp: 20 (WebCore::RenderImage::repaintOrMarkForLayout): 21 * rendering/RenderReplaced.cpp: 22 (WebCore::RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange): 23 * rendering/RenderReplaced.h: 24 1 25 2016-06-09 Myles C. Maxfield <mmaxfield@apple.com> 2 26 -
trunk/Source/WebCore/rendering/RenderHTMLCanvas.cpp
r200041 r201889 102 102 if (!parent()) 103 103 return; 104 105 if (!preferredLogicalWidthsDirty()) 106 setPreferredLogicalWidthsDirty(true); 107 108 LayoutSize oldSize = size(); 109 updateLogicalWidth(); 110 updateLogicalHeight(); 111 if (oldSize == size()) 112 return; 113 114 if (!selfNeedsLayout()) 115 setNeedsLayout(); 104 setNeedsLayoutIfNeededAfterIntrinsicSizeChange(); 116 105 } 117 106 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r201040 r201889 296 296 bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize || imageSizeChange != ImageSizeChangeNone; 297 297 298 if (imageSourceHasChangedSize) { 299 setPreferredLogicalWidthsDirty(true); 300 301 // If the actual area occupied by the image has changed and it is not constrained by style then a layout is required. 302 bool imageSizeIsConstrained = style().logicalWidth().isSpecified() && style().logicalHeight().isSpecified(); 303 304 // FIXME: We only need to recompute the containing block's preferred size 305 // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing). 306 // There's no easy way to detect that shrink-to-fit is needed, always force a layout. 307 bool containingBlockNeedsToRecomputePreferredSize = 308 style().logicalWidth().isPercentOrCalculated() 309 || style().logicalMaxWidth().isPercentOrCalculated() 310 || style().logicalMinWidth().isPercentOrCalculated(); 311 312 bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic; 313 314 if (!imageSizeIsConstrained || containingBlockNeedsToRecomputePreferredSize || layoutSizeDependsOnIntrinsicSize) { 315 // FIXME: It's not clear that triggering a layout guarantees a repaint in all cases. 316 // But many callers do depend on this code causing a layout. 317 setNeedsLayout(); 318 return; 319 } 320 } 298 if (imageSourceHasChangedSize && setNeedsLayoutIfNeededAfterIntrinsicSizeChange()) 299 return; 321 300 322 301 if (everHadLayout() && !selfNeedsLayout()) { -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r201752 r201889 291 291 } 292 292 293 bool RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange() 294 { 295 setPreferredLogicalWidthsDirty(true); 296 297 // If the actual area occupied by the image has changed and it is not constrained by style then a layout is required. 298 bool imageSizeIsConstrained = style().logicalWidth().isSpecified() && style().logicalHeight().isSpecified(); 299 300 // FIXME: We only need to recompute the containing block's preferred size 301 // if the containing block's size depends on the image's size (i.e., the container uses shrink-to-fit sizing). 302 // There's no easy way to detect that shrink-to-fit is needed, always force a layout. 303 bool containingBlockNeedsToRecomputePreferredSize = 304 style().logicalWidth().isPercentOrCalculated() 305 || style().logicalMaxWidth().isPercentOrCalculated() 306 || style().logicalMinWidth().isPercentOrCalculated(); 307 308 bool layoutSizeDependsOnIntrinsicSize = style().aspectRatioType() == AspectRatioFromIntrinsic; 309 310 if (!imageSizeIsConstrained || containingBlockNeedsToRecomputePreferredSize || layoutSizeDependsOnIntrinsicSize) { 311 setNeedsLayout(); 312 return true; 313 } 314 315 return false; 316 } 317 293 318 void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const 294 319 { -
trunk/Source/WebCore/rendering/RenderReplaced.h
r200041 r201889 38 38 bool hasReplacedLogicalWidth() const; 39 39 bool hasReplacedLogicalHeight() const; 40 bool setNeedsLayoutIfNeededAfterIntrinsicSizeChange(); 40 41 41 42 protected:
Note: See TracChangeset
for help on using the changeset viewer.