From a0229aaa86dcf64d3c011fda2240289c3f091280 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Mon, 1 Jan 2024 00:27:45 +0000 Subject: [PATCH] Bug 1800077 - Make magic clip not magic. r=jwatt,zcorpan This implements the proposal in: https://github.com/whatwg/html/issues/9976 MANUAL PUSH: see bug 1871425 Differential Revision: https://phabricator.services.mozilla.com/D195419 UltraBlame original commit: 6a14f603289807a62753cc8ceaa35d9ba09cbf61 --- layout/forms/nsGfxButtonControlFrame.h | 11 - layout/forms/nsHTMLButtonControlFrame.cpp | 23 +- layout/forms/nsHTMLButtonControlFrame.h | 10 - .../grid-item-overflow-stretch-005-ref.html | 6 + layout/style/res/forms.css | 68 +++++- .../test_dynamic_change_causing_reflow.html | 5 + .../widgets/button-layout/computed-style.html | 187 +++++++++++++++++ .../input-type-button-clip-ref.html | 37 ++++ .../button-layout/input-type-button-clip.html | 196 ++++++++++++++++++ 9 files changed, 491 insertions(+), 52 deletions(-) create mode 100644 testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html create mode 100644 testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip.html diff --git a/layout/forms/nsGfxButtonControlFrame.h b/layout/forms/nsGfxButtonControlFrame.h index 8233631ebbe74..45a4432f3dd0b 100644 --- a/layout/forms/nsGfxButtonControlFrame.h +++ b/layout/forms/nsGfxButtonControlFrame.h @@ -177,17 +177,6 @@ nsString aLabel ) ; -virtual -bool -IsInput -( -) -override -{ -return -true -; -} private : RefPtr diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 2acbf2fe98703..becbeb80f6c75 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -40,14 +40,14 @@ h # include " -nsIFrameInlines +nsPresContext . h " # include " -nsPresContext +nsLayoutUtils . h " @@ -68,20 +68,6 @@ h # include " -nsCSSAnonBoxes -. -h -" -# -include -" -nsNameSpaceManager -. -h -" -# -include -" nsDisplayList . h @@ -301,11 +287,6 @@ ShouldClipPaintingToBorderBox ) { return -IsInput -( -) -| -| StyleDisplay ( ) diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index f136fdaebcdce..134b6507d9ed7 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -370,16 +370,6 @@ ClassID aID ) ; -virtual -bool -IsInput -( -) -{ -return -false -; -} bool ShouldClipPaintingToBorderBox ( diff --git a/layout/reftests/css-grid/grid-item-overflow-stretch-005-ref.html b/layout/reftests/css-grid/grid-item-overflow-stretch-005-ref.html index bef040975cc02..981f5f224ec9a 100644 --- a/layout/reftests/css-grid/grid-item-overflow-stretch-005-ref.html +++ b/layout/reftests/css-grid/grid-item-overflow-stretch-005-ref.html @@ -242,6 +242,8 @@ os . oh +. +ov { width : @@ -264,6 +266,10 @@ m . oh +. +m +. +ov { width : diff --git a/layout/style/res/forms.css b/layout/style/res/forms.css index 2d71011e24eb9..a19347c55927c 100644 --- a/layout/style/res/forms.css +++ b/layout/style/res/forms.css @@ -3109,6 +3109,16 @@ select : none ; +overflow +- +clip +- +box +: +padding +- +box +; } / * @@ -3185,16 +3195,6 @@ align : center ; -overflow -- -clip -- -box -: -padding -- -box -; padding - inline @@ -3226,6 +3226,54 @@ padding 4px ; } +/ +* +https +: +/ +/ +github +. +com +/ +whatwg +/ +html +/ +issues +/ +9976 +* +/ +input +: +not +( +[ +type += +image +i +] +) +{ +overflow +: +clip +! +important +; +overflow +- +clip +- +margin +: +0px +! +important +; +} button : : diff --git a/layout/style/test/test_dynamic_change_causing_reflow.html b/layout/style/test/test_dynamic_change_causing_reflow.html index a39f214ae6093..487643f4fbf4f 100644 --- a/layout/style/test/test_dynamic_change_causing_reflow.html +++ b/layout/style/test/test_dynamic_change_causing_reflow.html @@ -438,6 +438,11 @@ " inputElem " +type += +" +image +" > < textarea diff --git a/testing/web-platform/tests/html/rendering/widgets/button-layout/computed-style.html b/testing/web-platform/tests/html/rendering/widgets/button-layout/computed-style.html index bece8a22c51a1..58dfd51e020d8 100644 --- a/testing/web-platform/tests/html/rendering/widgets/button-layout/computed-style.html +++ b/testing/web-platform/tests/html/rendering/widgets/button-layout/computed-style.html @@ -89,6 +89,14 @@ " > < +input +type += +" +image +" +> +< button > < @@ -486,6 +494,185 @@ ) ; } +for +( +let +input +of +document +. +querySelectorAll +( +" +input +" +) +) +{ +test +( +( +) += +> +{ +if +( +input +. +type += += +" +image +" +) +{ +assert_equals +( +getComputedStyle +( +input +) +. +overflow +" +visible +" +" +Should +not +be +clip +by +default +" +) +; +return +; +} +assert_equals +( +getComputedStyle +( +input +) +. +overflow +" +clip +" +" +Should +be +clip +by +default +" +) +; +assert_equals +( +getComputedStyle +( +input +) +. +overflowClipMargin +" +0px +" +" +Should +use +0 +margin +" +) +; +input +. +style +. +overflow += +" +visible +" +; +input +. +style +. +overflowClipMargin += +" +10px +" +; +assert_equals +( +getComputedStyle +( +input +) +. +overflow +" +clip +" +" +Clip +be +! +important +" +) +; +assert_equals +( +getComputedStyle +( +input +) +. +overflowClipMargin +" +0px +" +" +Clip +margin +should +be +! +important +too +" +) +; +} +< +input +type += +{ +input +. +type +} +> +overflow +/ +overflow +- +clip +- +margin +) +; +} < / script diff --git a/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html b/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html new file mode 100644 index 0000000000000..0fd796cb0f61d --- /dev/null +++ b/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip-ref.html @@ -0,0 +1,37 @@ +< +! +doctype +html +> +< +style +> +button +{ +width +: +10ch +; +overflow +: +clip +; +text +- +overflow +: +ellipsis +; +} +< +/ +style +> +< +button +> +aaaaaaaaaaaaaaaaaaaaaa +< +/ +button +> diff --git a/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip.html b/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip.html new file mode 100644 index 0000000000000..68d605aaad223 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/widgets/button-layout/input-type-button-clip.html @@ -0,0 +1,196 @@ +< +! +doctype +html +> +< +meta +charset += +" +utf +- +8 +" +> +< +title +> +button +input +is +clipped +by +default +and +text +- +overflow +: +ellipsis +works +< +/ +title +> +< +link +rel += +" +help +" +href += +" +https +: +/ +/ +github +. +com +/ +whatwg +/ +html +/ +issues +/ +9976 +" +> +< +link +rel += +" +help +" +href += +" +https +: +/ +/ +bugzilla +. +mozilla +. +org +/ +show_bug +. +cgi +? +id += +1800077 +" +> +< +link +rel += +" +author +" +title += +" +Emilio +Cobos +lvarez +" +href += +" +mailto +: +emilio +crisal +. +io +" +> +< +link +rel += +" +author +" +title += +" +Mozilla +" +href += +" +https +: +/ +/ +mozilla +. +org +" +> +< +link +rel += +" +match +" +href += +" +input +- +type +- +button +- +clip +- +ref +. +html +" +> +< +style +> +input +{ +width +: +10ch +; +text +- +overflow +: +ellipsis +; +} +< +/ +style +> +< +input +type += +" +button +" +value += +" +aaaaaaaaaaaaaaaaaaaaaa +" +>