WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
47054
execCommand('FormatBlock') does not preserve inline styles of the replaced block elements
https://bugs.webkit.org/show_bug.cgi?id=47054
Summary
execCommand('FormatBlock') does not preserve inline styles of the replaced bl...
Ryosuke Niwa
Reported
2010-10-02 16:33:16 PDT
Reproduction steps: 1. Go to
http://www.mozilla.org/editor/midasdemo/
2. Paste <div style="color: red;">hello</div> in HTML source mode 3. Chante the format to "h1" in WYSIWYG mode Expected result: <h1 style="color:red;">hello</h1> or <h1><span style="color:red;">hello</span></h1> Actual result: <h1>hello</h1>
Attachments
Add attachment
proposed patch, testcase, etc.
Aryeh Gregor
Comment 1
2011-08-18 11:28:46 PDT
This is handled in the spec by "record the values"/"restore the values":
http://aryeh.name/spec/editing/editing.html#the-formatblock-command
http://aryeh.name/spec/editing/editing.html#record-the-values
Basically, for each node in a node list, "record the values" records any inline style that's specified on that node or that it's inheriting from an ancestor. Then "restore the values" checks each node for whether it has the same value, and if not, sets it. I call them every time I move nodes around in a way that might change what styles they inherit.
Ahmad Saleem
Comment 2
2022-12-17 12:51:19 PST
Fixed in following commit -
https://src.chromium.org/viewvc/blink?view=revision&revision=163137
Ahmad Saleem
Comment 3
2023-01-12 13:27:19 PST
I tried -
https://github.com/WebKit/WebKit/pull/8536
to merge Blink patch but it is not suitable and we need to account for following comment from rniwa: ''' I don't think the code change as currently proposed makes much sense. For one, there is mismatch between outerBlock vs blockNode. For another, we shouldn't be just copying style attribute. We need to get the computed style and apply that style to the block if we're failing to preserve the style in this command. e.g. using EditingStyle::prepareToApplyAt and ApplyStyleCommand. '''
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug