OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 case AlwaysDownstream: | 510 case AlwaysDownstream: |
511 affinity = DOWNSTREAM; | 511 affinity = DOWNSTREAM; |
512 break; | 512 break; |
513 case AlwaysUpstream: | 513 case AlwaysUpstream: |
514 affinity = VP_UPSTREAM_IF_POSSIBLE; | 514 affinity = VP_UPSTREAM_IF_POSSIBLE; |
515 break; | 515 break; |
516 case UpstreamIfPositionIsNotAtStart: | 516 case UpstreamIfPositionIsNotAtStart: |
517 affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : DO
WNSTREAM; | 517 affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : DO
WNSTREAM; |
518 break; | 518 break; |
519 } | 519 } |
520 int textStartOffset = box->renderer().isText() ? toLayoutText(box->renderer(
)).textStartOffset() : 0; | 520 int textStartOffset = box->layoutObject().isText() ? toLayoutText(box->layou
tObject()).textStartOffset() : 0; |
521 return box->renderer().createPositionWithAffinity(offset + textStartOffset,
affinity); | 521 return box->layoutObject().createPositionWithAffinity(offset + textStartOffs
et, affinity); |
522 } | 522 } |
523 | 523 |
524 static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
ForBiDi(const InlineTextBox* box, int offset, ShouldAffinityBeDownstream shouldA
ffinityBeDownstream) | 524 static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
ForBiDi(const InlineTextBox* box, int offset, ShouldAffinityBeDownstream shouldA
ffinityBeDownstream) |
525 { | 525 { |
526 ASSERT(box); | 526 ASSERT(box); |
527 ASSERT(offset >= 0); | 527 ASSERT(offset >= 0); |
528 | 528 |
529 if (offset && static_cast<unsigned>(offset) < box->len()) | 529 if (offset && static_cast<unsigned>(offset) < box->len()) |
530 return createPositionWithAffinityForBox(box, box->start() + offset, shou
ldAffinityBeDownstream); | 530 return createPositionWithAffinityForBox(box, box->start() + offset, shou
ldAffinityBeDownstream); |
531 | 531 |
532 bool positionIsAtStartOfBox = !offset; | 532 bool positionIsAtStartOfBox = !offset; |
533 if (positionIsAtStartOfBox == box->isLeftToRightDirection()) { | 533 if (positionIsAtStartOfBox == box->isLeftToRightDirection()) { |
534 // offset is on the left edge | 534 // offset is on the left edge |
535 | 535 |
536 const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); | 536 const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); |
537 if ((prevBox && prevBox->bidiLevel() == box->bidiLevel()) | 537 if ((prevBox && prevBox->bidiLevel() == box->bidiLevel()) |
538 || box->renderer().containingBlock()->style()->direction() == box->d
irection()) // FIXME: left on 12CBA | 538 || box->layoutObject().containingBlock()->style()->direction() == bo
x->direction()) // FIXME: left on 12CBA |
539 return createPositionWithAffinityForBox(box, box->caretLeftmostOffse
t(), shouldAffinityBeDownstream); | 539 return createPositionWithAffinityForBox(box, box->caretLeftmostOffse
t(), shouldAffinityBeDownstream); |
540 | 540 |
541 if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) { | 541 if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) { |
542 // e.g. left of B in aDC12BAb | 542 // e.g. left of B in aDC12BAb |
543 const InlineBox* leftmostBox; | 543 const InlineBox* leftmostBox; |
544 do { | 544 do { |
545 leftmostBox = prevBox; | 545 leftmostBox = prevBox; |
546 prevBox = leftmostBox->prevLeafChildIgnoringLineBreak(); | 546 prevBox = leftmostBox->prevLeafChildIgnoringLineBreak(); |
547 } while (prevBox && prevBox->bidiLevel() > box->bidiLevel()); | 547 } while (prevBox && prevBox->bidiLevel() > box->bidiLevel()); |
548 return createPositionWithAffinityForBox(leftmostBox, leftmostBox->ca
retRightmostOffset(), shouldAffinityBeDownstream); | 548 return createPositionWithAffinityForBox(leftmostBox, leftmostBox->ca
retRightmostOffset(), shouldAffinityBeDownstream); |
549 } | 549 } |
550 | 550 |
551 if (!prevBox || prevBox->bidiLevel() < box->bidiLevel()) { | 551 if (!prevBox || prevBox->bidiLevel() < box->bidiLevel()) { |
552 // e.g. left of D in aDC12BAb | 552 // e.g. left of D in aDC12BAb |
553 const InlineBox* rightmostBox; | 553 const InlineBox* rightmostBox; |
554 const InlineBox* nextBox = box; | 554 const InlineBox* nextBox = box; |
555 do { | 555 do { |
556 rightmostBox = nextBox; | 556 rightmostBox = nextBox; |
557 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); | 557 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); |
558 } while (nextBox && nextBox->bidiLevel() >= box->bidiLevel()); | 558 } while (nextBox && nextBox->bidiLevel() >= box->bidiLevel()); |
559 return createPositionWithAffinityForBox(rightmostBox, | 559 return createPositionWithAffinityForBox(rightmostBox, |
560 box->isLeftToRightDirection() ? rightmostBox->caretMaxOffset() :
rightmostBox->caretMinOffset(), shouldAffinityBeDownstream); | 560 box->isLeftToRightDirection() ? rightmostBox->caretMaxOffset() :
rightmostBox->caretMinOffset(), shouldAffinityBeDownstream); |
561 } | 561 } |
562 | 562 |
563 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); | 563 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); |
564 } | 564 } |
565 | 565 |
566 const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); | 566 const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); |
567 if ((nextBox && nextBox->bidiLevel() == box->bidiLevel()) | 567 if ((nextBox && nextBox->bidiLevel() == box->bidiLevel()) |
568 || box->renderer().containingBlock()->style()->direction() == box->direc
tion()) | 568 || box->layoutObject().containingBlock()->style()->direction() == box->d
irection()) |
569 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); | 569 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); |
570 | 570 |
571 // offset is on the right edge | 571 // offset is on the right edge |
572 if (nextBox && nextBox->bidiLevel() > box->bidiLevel()) { | 572 if (nextBox && nextBox->bidiLevel() > box->bidiLevel()) { |
573 // e.g. right of C in aDC12BAb | 573 // e.g. right of C in aDC12BAb |
574 const InlineBox* rightmostBox; | 574 const InlineBox* rightmostBox; |
575 do { | 575 do { |
576 rightmostBox = nextBox; | 576 rightmostBox = nextBox; |
577 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); | 577 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); |
578 } while (nextBox && nextBox->bidiLevel() > box->bidiLevel()); | 578 } while (nextBox && nextBox->bidiLevel() > box->bidiLevel()); |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; | 1858 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; |
1859 } | 1859 } |
1860 | 1860 |
1861 #if ENABLE(ASSERT) | 1861 #if ENABLE(ASSERT) |
1862 | 1862 |
1863 void LayoutText::checkConsistency() const | 1863 void LayoutText::checkConsistency() const |
1864 { | 1864 { |
1865 #ifdef CHECK_CONSISTENCY | 1865 #ifdef CHECK_CONSISTENCY |
1866 const InlineTextBox* prev = 0; | 1866 const InlineTextBox* prev = 0; |
1867 for (const InlineTextBox* child = m_firstTextBox; child != 0; child = child-
>nextTextBox()) { | 1867 for (const InlineTextBox* child = m_firstTextBox; child != 0; child = child-
>nextTextBox()) { |
1868 ASSERT(child->renderer() == this); | 1868 ASSERT(child->layoutObject() == this); |
1869 ASSERT(child->prevTextBox() == prev); | 1869 ASSERT(child->prevTextBox() == prev); |
1870 prev = child; | 1870 prev = child; |
1871 } | 1871 } |
1872 ASSERT(prev == m_lastTextBox); | 1872 ASSERT(prev == m_lastTextBox); |
1873 #endif | 1873 #endif |
1874 } | 1874 } |
1875 | 1875 |
1876 #endif | 1876 #endif |
1877 | 1877 |
1878 void LayoutText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacter
Offset) | 1878 void LayoutText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacter
Offset) |
(...skipping 15 matching lines...) Expand all Loading... |
1894 } | 1894 } |
1895 | 1895 |
1896 void LayoutText::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const | 1896 void LayoutText::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const |
1897 { | 1897 { |
1898 LayoutObject::invalidateDisplayItemClients(displayItemList); | 1898 LayoutObject::invalidateDisplayItemClients(displayItemList); |
1899 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) | 1899 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) |
1900 displayItemList->invalidate(box->displayItemClient()); | 1900 displayItemList->invalidate(box->displayItemClient()); |
1901 } | 1901 } |
1902 | 1902 |
1903 } // namespace blink | 1903 } // namespace blink |
OLD | NEW |