Diff
Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog 2016-08-23 09:51:15 UTC (rev 204789)
@@ -1,3 +1,13 @@
+2016-06-09 Antoine Quint <[email protected]>
+
+ Changing canvas height immediately after page load does not relayout canvas
+ https://bugs.webkit.org/show_bug.cgi?id=156097
+
+ Reviewed by Zalan Bujtas.
+
+ * fast/canvas/canvas-css-size-after-height-change-with-display-flex-expected.html: Added.
+ * fast/canvas/canvas-css-size-after-height-change-with-display-flex.html: Added.
+
2016-06-06 Jiewen Tan <[email protected]>
URLs containing tabs or newlines are parsed incorrectly
Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex-expected.html (0 => 204789)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex-expected.html (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex-expected.html 2016-08-23 09:51:15 UTC (rev 204789)
@@ -0,0 +1 @@
+<div style="height: 500px; background-color: blue;"></div>
Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex.html (0 => 204789)
--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex.html (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/canvas/canvas-css-size-after-height-change-with-display-flex.html 2016-08-23 09:51:15 UTC (rev 204789)
@@ -0,0 +1,14 @@
+<div style="display: flex; flex-direction: column;">
+ <canvas style="background-color: blue;">
+ <script>
+ if (window.testRunner)
+ testRunner.waitUntilDone();
+
+ window.requestAnimationFrame(function() {
+ document.querySelector("canvas").height = "500";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ </script>
+ </canvas>
+</div>
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog 2016-08-23 09:51:15 UTC (rev 204789)
@@ -1,3 +1,27 @@
+2016-06-09 Antoine Quint <[email protected]>
+
+ Changing canvas height immediately after page load does not relayout canvas
+ https://bugs.webkit.org/show_bug.cgi?id=156097
+
+ Reviewed by Zalan Bujtas.
+
+ Promote the logic use to identify whether we should perform a layout after a change of
+ intrinsic size from RenderImage to RenderReplaced such that RenderCanvas may use it
+ in canvasSizeChanged() and correctly update its layout in the case where the width
+ or height attribute is updated and there are no explicit sizing performed with CSS.
+ Additionally, this will also account for the object-fix property to only perform
+ a layout if necessary.
+
+ Test: fast/canvas/canvas-css-size-after-height-change-with-display-flex.html
+
+ * rendering/RenderHTMLCanvas.cpp:
+ (WebCore::RenderHTMLCanvas::canvasSizeChanged):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::repaintOrMarkForLayout):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange):
+ * rendering/RenderReplaced.h:
+
2016-06-06 Jiewen Tan <[email protected]>
URLs containing tabs or newlines are parsed incorrectly
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderHTMLCanvas.cpp (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderHTMLCanvas.cpp 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderHTMLCanvas.cpp 2016-08-23 09:51:15 UTC (rev 204789)
@@ -101,18 +101,7 @@
if (!parent())
return;
-
- if (!preferredLogicalWidthsDirty())
- setPreferredLogicalWidthsDirty(true);
-
- LayoutSize oldSize = size();
- updateLogicalWidth();
- updateLogicalHeight();
- if (oldSize == size())
- return;
-
- if (!selfNeedsLayout())
- setNeedsLayout();
+ setNeedsLayoutIfNeededAfterIntrinsicSizeChange();
}
} // namespace WebCore
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderImage.cpp (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderImage.cpp 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderImage.cpp 2016-08-23 09:51:15 UTC (rev 204789)
@@ -294,30 +294,9 @@
bool imageSourceHasChangedSize = oldIntrinsicSize != newIntrinsicSize || imageSizeChange != ImageSizeChangeNone;
- if (imageSourceHasChangedSize) {
- setPreferredLogicalWidthsDirty(true);
+ if (imageSourceHasChangedSize && setNeedsLayoutIfNeededAfterIntrinsicSizeChange())
+ return;
- // 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 (everHadLayout() && !selfNeedsLayout()) {
// The inner content rectangle is calculated during layout, but may need an update now
// (unless the box has already been scheduled for layout). In order to calculate it, we
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.cpp (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.cpp 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.cpp 2016-08-23 09:51:15 UTC (rev 204789)
@@ -287,6 +287,31 @@
return false;
}
+bool RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange()
+{
+ 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) {
+ setNeedsLayout();
+ return true;
+ }
+
+ return false;
+}
+
void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const
{
FloatSize intrinsicSize;
Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.h (204788 => 204789)
--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.h 2016-08-23 09:41:17 UTC (rev 204788)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderReplaced.h 2016-08-23 09:51:15 UTC (rev 204789)
@@ -37,6 +37,7 @@
bool hasReplacedLogicalWidth() const;
bool hasReplacedLogicalHeight() const;
+ bool setNeedsLayoutIfNeededAfterIntrinsicSizeChange();
protected:
RenderReplaced(Element&, Ref<RenderStyle>&&);