Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Starred by 3 users
Status: Fixed
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment
document.queryCommandState isn't working well with <sub> and <sup> [contenteditable, blink]
Reported by cyril.au...@gmail.com, Jan 28 2016 Back to list
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.13 Safari/537.36

Steps to reproduce the problem:
1. demo http://jsfiddle.net/crl/eo4p501n/5/
2. see the queried states in console for each case
3. 

What is the expected behavior?
first case <sub>|<i>veniam</i>|</sub>  (| is the selection)
document.queryCommandState('subscript') is false, which is bad I think

second case is the opposite: <i>|<sub>veniam</sub>|</i>
document.queryCommandState('italic') returns true, subscript too, it's correct

What went wrong?
document.queryCommandState('subscript') is false, when the tag is outside selection

Did this work before? N/A 

Chrome version: 49.0.2623.13  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 20.0 r0
 
Labels: Needs-Feedback
Could you please help us providing a screen cast/screen shot of the expected result.
Currently it displays as attached on Win 7,Mac 10.11.3 and Ubuntu 14.04 using stable 48.0.2564.109 and canary 50.0.2647.0. as attached.
582225_Feb_12.png
3.6 KB View Download
sorry I wasn't clear, I have this output also, but Firefox gives:

true true
true true

and I think it makes sense, if you are like this <sub>|<i>veniam</i>|</sub> you should be able to know that you're subscripted

Components: Blink>Editing
Comment 4 by yosin@chromium.org, Feb 25 2016
Components: -Blink>Editing Blink>Editing>Command
Status: Available
Comment 5 by joone....@intel.com, May 17 2016
I'm fixing this bug: https://codereview.chromium.org/1986563002/
Project Member Comment 6 by bugdroid1@chromium.org, May 31 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dfe3d34820670521568ca7dfe681f701da94325b

commit dfe3d34820670521568ca7dfe681f701da94325b
Author: joone.hur <joone.hur@intel.com>
Date: Tue May 31 00:48:24 2016

Apply vertical-align style of <sub> and <sup> to child elements.

If the selected element has <sub> or <sup> ancestor element,
apply the corresponding style(vertical-align) to it so that
document.queryCommandState() works fine on the selected element.

<sub> and <sup> tags are represented with CSS vertical-align
property but they are not inherited. Therefore, we need to apply the
property to child elements because <sub> and <sup> tag can have
child elements such as <i> or <b> tag.

BUG= 582225 
TEST=editing/execCommand/queryCommandState-04.html
     editing/execCommand/queryCommandState-04-mac.html

Review-Url: https://codereview.chromium.org/1986563002
Cr-Commit-Position: refs/heads/master@{#396763}

[add] https://crrev.com/dfe3d34820670521568ca7dfe681f701da94325b/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-04.html
[modify] https://crrev.com/dfe3d34820670521568ca7dfe681f701da94325b/third_party/WebKit/Source/core/editing/EditingStyle.cpp
[modify] https://crrev.com/dfe3d34820670521568ca7dfe681f701da94325b/third_party/WebKit/Source/core/editing/EditingStyle.h
[modify] https://crrev.com/dfe3d34820670521568ca7dfe681f701da94325b/third_party/WebKit/Source/core/editing/Editor.cpp

Comment 7 by yosin@chromium.org, May 31 2016
Status: Fixed
Project Member Comment 8 by bugdroid1@chromium.org, May 31 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4cbb231ee8d27b7e411bc88b9c935999c0b54619

commit 4cbb231ee8d27b7e411bc88b9c935999c0b54619
Author: joone.hur <joone.hur@intel.com>
Date: Tue May 31 10:03:45 2016

Test the default editing behavior in queryCommandState-04.html

queryCommandState-04.html was added in https://codereview.chromium.org/1986563002/.
We also need to test the default editing behavior in the test.

BUG= 582225 

Review-Url: https://codereview.chromium.org/2020183002
Cr-Commit-Position: refs/heads/master@{#396809}

[modify] https://crrev.com/4cbb231ee8d27b7e411bc88b9c935999c0b54619/third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-04.html

Comment 9 by joone....@intel.com, Oct 19 2016
Owner: joone....@intel.com
Sign in to add a comment