Changeset 82121 in webkit


Ignore:
Timestamp:
Mar 28, 2011 8:56:11 AM (13 years ago)
Author:
xji@chromium.org
Message:

2011-03-28 Xiaomei Ji <xji@chromium.org>

Reviewed by Ryosuke Niwa.

move directionOfEnclosingBlock() to be global so that it could be reused.
https://bugs.webkit.org/show_bug.cgi?id=57233.

Provide global function directionOfEnclosingBlock(Node*) so that it could be
reused in SelectionController and other functionalities that need enclosing
block's direcionality, such as moving caret by word in visual order.


No new functionality, so no new tests.

  • editing/SelectionController.cpp: (WebCore::SelectionController::directionOfEnclosingBlock):
  • editing/htmlediting.cpp: (WebCore::directionOfEnclosingBlock):
  • editing/htmlediting.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r82117 r82121  
     12011-03-28  Xiaomei Ji  <xji@chromium.org>
     2
     3        Reviewed by Ryosuke Niwa.
     4
     5        move directionOfEnclosingBlock() to be global so that it could be reused.
     6        https://bugs.webkit.org/show_bug.cgi?id=57233.
     7
     8        Provide global function directionOfEnclosingBlock(Node*) so that it could be
     9        reused in SelectionController and other functionalities that need enclosing
     10        block's direcionality, such as moving caret by word in visual order.
     11     
     12        No new functionality, so no new tests.
     13
     14        * editing/SelectionController.cpp:
     15        (WebCore::SelectionController::directionOfEnclosingBlock):
     16        * editing/htmlediting.cpp:
     17        (WebCore::directionOfEnclosingBlock):
     18        * editing/htmlediting.h:
     19
    1202011-03-28  Jarkko Sakkinen  <jarkko.j.sakkinen@gmail.com>
    221
  • trunk/Source/WebCore/editing/SelectionController.cpp

    r81965 r82121  
    335335}
    336336
     337TextDirection SelectionController::directionOfEnclosingBlock()
     338{
     339    return WebCore::directionOfEnclosingBlock(m_selection.extent());
     340}
     341
    337342void SelectionController::willBeModified(EAlteration alter, SelectionDirection direction)
    338343{
     
    382387        m_selection.setExtent(start);
    383388    }
    384 }
    385 
    386 TextDirection SelectionController::directionOfEnclosingBlock()
    387 {
    388     Node* enclosingBlockNode = enclosingBlock(m_selection.extent().containerNode());
    389     if (!enclosingBlockNode)
    390         return LTR;
    391     RenderObject* renderer = enclosingBlockNode->renderer();
    392     if (renderer)
    393         return renderer->style()->direction();
    394     return LTR;
    395389}
    396390
  • trunk/Source/WebCore/editing/htmlediting.cpp

    r81965 r82121  
    333333}
    334334
     335TextDirection directionOfEnclosingBlock(const Position& position)
     336{
     337    Node* enclosingBlockNode = enclosingBlock(position.containerNode());
     338    if (!enclosingBlockNode)
     339        return LTR;
     340    RenderObject* renderer = enclosingBlockNode->renderer();
     341    return renderer ? renderer->style()->direction() : LTR;
     342}
     343
    335344// This method is used to create positions in the DOM. It returns the maximum valid offset
    336345// in a node.  It returns 1 for some elements even though they do not have children, which
  • trunk/Source/WebCore/editing/htmlediting.h

    r81295 r82121  
    3131#include "HTMLNames.h"
    3232#include "Position.h"
     33#include "TextDirection.h"
    3334#include <wtf/Forward.h>
    3435#include <wtf/unicode/CharacterNames.h>
     
    9798bool isNodeInTextFormControl(Node* node);
    9899   
     100TextDirection directionOfEnclosingBlock(const Position&);
     101
    99102// -------------------------------------------------------------------------
    100103// Position
Note: See TracChangeset for help on using the changeset viewer.