Title: [236636] trunk
- Revision
- 236636
- Author
- [email protected]
- Date
- 2018-09-28 20:29:04 -0700 (Fri, 28 Sep 2018)
Log Message
Angled gradient backgrounds in body render vertically when body height is 0
https://bugs.webkit.org/show_bug.cgi?id=177232
<rdar://problem/34548230>.
Patch by Zamiul Haque <[email protected]> on 2018-09-28
Reviewed by Tim Horton.
Source/WebCore:
Specifically, gradients displayed at an angle (ie. 45 degrees) are rendered
as if they are vertical when the body tag containing the gradient
has a height of 0. Other browsers do not render under these circumstances,
so WebKit was modified to follow in suit. The problem was due to layout sizes for
fill tiles being calculated with a minimum height of 1px. A simple change of the
minimum height and width to 0px was enough to bring about the desired behavior.
Tests: angled-background-repeating-gradient-rendering-vertical.html
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateFillTileSize const):
LayoutTests:
Added tests to make sure that angled background gradients inside of a
body tag of height 0 render as empty white screens.
* angled-background-repeating-gradient-rendering-vertical.html: Added.
* angled-background-repeating-gradient-rendering-vertical-expected.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (236635 => 236636)
--- trunk/LayoutTests/ChangeLog 2018-09-29 02:27:54 UTC (rev 236635)
+++ trunk/LayoutTests/ChangeLog 2018-09-29 03:29:04 UTC (rev 236636)
@@ -1,3 +1,17 @@
+2018-09-28 Zamiul Haque <[email protected]>
+
+ Angled gradient backgrounds in body render vertically when body height is 0
+ https://bugs.webkit.org/show_bug.cgi?id=177232
+ <rdar://problem/34548230>.
+
+ Reviewed by Tim Horton.
+
+ Added tests to make sure that angled background gradients inside of a
+ body tag of height 0 render as empty white screens.
+
+ * angled-background-repeating-gradient-rendering-vertical.html: Added.
+ * angled-background-repeating-gradient-rendering-vertical-expected.html: Added.
+
2018-09-28 Chris Dumez <[email protected]>
The return value of an OnBeforeUnloadEventHandler should always be coerced into a DOMString
Added: trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical-expected.html (0 => 236636)
--- trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical-expected.html (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical-expected.html 2018-09-29 03:29:04 UTC (rev 236636)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<html>
+<body></body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical.html (0 => 236636)
--- trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical.html (rev 0)
+++ trunk/LayoutTests/fast/backgrounds/angled-background-repeating-gradient-rendering-vertical.html 2018-09-29 03:29:04 UTC (rev 236636)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+ margin: 0;
+ background: repeating-linear-gradient(45deg, white, white 100px, black 100px, black 200px);
+}
+</style>
+</head>
+<body></body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (236635 => 236636)
--- trunk/Source/WebCore/ChangeLog 2018-09-29 02:27:54 UTC (rev 236635)
+++ trunk/Source/WebCore/ChangeLog 2018-09-29 03:29:04 UTC (rev 236636)
@@ -1,3 +1,23 @@
+2018-09-28 Zamiul Haque <[email protected]>
+
+ Angled gradient backgrounds in body render vertically when body height is 0
+ https://bugs.webkit.org/show_bug.cgi?id=177232
+ <rdar://problem/34548230>.
+
+ Reviewed by Tim Horton.
+
+ Specifically, gradients displayed at an angle (ie. 45 degrees) are rendered
+ as if they are vertical when the body tag containing the gradient
+ has a height of 0. Other browsers do not render under these circumstances,
+ so WebKit was modified to follow in suit. The problem was due to layout sizes for
+ fill tiles being calculated with a minimum height of 1px. A simple change of the
+ minimum height and width to 0px was enough to bring about the desired behavior.
+
+ Tests: angled-background-repeating-gradient-rendering-vertical.html
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::calculateFillTileSize const):
+
2018-09-28 Wenson Hsieh <[email protected]>
No DOM API to instantiate an attachment for an img element
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (236635 => 236636)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2018-09-29 02:27:54 UTC (rev 236635)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2018-09-29 03:29:04 UTC (rev 236636)
@@ -1151,14 +1151,17 @@
float horizontalScaleFactor = localImageIntrinsicSize.width() ? (localPositioningAreaSize.width() / localImageIntrinsicSize.width()) : 1;
float verticalScaleFactor = localImageIntrinsicSize.height() ? (localPositioningAreaSize.height() / localImageIntrinsicSize.height()) : 1;
float scaleFactor = type == FillSizeType::Contain ? std::min(horizontalScaleFactor, verticalScaleFactor) : std::max(horizontalScaleFactor, verticalScaleFactor);
- float deviceScaleFactor = document().deviceScaleFactor();
- return LayoutSize(std::max<LayoutUnit>(1 / deviceScaleFactor, localImageIntrinsicSize.width() * scaleFactor),
- std::max<LayoutUnit>(1 / deviceScaleFactor, localImageIntrinsicSize.height() * scaleFactor));
+ float singleScaledPixel = 1.0 / document().deviceScaleFactor();
+
+ if (localImageIntrinsicSize.isEmpty())
+ return { };
+
+ return LayoutSize(localImageIntrinsicSize.scaled(scaleFactor).expandedTo({ singleScaledPixel, singleScaledPixel }));
}
}
ASSERT_NOT_REACHED();
- return LayoutSize();
+ return { };
}
static void pixelSnapBackgroundImageGeometryForPainting(LayoutRect& destinationRect, LayoutSize& tileSize, LayoutSize& phase, LayoutSize& space, float scaleFactor)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes