Open Bug 1749163 Opened 2 years ago Updated 1 year ago

contenteditable has a different wrapping behavior in Gecko and WebKit/Blink

Categories

(Core :: Layout: Block and Inline, defect)

defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox95 --- affected
firefox96 --- affected
firefox97 --- affected

People

(Reporter: karlcow, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Steps to reproduce

  • Enter the following in the URL bar in each latest version of browser.
data:text/html,<!doctype html><html><div style="border: 1px solid black; width: 5ch;" contenteditable>AAAAAAA</div>
  • Firefox: The text breaks out of the box
  • WebKit/Blink: The text wraps and the box automatically extends its height.

This was inherited from WebKit code 17 years ago.

This is done here.

https://github.com/WebKit/WebKit/blob/14129e759715bb8535b8b7a7512860f79fba2993/Source/WebCore/html/HTMLElement.cpp#L201-L208

    case ContentEditableType::True:
        addPropertyToPresentationalHintStyle(style, CSSPropertyWordWrap, CSSValueBreakWord);
        addPropertyToPresentationalHintStyle(style, CSSPropertyWebkitNbspMode, CSSValueSpace);
        addPropertyToPresentationalHintStyle(style, CSSPropertyLineBreak, CSSValueAfterWhiteSpace);

#if PLATFORM(IOS_FAMILY)
addPropertyToPresentationalHintStyle(style, CSSPropertyWebkitTextSizeAdjust, CSSValueNone);
#endif
break;

It seems to have been there for a long time. moved from Frame.cpp into HTMLElementImpl.cpp
https://github.com/WebKit/WebKit/commit/c68912f97deea7782d6c1b6aab872e5d93365de2

It was carried away from on Oct 15, 2004
https://github.com/WebKit/WebKit/commit/9d7af8297974d9263c22f90d43074ebbbe439381#diff-c8205393c9f57e84bfe70e703391bcc951d7d0b9177394c638d35905eed918ccR5493-R5503

In Gecko the [contenteditable] CSS is available in a dedicated CSS
https://searchfox.org/mozilla-central/source/layout/style/contenteditable.css
https://bugzilla.mozilla.org/show_bug.cgi?id=237964 (June 2007)

There's a dicussion in 2014 on the CSS mailing list
https://lists.w3.org/Archives/Public/www-style/2014Oct/thread.html#msg408

but the discussion kind of died without defining what should be the specific behavior.
At the time of the discussion, IE/Firefox were in one camp and WebKit/Blink in the other.

I don't remember Webcompat report from the top of my head about it.

The spec itself is not clear about the behavior too.

This is discussed here on WebKit
https://bugs.webkit.org/show_bug.cgi?id=138068

We have had a couple sites submitted to us that aren't working for our users due to an interop issue between IE/FF & Chrome/Safari.

But no followup after that.

Google seems to have made attempts at fixing Blink.
https://bugs.chromium.org/p/chromium/issues/detail?id=427135

Just to clarify, Maybe there is nothing to fix on Gecko, Just opened the bug to have a placeholder for eventual discussion on the interop side of things in between WebKit, Blink and Gecko.

More recent discussion about it.
https://github.com/w3c/editing/issues/145

Severity: -- → S3

I think that this is a layout issue (enhancement?).

Component: DOM: Editor → Layout: Block and Inline
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: