You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Student project from the University of Utah!
This formula $1 + (r-1)^3$ is not being used for box shadow corner radius modification, but it should be (see last paragraph in section on csswg).
Right now, it is simply being added:
auto spread_corner = [&](auto& corner) {
if (corner) {
corner.horizontal_radius += spread_distance.value();
corner.vertical_radius += spread_distance.value();
}
};
The text was updated successfully, but these errors were encountered:
auto spread_corner = [&](auto& corner) {
if (corner) {
auto spread_distance_value = spread_distance.value();
// When radii < spread distance, modify spread distance in each direction per last paragraph of https://drafts.csswg.org/css-backgrounds/#shadow-shapeauto horizontal_spread_distance = spread_distance_value;
if (corner.horizontal_radius < spread_distance_value) {
auto radius_spread_ratio = static_cast<float>(corner.horizontal_radius) / spread_distance_value;
horizontal_spread_distance *= 1 + pow((radius_spread_ratio - 1), 3);
}
corner.horizontal_radius += round(horizontal_spread_distance);
auto vertical_spread_distance = spread_distance_value;
if (corner.vertical_radius < spread_distance_value) {
auto radius_spread_ratio = static_cast<float>(corner.vertical_radius) / spread_distance_value;
vertical_spread_distance *= 1 + pow((radius_spread_ratio - 1), 3);
}
corner.vertical_radius += round(vertical_spread_distance);
}
};
I tested this against the example csswg gave:
For example, if the border radius is 10px and the spread distance is 20px (r = .5), the corner radius of the shadow shape will be 10px + 20px × (1 + (.5 - 1)3) = 27.5px rather than 30px.
And found the same results (rounded because CSSPixels use integers):
horizontal: 10
vertical: 10
spread_distance: 20
horizontal ratio: 0.5
horizontal pow -0.125
new horizontal spread: 17
vertical ratio: 0.5
vertical pow: -0.125
new vertical spread: 17
new horizontal: 27
new vertical: 27
Student project from the University of Utah!
This formula $1 + (r-1)^3$ is not being used for box shadow corner radius modification, but it should be (see last paragraph in section on [csswg](https://drafts.csswg.org/css-backgrounds/#shadow-shape)).
Issue (still may need to be applied for inner shadow boxes): SerenityOS#24033
Student project from the University of Utah!$1 + (r-1)^3$ is not being used for box shadow corner radius modification, but it should be (see last paragraph in section on csswg).
This formula
Right now, it is simply being added:
The text was updated successfully, but these errors were encountered: