Summary: | execCommand('backColor') fails on collapsed selections | ||
---|---|---|---|
Product: | WebKit | Reporter: | Nick Santos <nicksantos> |
Component: | HTML Editing | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | ap, jparent, justin.garcia, mrowe |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | OS X 10.4 | ||
URL: | http://nick-santos.com/tests/background_color.html |
Description
Nick Santos
2007-11-19 07:24:58 PST
JSEditor.cpp shows that BackColor and ForeColor have different values for the enabledFn member of their CommandImp: WebCore/editing/JSEditor.cpp: { "BackColor", { execBackColor, enabledAnyRichlyEditableRangeSelection, stateNone, valueBackColor } }, WebCore/editing/JSEditor.cpp: { "ForeColor", { execForeColor, enabledAnySelection, stateNone, valueForeColor } }, BackColor requires a range selection which would cause the command to be disabled for collapsed selections. The fix here may be as simple as changing the enabledFn to enabledAnyRichlyEditableSelection. A quick test suggests that this gives the same behaviour as IE on the test case. So it sounds like all this bug needs is some understanding of what a change to enabledAnyRichlyEditableSelection would mean for the rest of the web. :) I guess we solve that with a test case. +1 on fixing this. We have horrible, horrible hacks in place to get this working in the Google editor. I'd love to get rid of them! (In reply to comment #1) > JSEditor.cpp shows that BackColor and ForeColor have different values for the > enabledFn member of their CommandImp: > > WebCore/editing/JSEditor.cpp: { "BackColor", { execBackColor, > enabledAnyRichlyEditableRangeSelection, stateNone, valueBackColor } }, > WebCore/editing/JSEditor.cpp: { "ForeColor", { execForeColor, > enabledAnySelection, stateNone, valueForeColor } }, Yikes that's completely wrong, BackColor should have enabledAnyRichlyEditableRangeSelection, and I don't know why ForeColor has enabledAnySelection, it should be disabled in a plain text region too. > BackColor should have enabledAnyRichlyEditableRangeSelection
that should read "enabledAnyRichlyEditableSelection".
|