Bug 135335 - `resize` treats `width` and `height` as minimum dimensions
Summary: `resize` treats `width` and `height` as minimum dimensions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Nguyen (:ntim)
URL: http://dabblet.com/gist/bd3b8a4020da6...
Keywords: BrowserCompat, InRadar
: 72948 (view as bug list)
Depends on: 239459
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-27 21:58 PDT by Lea Verou
Modified: 2022-08-18 09:46 PDT (History)
17 users (show)

See Also:


Attachments
Patch (23.96 KB, patch)
2022-04-07 04:35 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (24.87 KB, patch)
2022-04-07 04:39 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (31.48 KB, patch)
2022-04-07 12:35 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff
Patch (31.73 KB, patch)
2022-04-07 12:38 PDT, Tim Nguyen (:ntim)
simon.fraser: review+
simon.fraser: commit-queue-
Details | Formatted Diff | Diff
[fast-cq] Patch (31.71 KB, patch)
2022-04-07 13:18 PDT, Tim Nguyen (:ntim)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lea Verou 2014-07-27 21:58:39 PDT
(Surprised this isn’t already reported but did a lot of searching and couldn’t find anything so filing just in case. Sorry if dupe!)

Yes, I know that this is technically allowed in css3-ui ("The user agent may restrict the resizing range to something suitable, such as between the original formatted size of the element, and large enough to encompass all the element's contents."), but this behavior is seriously crippling the usefulness of the resize property. 

A quick search reveals quite a few authors scratching their heads about this issue, for example (top 5):

http://stackoverflow.com/questions/12985133/resize-a-div-to-smaller-than-its-declared-size
http://stackoverflow.com/questions/18178301/how-can-i-use-css-resize-to-resize-an-element-to-a-height-width-less-than-init
http://stackoverflow.com/questions/15108716/how-to-resize-div-to-less-than-its-initial-width-height
http://stackoverflow.com/questions/7197136/using-css-to-resize-a-div-to-a-dimension-smaller-than-its-current-width-and-he
http://stackoverflow.com/questions/15766784/css-resize-min-width

Firefox only restricts it to the min-width/min-height, or if those are not set, to the dimensions of the resizer (roughly 15px by 15px).

Chrome does the same as WebKit, but it’s a confirmed bug they are about to fix: https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=94583
Comment 1 Sam 2019-09-08 14:39:12 PDT
This is still unfixed in Safari
Comment 2 Radar WebKit Bug Importer 2019-09-09 11:16:28 PDT
<rdar://problem/55189847>
Comment 3 Simon Fraser (smfr) 2021-08-26 17:41:54 PDT
Relevant chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=94583
Comment 4 Simon Fraser (smfr) 2021-08-26 20:30:07 PDT
And the final commit: https://chromium.googlesource.com/chromium/src.git/+/7e189bf28fd3f622943d7161e2fdc1f2568a6ea5
Comment 5 Michal 2022-03-04 08:01:33 PST
Hello, is this issue planned to fix it? I would really appreciate it. Thank you for your answer. :)
Comment 6 Tim Nguyen (:ntim) 2022-04-06 21:41:26 PDT
I'll take this.
Comment 7 Tim Nguyen (:ntim) 2022-04-07 04:35:23 PDT
Created attachment 456907 [details]
Patch
Comment 8 Tim Nguyen (:ntim) 2022-04-07 04:39:21 PDT
Created attachment 456909 [details]
Patch
Comment 9 Tim Nguyen (:ntim) 2022-04-07 06:28:08 PDT
Comment on attachment 456909 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456909&action=review

> LayoutTests/fast/css/resize-orthogonal-containing-block.html:45
> +}, "Test for resizing the TEXTAREA below its initial size and with orthogonal containing block.");

It should say "the box"
Comment 10 Simon Fraser (smfr) 2022-04-07 10:02:31 PDT
Comment on attachment 456909 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456909&action=review

> Source/WebCore/rendering/RenderLayer.cpp:2760
> +    // Match Firefox and Chrome, you cannot resize below this value.
> +    int strictMinimumSize = 15;

Does this work if there are custom scrollbars with a larger width/height? Seems like this needs to be some minimum size plus non-overlay scrollbar width.
Comment 11 Tim Nguyen (:ntim) 2022-04-07 12:35:26 PDT
Created attachment 456953 [details]
Patch
Comment 12 Tim Nguyen (:ntim) 2022-04-07 12:38:05 PDT
Created attachment 456954 [details]
Patch
Comment 13 Simon Fraser (smfr) 2022-04-07 13:08:59 PDT
Comment on attachment 456954 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=456954&action=review

> Source/WebCore/rendering/RenderLayer.cpp:2750
> +    auto resizerRect = ensureLayerScrollableArea()->overflowControlsRects().resizer;

If this element isn't scrollable we shouldn't trigger creation of a RenderLayerScrollableArea here. Also overflowControlsRects() exists on RenderLayer so we should just call that.
Comment 14 Tim Nguyen (:ntim) 2022-04-07 13:18:28 PDT
Created attachment 456962 [details]
[fast-cq] Patch
Comment 15 Tim Nguyen (:ntim) 2022-04-07 13:26:00 PDT
Comment on attachment 456962 [details]
[fast-cq] Patch

I'll land this myself
Comment 16 Tim Nguyen (:ntim) 2022-04-07 13:26:14 PDT
Committed r292559 (249397@trunk): <https://commits.webkit.org/249397@trunk>
Comment 17 Simon Fraser (smfr) 2022-08-18 09:46:42 PDT
*** Bug 72948 has been marked as a duplicate of this bug. ***