Bug 11022 - queryCommandState('underline') returns false if the selected text is also bold and italic
: queryCommandState('underline') returns false if the selected text is also bol...
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: HTML Editing
: 420+
: Macintosh Mac OS X 10.4
: P2 Normal
Assigned To: Ryosuke Niwa
: GoogleBug, InRadar, ReviewedForRadar
Depends on:
Blocks: 9638
  Show dependency treegraph
 
Reported: 2006-09-25 08:59 PDT by Chris Petersen
Modified: 2009-08-19 19:17 PDT (History)
5 users (show)

See Also:


Attachments
demo (574 bytes, text/html)
2009-08-18 17:31 PDT, Ryosuke Niwa
no flags Details
fixes the bug, two lines of change in EditorsCommand.cpp and adds a test (8.45 KB, patch)
2009-08-18 17:42 PDT, Ryosuke Niwa
darin: review+
eric: commit‑queue-
Details | Formatted Diff | Diff
test case is fixed (one line change: 19@text-decoration-state.js) (8.48 KB, patch)
2009-08-19 17:31 PDT, Ryosuke Niwa
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Petersen 2006-09-25 08:59:35 PDT
* SUMMARY
Inserting a caret into styled text (bold, italic, underline) doesn't highlight the associated toolbar buttons (bold, italic, underline)

* STEPS TO REPRODUCE
1. With TOT Webkit r-16541 , login to your gmail account
2. Create a new message  (Rich Formatting)
3. Place caret in message body and and click "B", "I" and "U" . Notice the button are highlighted when pressed.
4. Type out "This is some text". Verify this text has all three styles applied.
5. With this caret at the end of this text, press the return to create a new line
6. Place the caret at the end of  "This is some text" and press the return key. This will place the caret on a new line.
7. Click "B", "I", and "U" to remove this style then start to type some text
8. Now, click in the line above which contains styling on the text. Notice , the B, U, I buttons don't become highlighted.

* RESULTS
Style buttons on the toolbar should become highlighted if caret is inserted into style text but isn't.
Comment 1 Chris Petersen 2006-09-25 09:01:25 PDT
This issue is covered in <rdar://problem/4748375>
Comment 2 Justin Garcia 2006-10-31 15:54:52 PST
*** Bug 11023 has been marked as a duplicate of this bug. ***
Comment 3 Justin Garcia 2008-06-19 18:41:24 PDT
Looks like it's fixed for bold and italic.  Still broken for underline, though.
Comment 4 Justin Garcia 2008-06-19 18:44:34 PDT
> Looks like it's fixed for bold and italic.  Still broken for underline, though. 

Underline seems to only have problems when the text has is also Bold and Italic.
Comment 5 Justin Garcia 2009-02-17 16:16:52 PST
*** Bug 20089 has been marked as a duplicate of this bug. ***
Comment 6 Ryosuke Niwa 2009-08-18 15:25:42 PDT
This bug is caused by us checking text-decoration property.  We should be checking -webkit-text-decorations-in-effect.  It's literally two-line change for underline and line-through.  I'll submit a patch after writing some tests.
Comment 7 Ryosuke Niwa 2009-08-18 17:31:17 PDT
Created attachment 35089 [details]
demo
Comment 8 Ryosuke Niwa 2009-08-18 17:42:49 PDT
Created attachment 35091 [details]
fixes the bug, two lines of change in EditorsCommand.cpp and adds a test
Comment 9 Darin Adler 2009-08-18 17:52:43 PDT
Comment on attachment 35091 [details]
fixes the bug, two lines of change in EditorsCommand.cpp and adds a test

r=me
Comment 10 Ryosuke Niwa 2009-08-18 17:55:00 PDT
Comment on attachment 35091 [details]
fixes the bug, two lines of change in EditorsCommand.cpp and adds a test

(In reply to comment #9)
> (From update of attachment 35091 [details])
> r=me

Thanks, Darin!
Comment 11 Eric Seidel 2009-08-18 18:08:12 PDT
Comment on attachment 35091 [details]
fixes the bug, two lines of change in EditorsCommand.cpp and adds a test

Rejecting patch 35091 from commit-queue.  This patch will require manual commit.

['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--quiet', '--exit-after-n-failures=1'] failed with exit code 1
Comment 12 Eric Seidel 2009-08-18 19:00:38 PDT
Testing 11102 test cases.
editing/style/text-decoration-state.html -> failed

Exiting early after 1 failures.  4342 tests run.
73.44s total testing time

4341 test cases (99%) succeeded
1 test case (<1%) had incorrect layout
1 test case (<1%) had stderr output
Comment 13 Ryosuke Niwa 2009-08-19 17:31:59 PDT
Created attachment 35165 [details]
test case is fixed (one line change: 19@text-decoration-state.js)

The original patch had a bug in the test case.
Comment 14 Darin Adler 2009-08-19 17:40:46 PDT
Comment on attachment 35165 [details]
test case is fixed (one line change: 19@text-decoration-state.js)

> +        * editing/EditorCommand.cpp:
> +        (WebCore::stateStrikethrough): ditto
> +        (WebCore::stateUnderline): ditto

This is a little mysterious. Usually "ditto" means "repeat the comment above". In this case the only comment above is the summary one describing the entire change. I'd suggest writing something other than "ditto" here in patches in the future.

I would have written:

        (WebCore::stateStrikethrough): Use -webkit-test-decorations-in-effect instead of text-decoration.
        (WebCore::stateUnderline): Ditto.
Comment 15 Ryosuke Niwa 2009-08-19 19:17:01 PDT
(In reply to comment #14)
> (From update of attachment 35165 [details])
> > +        * editing/EditorCommand.cpp:
> > +        (WebCore::stateStrikethrough): ditto
> > +        (WebCore::stateUnderline): ditto
> 
> This is a little mysterious. Usually "ditto" means "repeat the comment above".
> In this case the only comment above is the summary one describing the entire
> change. I'd suggest writing something other than "ditto" here in patches in the
> future.
> 
> I would have written:
> 
>         (WebCore::stateStrikethrough): Use -webkit-test-decorations-in-effect
> instead of text-decoration.
>         (WebCore::stateUnderline): Ditto.

Fixed and committed as http://trac.webkit.org/changeset/47541.