Bug 46382 - queryCommandState returns true even when in the mixed state
Summary: queryCommandState returns true even when in the mixed state
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: EasyFix
Depends on: 41989
Blocks: 45910
  Show dependency treegraph
 
Reported: 2010-09-23 11:57 PDT by Ryosuke Niwa
Modified: 2010-09-27 14:11 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2010-09-23 11:57:50 PDT
queryCommandState shouldn't return true when the state is in the mixed tri state to be consistent with other browsers.

In particular,

bool Document::queryCommandState(const String& commandName)
{
    return command(this, commandName).state() != FalseTriState;
}

should be

bool Document::queryCommandState(const String& commandName)
{
    return command(this, commandName).state() == TrueTriState;
}

instead.
Comment 1 Darin Adler 2010-09-23 11:59:18 PDT
Code change seems great as long as we are sure the other browsers do indeed work that way.
Comment 2 Ryosuke Niwa 2010-09-23 12:11:56 PDT
Resolving bug naively is likely to produce a regression on Mac platforms if we don't fix https://bugs.webkit.org/show_bug.cgi?id=41989 first because we'll be inconsistently judging whether or not style is present in queryCommandState('bold') and execCommandState('bold', false, null).
Comment 3 Ryosuke Niwa 2010-09-23 12:22:39 PDT
(In reply to comment #1)
> Code change seems great as long as we are sure the other browsers do indeed work that way.

Yes, only WebKit returns true for queryCommandState('bold') on "hello <b>world</b>" for example.
Comment 4 Ryosuke Niwa 2010-09-27 14:11:53 PDT
http://trac.webkit.org/changeset/68423 fixed this bug as well.