Changeset 62815 in webkit


Ignore:
Timestamp:
Jul 8, 2010 12:10:16 PM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

Refactor platform dependent editing behavior code out of Settings (part II)
https://bugs.webkit.org/show_bug.cgi?id=39854

Reviewed by Ojan Vafai.
Patch by Antonio Gomes <tonikitoo@webkit.org>

Mac port is currently the only port relying on a style to be present on the start
of a selection to consider the style as applied or not. All other ports
have to have the style present in all text node of the selection for such.

Patch makes situations that depend on this check like this to be controlled by
the EditingBehavior class.

Refactoring, so no new tests needed.

  • editing/EditingBehavior.h:

(WebCore::EditingBehavior::shouldToggleStyleBasedOnStartOfSelection):

  • editing/EditorCommand.cpp:

(WebCore::executeToggleStyle):

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r62809 r62815  
     12010-07-08  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Refactor platform dependent editing behavior code out of Settings (part II)
     6        https://bugs.webkit.org/show_bug.cgi?id=39854
     7
     8        Mac port is currently the only port relying on a style to be present on the start
     9        of a selection to consider the style as applied or not. All other ports
     10        have to have the style present in all text node of the selection for such.
     11
     12        Patch makes situations that depend on this check like this to be controlled by
     13        the EditingBehavior class.
     14
     15        Refactoring, so no new tests needed.
     16
     17        * editing/EditingBehavior.h:
     18        (WebCore::EditingBehavior::shouldToggleStyleBasedOnStartOfSelection):
     19        * editing/EditorCommand.cpp:
     20        (WebCore::executeToggleStyle):
     21
    1222010-07-08  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/WebCore/editing/EditingBehavior.h

    r60841 r62815  
    5050    bool shouldCenterAlignWhenSelectionIsRevealed() const { return m_type == EditingMacBehavior; }
    5151
     52    // On Mac, style is considered present when present at the beginning of selection. On other platforms,
     53    // style has to be present throughout the selection.
     54    bool shouldToggleStyleBasedOnStartOfSelection() const { return m_type == EditingMacBehavior; }
     55
    5256private:
    5357    EditingBehaviorType m_type;
  • trunk/WebCore/editing/EditorCommand.cpp

    r61794 r62815  
    166166    // mac: present at the beginning of selection
    167167    // other: present throughout the selection
    168     Settings* settings = frame->document()->settings();
     168
     169    // FIXME: Make stateStyle() to use this editing method too for the cases where it's used for queryCommandState.
    169170    bool styleIsPresent;
    170     if (settings && settings->editingBehaviorType() == EditingMacBehavior)
     171    if (!frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
    171172        styleIsPresent = frame->editor()->selectionStartHasStyle(style.get());
    172173    else
Note: See TracChangeset for help on using the changeset viewer.