Bug 211994

Summary: MobileSafari falsely claims CSS resize property support
Product: WebKit Reporter: Bramus <bramus>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: gsnedders, koivisto, mjs, ntim, simon.fraser, tomac, webkit-bug-importer, wenson_hsieh, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: iOS 13   
See Also: https://bugs.webkit.org/show_bug.cgi?id=210473

Description Bramus 2020-05-17 03:08:21 PDT
Recently I wrote an article on using CSS `resize: both;`: https://www.bram.us/2020/05/15/css-only-resizable-elements/

In browsers that don't support this property I wanted to show a warning on screen to notify users thereof. For this I use an @supports rule:

```css
.warning {
    display: block;
}

/* Hide warning in case browser supports resize: both; */
@supports (resize: both) {
    .warning {
        display: none;
    }
}
```

I've come to notice that MobileSafari – which does not support `resize: both;` – hides the warning and thus falsely claims to support said CSS resize property.

Demo: https://codepen.io/bramus/pen/RwWeqOP
Comment 1 Radar WebKit Bug Importer 2020-05-18 03:48:02 PDT
<rdar://problem/63335059>
Comment 2 Tim Nguyen (:ntim) 2022-05-13 14:55:29 PDT
The CSS property is technically detected/understood by the engine on mobile. It's just that we decide to hide the resizer on mobile.
Comment 3 Sam Sneddon [:gsnedders] 2022-05-13 15:24:06 PDT
(In reply to Tim Nguyen (:ntim) from comment #2)
> The CSS property is technically detected/understood by the engine on mobile.
> It's just that we decide to hide the resizer on mobile.

Who owns the resizer? It seems like the resizer and the property should both be linked to a single setting if WebKit owns it.
Comment 4 Tim Nguyen (:ntim) 2022-05-13 16:31:08 PDT
The resizer is implemented in RenderLayer.cpp (see canResize() and friends).

But yeah I agree, the best way to make supports work properly is to guard the CSS property behind a flag.
Comment 5 Sam Sneddon [:gsnedders] 2022-05-13 18:24:48 PDT
(In reply to Tim Nguyen (:ntim) from comment #4)
> The resizer is implemented in RenderLayer.cpp (see canResize() and friends).
> 
> But yeah I agree, the best way to make supports work properly is to guard
> the CSS property behind a flag.

I… actually knew that. I guess my question was more "what hides it on mobile", or causes it to not be painted? Is it simply that they don't have a layer or something?
Comment 6 Tim Nguyen (:ntim) 2022-05-14 00:00:37 PDT
(In reply to Sam Sneddon [:gsnedders] from comment #5)
> (In reply to Tim Nguyen (:ntim) from comment #4)
> > The resizer is implemented in RenderLayer.cpp (see canResize() and friends).
> > 
> > But yeah I agree, the best way to make supports work properly is to guard
> > the CSS property behind a flag.
> 
> I… actually knew that. I guess my question was more "what hides it on
> mobile", or causes it to not be painted? Is it simply that they don't have a
> layer or something?

No idea, maybe Simon can answer?
Comment 7 Simon Fraser (smfr) 2022-05-14 10:47:16 PDT
I think the primary issue here is that we'd need to implement some touch event handling on iOS to actually support user interaction with the resize. That was never done, so early in iOS development it was decided to just not paint the resize.
Comment 8 Sam Sneddon [:gsnedders] 2022-05-17 02:31:28 PDT
Ah, it's BuilderConverter::convertResize which contains the check, and the TextAreasAreResizable setting. We probably just want to gate the resize property on that setting.
Comment 9 Tim Nguyen (:ntim) 2022-05-18 05:23:30 PDT
(In reply to Sam Sneddon [:gsnedders] from comment #8)
> Ah, it's BuilderConverter::convertResize which contains the check, and the
> TextAreasAreResizable setting. We probably just want to gate the resize
> property on that setting.

The check in that function is only for `resize: auto` (a non-standard value fwiw), this bug is about `resize: both`.