Changeset 68423 in webkit


Ignore:
Timestamp:
Sep 27, 2010 2:10:54 PM (14 years ago)
Author:
rniwa@webkit.org
Message:

2010-09-27 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Antonio Gomes.

stateStyle (@EditorCommand.cpp) should ask EditingBehavior for platform specific behavior
https://bugs.webkit.org/show_bug.cgi?id=41989

queryCommandState returns true even when in the mixed state
https://bugs.webkit.org/show_bug.cgi?id=46382

Fixed stateStyle so that it calls selectionStartHasStyle when shouldToggleStyleBasedOnStartOfSelection
is true (Mac platforms) and calls selectionHasStyle otherwise (non-Mac platforms).

Also fixed queryCommandState so that it only returns true when the state is TrueTriState
as supposed to returning true whenever the state is not FalseTriState. New behavior matches that of
other browsers such as Firefox and Internet Explorer.

  • dom/Document.cpp: (WebCore::Document::queryCommandState):
  • editing/EditorCommand.cpp: (WebCore::executeToggleStyle): (WebCore::stateStyle):

2010-09-27 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Antonio Gomes.

stateStyle (@EditorCommand.cpp) should ask EditingBehavior for platform specific behavior
https://bugs.webkit.org/show_bug.cgi?id=41989

Added a test to ensure queryCommandState returns correct values on Mac and Windows.

  • editing/execCommand/query-command-state-expected.txt: Added.
  • editing/execCommand/script-tests/query-command-state.js: Added. (testQueryCommandState): (selectAll): (selectSecondWord): (selectFirstTwoWords): (runTests):
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68418 r68423  
     12010-09-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        stateStyle (@EditorCommand.cpp) should ask EditingBehavior for platform specific behavior
     6        https://bugs.webkit.org/show_bug.cgi?id=41989
     7
     8        Added a test to ensure queryCommandState returns correct values on Mac and Windows.
     9
     10        * editing/execCommand/query-command-state-expected.txt: Added.
     11        * editing/execCommand/script-tests/query-command-state.js: Added.
     12        (testQueryCommandState):
     13        (selectAll):
     14        (selectSecondWord):
     15        (selectFirstTwoWords):
     16        (runTests):
     17
    1182010-09-27  Martin Robinson  <mrobinson@igalia.com>
    219
  • trunk/WebCore/ChangeLog

    r68420 r68423  
     12010-09-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Antonio Gomes.
     4
     5        stateStyle (@EditorCommand.cpp) should ask EditingBehavior for platform specific behavior
     6        https://bugs.webkit.org/show_bug.cgi?id=41989
     7
     8        queryCommandState returns true even when in the mixed state
     9        https://bugs.webkit.org/show_bug.cgi?id=46382
     10
     11        Fixed stateStyle so that it calls selectionStartHasStyle when shouldToggleStyleBasedOnStartOfSelection
     12        is true (Mac platforms) and calls selectionHasStyle otherwise (non-Mac platforms).
     13
     14        Also fixed queryCommandState so that it only returns true when the state is TrueTriState
     15        as supposed to returning true whenever the state is not FalseTriState. New behavior matches that of
     16        other browsers such as Firefox and Internet Explorer.
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::queryCommandState):
     20        * editing/EditorCommand.cpp:
     21        (WebCore::executeToggleStyle):
     22        (WebCore::stateStyle):
     23
    1242010-09-27  David Hyatt  <hyatt@apple.com>
    225
  • trunk/WebCore/dom/Document.cpp

    r68369 r68423  
    39143914bool Document::queryCommandState(const String& commandName)
    39153915{
    3916     return command(this, commandName).state() != FalseTriState;
     3916    return command(this, commandName).state() == TrueTriState;
    39173917}
    39183918
  • trunk/WebCore/editing/EditorCommand.cpp

    r68149 r68423  
    161161
    162162    // Style is considered present when
    163     // mac: present at the beginning of selection
     163    // Mac: present at the beginning of selection
    164164    // other: present throughout the selection
    165165
    166     // FIXME: Make stateStyle() to use this editing method too for the cases where it's used for queryCommandState.
    167166    bool styleIsPresent;
    168167    if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
     
    232231    RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create();
    233232    style->setProperty(propertyID, desiredValue);
     233
     234    if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
     235        return frame->editor()->selectionStartHasStyle(style.get()) ? TrueTriState : FalseTriState;
    234236    return frame->editor()->selectionHasStyle(style.get());
    235237}
Note: See TracChangeset for help on using the changeset viewer.