Skip to content
Permalink
Browse files
Legend tags are not accepting the full range of display styling possi…
…bilities

Legend tags are not accepting the full range of display styling possibilities
https://bugs.webkit.org/show_bug.cgi?id=116031

Reviewed by Tim Nguyen.

This patch is to align with Blink / Chrome and Gecko / Firefox.

It changes 'legend' element to accept values beyond "display: block" and accept other equivalent of 'block' type values as well.

Additionally, it is to also align "User Agent" stylesheet of "legend" tag
by removing "display: block", which is not in the Web Specification.

This change progresses Webkit on multiple WPT test cases.

* Source/WebCore/style/StyleAdjuster.cpp:
(Adjuster::adjust): Change from "DisplayType::Block" to "equivalentBlockDisplay" for "legend" element
* Source/WebCore/css/html.css: Update "legend" tag to align with web-spec
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-display-expected.txt: Rebaselined
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt: Ditto
* LayoutTests/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt: Ditto
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt: Ditto
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-grid-flex-multicol-expected.txt: Ditto
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt: Added Platform Specific Expectations
* LayoutTests/platform/mac/imported/w3c/web-platform-tests/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/legend-sans-fieldset-display-expected.txt: Added Platform Specific Expectations

Canonical link: https://commits.webkit.org/256841@main
  • Loading branch information
Ahmad-S792 authored and Ahmad Saleem committed Nov 18, 2022
1 parent e0bf408 commit 3ae9f4142aed981acef64bc585d7525c7dfb74cb
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 48 deletions.

Large diffs are not rendered by default.

@@ -15,9 +15,9 @@
1
2

FAIL flex assert_equals: offsetHeight expected 18 but got 36
FAIL inline-flex assert_equals: offsetHeight expected 18 but got 36
FAIL grid assert_equals: offsetHeight expected 18 but got 36
FAIL inline-grid assert_equals: offsetHeight expected 18 but got 36
PASS flex
FAIL inline-flex assert_equals: display expected "inline-flex" but got "flex"
PASS grid
FAIL inline-grid assert_equals: display expected "inline-grid" but got "grid"
PASS multicol

@@ -12,15 +12,15 @@ inline-block
rubyrt
rubyrt

FAIL .table assert_equals: .table display expected "table" but got "block"
FAIL .table assert_equals: .table height expected "36px" but got "54px"
FAIL .caption assert_equals: .caption display expected "table-caption" but got "block"
FAIL .col assert_equals: .col display expected "table-column" but got "block"
FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block"
FAIL .tr assert_equals: .tr display expected "table-row" but got "block"
FAIL .td assert_equals: .td display expected "table-cell" but got "block"
FAIL .li assert_equals: .li display expected "list-item" but got "block"
FAIL .li assert_equals: .li width expected "800px" but got "8px"
FAIL .inline assert_equals: .inline display expected "inline" but got "block"
FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block"
FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
FAIL .rt assert_equals: .rt width expected "29.328125px" but got "9.78125px"
FAIL .rt assert_equals: .rt width expected "29px" but got "9px"

@@ -12,13 +12,13 @@ inline-block
rubyrt
rubyrt

FAIL .table assert_equals: .table display expected "table" but got "block"
FAIL .table assert_equals: .table height expected "36px" but got "54px"
FAIL .caption assert_equals: .caption display expected "table-caption" but got "block"
FAIL .col assert_equals: .col display expected "table-column" but got "block"
FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block"
FAIL .tr assert_equals: .tr display expected "table-row" but got "block"
FAIL .td assert_equals: .td display expected "table-cell" but got "block"
FAIL .li assert_equals: .li display expected "list-item" but got "block"
FAIL .li assert_equals: .li width expected "800px" but got "8px"
FAIL .inline assert_equals: .inline display expected "inline" but got "block"
FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block"
FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
@@ -15,9 +15,9 @@
1
2

FAIL flex assert_equals: offsetHeight expected 20 but got 40
FAIL inline-flex assert_equals: offsetHeight expected 20 but got 40
FAIL grid assert_equals: offsetHeight expected 20 but got 40
FAIL inline-grid assert_equals: offsetHeight expected 20 but got 40
PASS flex
FAIL inline-flex assert_equals: display expected "inline-flex" but got "flex"
PASS grid
FAIL inline-grid assert_equals: display expected "inline-grid" but got "grid"
PASS multicol

@@ -0,0 +1,26 @@
caption
td
td
caption
td td
li
li
foo inline
inline
foo inline-block
inline-block
rubyrt
rubyrt

FAIL .table assert_equals: .table height expected "40px" but got "60px"
FAIL .caption assert_equals: .caption display expected "table-caption" but got "block"
FAIL .col assert_equals: .col display expected "table-column" but got "block"
FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block"
FAIL .tr assert_equals: .tr display expected "table-row" but got "block"
FAIL .td assert_equals: .td display expected "table-cell" but got "block"
FAIL .li assert_equals: .li width expected "800px" but got "8.890625px"
FAIL .inline assert_equals: .inline display expected "inline" but got "block"
FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block"
FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
FAIL .rt assert_equals: .rt width expected "29.328125px" but got "9.78125px"

@@ -0,0 +1,26 @@
caption
td
td
caption
td td
li
li
foo inline
inline
foo inline-block
inline-block
rubyrt
rubyrt

FAIL .table assert_equals: .table height expected "36px" but got "54px"
FAIL .caption assert_equals: .caption display expected "table-caption" but got "block"
FAIL .col assert_equals: .col display expected "table-column" but got "block"
FAIL .tbody assert_equals: .tbody display expected "table-row-group" but got "block"
FAIL .tr assert_equals: .tr display expected "table-row" but got "block"
FAIL .td assert_equals: .td display expected "table-cell" but got "block"
FAIL .li assert_equals: .li width expected "800px" but got "8.890625px"
FAIL .inline assert_equals: .inline display expected "inline" but got "block"
FAIL .inline-block assert_equals: .inline-block display expected "inline-block" but got "block"
FAIL .ruby assert_equals: .ruby display expected "inline" but got "block"
FAIL .rt assert_equals: .rt width expected "29.328125px" but got "9.78125px"

@@ -368,7 +368,6 @@ label {
}

legend {
display: block;
padding-inline-start: 2px;
padding-inline-end: 2px;
border: none;
@@ -2,7 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* Copyright (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
* Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
* Copyright (C) 2005-2019 Apple Inc. All rights reserved.
* Copyright (C) 2005-2022 Apple Inc. All rights reserved.
* Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
* Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
@@ -301,7 +301,7 @@ void Adjuster::adjust(RenderStyle& style, const RenderStyle* userAgentAppearance
}

if (m_element->hasTagName(legendTag))
style.setEffectiveDisplay(DisplayType::Block);
style.setEffectiveDisplay(equivalentBlockDisplay(style));
}

// Top layer elements are always position: absolute; unless the position is set to fixed.

0 comments on commit 3ae9f41

Please sign in to comment.