Commit 616004a4 authored by hamaji@chromium.org's avatar hamaji@chromium.org
Browse files

2010-04-01 MORITA Hajime <morrita@google.com>

        Reviewed by Shinichiro Hamaji.

        https://bugs.webkit.org/show_bug.cgi?id=36948
        Refactoring: Position::primaryDirection() should be extracted.

        No new tests. No functinal change.

        * dom/Position.cpp:
        (WebCore::Position::getInlineBoxAndOffset):
        (WebCore::Position::primaryDirection): Added
        * dom/Position.h:
        * editing/VisiblePosition.cpp:
        (WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
        (WebCore::VisiblePosition::rightVisuallyDistinctCandidate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@56915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 99184576
2010-04-01 MORITA Hajime <morrita@google.com>
Reviewed by Shinichiro Hamaji.
https://bugs.webkit.org/show_bug.cgi?id=36948
Refactoring: Position::primaryDirection() should be extracted.
No new tests. No functinal change.
* dom/Position.cpp:
(WebCore::Position::getInlineBoxAndOffset):
(WebCore::Position::primaryDirection): Added
* dom/Position.h:
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
(WebCore::VisiblePosition::rightVisuallyDistinctCandidate):
2010-04-01 Alexander Pavlov <apavlov@chromium.org>
 
Reviewed by Pavel Feldman.
......@@ -946,14 +946,7 @@ Position Position::trailingWhitespacePosition(EAffinity, bool considerNonCollaps
void Position::getInlineBoxAndOffset(EAffinity affinity, InlineBox*& inlineBox, int& caretOffset) const
{
TextDirection primaryDirection = LTR;
for (RenderObject* r = node()->renderer(); r; r = r->parent()) {
if (r->isBlockFlow()) {
primaryDirection = r->style()->direction();
break;
}
}
getInlineBoxAndOffset(affinity, primaryDirection, inlineBox, caretOffset);
getInlineBoxAndOffset(affinity, primaryDirection(), inlineBox, caretOffset);
}
static bool isNonTextLeafChild(RenderObject* object)
......@@ -1147,6 +1140,20 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
}
}
TextDirection Position::primaryDirection() const
{
TextDirection primaryDirection = LTR;
for (const RenderObject* r = node()->renderer(); r; r = r->parent()) {
if (r->isBlockFlow()) {
primaryDirection = r->style()->direction();
break;
}
}
return primaryDirection;
}
void Position::debugPosition(const char* msg) const
{
if (isNull())
......
......@@ -158,6 +158,8 @@ public:
void getInlineBoxAndOffset(EAffinity, InlineBox*&, int& caretOffset) const;
void getInlineBoxAndOffset(EAffinity, TextDirection primaryDirection, InlineBox*&, int& caretOffset) const;
TextDirection primaryDirection() const;
static bool hasRenderedNonAnonymousDescendantsWithHeight(RenderObject*);
static bool nodeIsUserSelectNone(Node*);
......
......@@ -110,13 +110,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
return Position();
Position downstreamStart = p.downstream();
TextDirection primaryDirection = LTR;
for (RenderObject* r = p.node()->renderer(); r; r = r->parent()) {
if (r->isBlockFlow()) {
primaryDirection = r->style()->direction();
break;
}
}
TextDirection primaryDirection = p.primaryDirection();
while (true) {
InlineBox* box;
......@@ -252,13 +246,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
return Position();
Position downstreamStart = p.downstream();
TextDirection primaryDirection = LTR;
for (RenderObject* r = p.node()->renderer(); r; r = r->parent()) {
if (r->isBlockFlow()) {
primaryDirection = r->style()->direction();
break;
}
}
TextDirection primaryDirection = p.primaryDirection();
while (true) {
InlineBox* box;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment