Skip to content
Permalink
Browse files
[css-ui] Fix box-sizing web platform test failures
https://bugs.webkit.org/show_bug.cgi?id=175287
rdar://103700285

Reviewed by Tim Nguyen.

This fixes the logicalWidth computation in RenderReplaced according
to the equation described in the CSS 2.2 specification
https://www.w3.org/TR/CSS22/visudet.html#blockwidth

This also removes two tests and their expectations from the tree
which are covered by WPT tests and have also been removed
from the blink codebase. That would fix
https://bugs.webkit.org/show_bug.cgi?id=228211

* LayoutTests/css2.1/20110323/replaced-intrinsic-003.htm: Removed.
* LayoutTests/css2.1/20110323/resources/replaced-intrinsic-003.svg: Removed.
* LayoutTests/imported/w3c/web-platform-tests/css/css-position/position-absolute-replaced-minmax-expected.txt:
* LayoutTests/platform/glib/css2.1/20110323/replaced-intrinsic-003-expected.txt: Removed.
* LayoutTests/platform/gtk/css2.1/20110323/replaced-intrinsic-003-expected.png: Removed.
* LayoutTests/platform/gtk/svg/hixie/intrinsic/003-expected.png: Removed.
* LayoutTests/platform/gtk/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/ios-wk2/svg/hixie/intrinsic/003-expected.png: Removed.
* LayoutTests/platform/ios-wk2/TestExpectations:
* LayoutTests/platform/ios/css2.1/20110323/replaced-intrinsic-003-expected.txt: Removed.
* LayoutTests/platform/ios/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/mac-ventura-wk2-pixel/svg/hixie/intrinsic/003-expected.png: Removed.
* LayoutTests/platform/mac-wk1/TestExpectations:
* LayoutTests/platform/mac/css2.1/20110323/replaced-intrinsic-003-expected.png: Removed.
* LayoutTests/platform/mac/css2.1/20110323/replaced-intrinsic-003-expected.txt: Removed.
* LayoutTests/platform/mac/svg/hixie/intrinsic/003-expected.png: Removed.
* LayoutTests/platform/mac/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/win/css2.1/20110323/replaced-intrinsic-003-expected.txt: Removed.
* LayoutTests/platform/win/svg/hixie/intrinsic/003-expected.png: Removed.
* LayoutTests/platform/win/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/win/TestExpectations:
* LayoutTests/platform/wincairo/css2.1/20110323/replaced-intrinsic-003-expected.txt: Removed.
* LayoutTests/platform/wincairo/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/platform/wpe/svg/hixie/intrinsic/003-expected.txt: Removed.
* LayoutTests/svg/hixie/intrinsic/003.html: Removed.
* LayoutTests/svg/hixie/intrinsic/resources/003.svg: Removed.
* LayoutTests/TestExpectations:
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeConstrainedLogicalWidth const):

Canonical link: https://commits.webkit.org/258342@main
  • Loading branch information
karlcow authored and smfr committed Dec 27, 2022
1 parent 5e49eca commit 21c66fcd81750f21944d2057c20c00d2633011b6
Show file tree
Hide file tree
Showing 30 changed files with 4 additions and 250 deletions.
@@ -3128,13 +3128,7 @@ webkit.org/b/172609 fetch/closing-while-fetching-blob.html [ Skip ]

webkit.org/b/175291 imported/w3c/web-platform-tests/css/css-ui/outline-018.html [ Skip ]

webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-014.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-015.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-016.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-018.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-019.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-024.html [ ImageOnlyFailure ]
webkit.org/b/175287 imported/w3c/web-platform-tests/css/css-ui/box-sizing-025.html [ ImageOnlyFailure ]

webkit.org/b/175288 imported/w3c/web-platform-tests/css/css-ui/outline-013.html [ ImageOnlyFailure ]
webkit.org/b/175288 imported/w3c/web-platform-tests/css/css-ui/outline-014.html [ ImageOnlyFailure ]
@@ -5937,12 +5931,6 @@ imported/w3c/web-platform-tests/streams/idlharness-shadowrealm.window.html [ Pas
imported/w3c/web-platform-tests/url/idlharness-shadowrealm.window.html [ Pass Failure ]
imported/w3c/web-platform-tests/user-timing/idlharness-shadowrealm.window.html [ Pass Failure ]

# Failing since their import.
imported/w3c/web-platform-tests/css/css-typed-om/rotate-by-added-angle.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-typed-om/width-by-clamp-px-em.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-typed-om/width-by-max-px-em.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-typed-om/width-by-min-px-em.html [ ImageOnlyFailure ]

# modulepreload is not supported
imported/w3c/web-platform-tests/import-maps/acquiring/modulepreload.html [ Skip ]
imported/w3c/web-platform-tests/import-maps/acquiring/modulepreload-link-header.html [ Skip ]

This file was deleted.

This file was deleted.

@@ -34,8 +34,8 @@ PASS minmax replaced IMG svg 31
PASS minmax replaced IMG svg 32
PASS minmax replaced IMG svg 33
PASS minmax replaced IMG 34
FAIL minmax replaced IMG 35 assert_equals: incorrect offsetWidth expected "388" but got "408"
FAIL minmax replaced IMG 36 assert_equals: incorrect offsetWidth expected "188" but got "408"
PASS minmax replaced IMG 35
FAIL minmax replaced IMG 36 assert_equals: incorrect offsetWidth expected "188" but got "388"
FAIL minmax replaced IMG 37 assert_equals: incorrect offsetWidth expected "188" but got "138"
PASS minmax replaced IMG 38
PASS minmax replaced IMG 39

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

@@ -369,7 +369,6 @@ svg/custom/focus-event-handling.xhtml [ Failure ]
svg/custom/non-scaling-stroke-update.svg [ ImageOnlyFailure ]
svg/custom/svg-fonts-fallback.xhtml [ Failure ]
svg/filters/feTurbulence_bad_seeds.html [ ImageOnlyFailure ]
svg/hixie/intrinsic/003.html [ Failure ]
svg/zoom/page/absolute-sized-document-no-scrollbars.svg [ Failure ]
svg/zoom/page/relative-sized-document-scrollbars.svg [ Failure ]
svg/zoom/page/zoom-background-image-tiled.html [ Failure ]
Binary file not shown.
@@ -1908,7 +1908,6 @@ http/tests/misc/favicon-as-image.html [ Failure ]
http/tests/misc/iframe404.html [ Failure ]
http/tests/misc/slow-loading-image-in-pattern.html [ Failure ]
http/tests/uri/css-href.py [ Failure ]
svg/hixie/intrinsic/003.html [ Failure ]
svg/hixie/text/003.html [ Failure ]

# Editing tests that are flaky:

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
@@ -2177,8 +2177,6 @@ webkit.org/b/209878 [ Debug ] webrtc/datachannel/multiple-connections.html [ Pas

webkit.org/b/230055 [ BigSur ] webrtc/datachannel/datachannel-page-cache-send.html [ Pass Timeout ]

webkit.org/b/228211 css2.1/20110323/replaced-intrinsic-003.htm [ Pass Failure ]

webkit.org/b/230425 printing/allowed-breaks.html [ Pass Failure ]

# webkit.org/b/214448 Web Share API is not implemented for mac-wk1
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

@@ -2945,7 +2945,6 @@ transforms/3d [ Skip ]
[ Debug ] css2.1/t1605-c545-txttrans-00-b-ag.html [ Skip ] # Debug assertion
[ Debug ] css2.1/t1606-c562-white-sp-00-b-ag.html [ Skip ] # Debug assertion
[ Debug ] css2.1/t040303-c62-percent-00-b-ag.html [ Skip ] # Debug assertion
[ Debug ] css2.1/20110323/replaced-intrinsic-003.htm [ Skip ] # Debug assertion
[ Debug ] css2.1/20110323/replaced-min-max-001.htm [ Skip ] # Debug assertion
[ Debug ] editing/pasteboard/drag-drop-dead-frame.html [ Skip ] # Timeout
[ Debug ] editing/pasteboard/subframe-dragndrop-1.html [ Skip ] # Causes later tests to fail
@@ -3671,7 +3670,6 @@ svg/custom/svg-fonts-in-html.html [ Failure ]
svg/custom/svg-fonts-in-text-controls.html [ Failure ]
svg/custom/svg-fonts-segmented.xhtml [ Failure ]
svg/custom/use-font-face-crash.svg [ Failure ]
svg/hixie/intrinsic/003.html [ Failure ]
svg/text/text-align-06-b.svg [ Failure ]
svg/text/text-hkern-on-vertical-text.svg [ Failure ]
svg/text/text-overflow-ellipsis-svgfont.html [ Failure ]

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -544,14 +544,14 @@ LayoutUnit RenderReplaced::computeConstrainedLogicalWidth(ShouldComputePreferred
// 'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
// 'padding-right' + 'border-right-width' + 'margin-right' = width of
// containing block
// see https://www.w3.org/TR/CSS22/visudet.html#blockwidth
LayoutUnit logicalWidth = containingBlock()->availableLogicalWidth();

// This solves above equation for 'width' (== logicalWidth).
LayoutUnit marginStart = minimumValueForLength(style().marginStart(), logicalWidth);
LayoutUnit marginEnd = minimumValueForLength(style().marginEnd(), logicalWidth);

// FIXME: This expression does not align with the comment above, which is quoting https://www.w3.org/TR/CSS22/visudet.html#blockwidth.
logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + borderLeft() + borderRight())));
logicalWidth = std::max(0_lu, (logicalWidth - (marginStart + marginEnd + borderLeft() + borderRight() + paddingLeft() + paddingRight())));
return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred);
}

0 comments on commit 21c66fc

Please sign in to comment.