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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 case AlwaysDownstream: | 509 case AlwaysDownstream: |
510 affinity = DOWNSTREAM; | 510 affinity = DOWNSTREAM; |
511 break; | 511 break; |
512 case AlwaysUpstream: | 512 case AlwaysUpstream: |
513 affinity = VP_UPSTREAM_IF_POSSIBLE; | 513 affinity = VP_UPSTREAM_IF_POSSIBLE; |
514 break; | 514 break; |
515 case UpstreamIfPositionIsNotAtStart: | 515 case UpstreamIfPositionIsNotAtStart: |
516 affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : DO
WNSTREAM; | 516 affinity = offset > box->caretMinOffset() ? VP_UPSTREAM_IF_POSSIBLE : DO
WNSTREAM; |
517 break; | 517 break; |
518 } | 518 } |
519 int textStartOffset = box->renderer().isText() ? toLayoutText(box->renderer(
)).textStartOffset() : 0; | 519 int textStartOffset = box->layoutObject().isText() ? toLayoutText(box->layou
tObject()).textStartOffset() : 0; |
520 return box->renderer().createPositionWithAffinity(offset + textStartOffset,
affinity); | 520 return box->layoutObject().createPositionWithAffinity(offset + textStartOffs
et, affinity); |
521 } | 521 } |
522 | 522 |
523 static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
ForBiDi(const InlineTextBox* box, int offset, ShouldAffinityBeDownstream shouldA
ffinityBeDownstream) | 523 static PositionWithAffinity createPositionWithAffinityForBoxAfterAdjustingOffset
ForBiDi(const InlineTextBox* box, int offset, ShouldAffinityBeDownstream shouldA
ffinityBeDownstream) |
524 { | 524 { |
525 ASSERT(box); | 525 ASSERT(box); |
526 ASSERT(offset >= 0); | 526 ASSERT(offset >= 0); |
527 | 527 |
528 if (offset && static_cast<unsigned>(offset) < box->len()) | 528 if (offset && static_cast<unsigned>(offset) < box->len()) |
529 return createPositionWithAffinityForBox(box, box->start() + offset, shou
ldAffinityBeDownstream); | 529 return createPositionWithAffinityForBox(box, box->start() + offset, shou
ldAffinityBeDownstream); |
530 | 530 |
531 bool positionIsAtStartOfBox = !offset; | 531 bool positionIsAtStartOfBox = !offset; |
532 if (positionIsAtStartOfBox == box->isLeftToRightDirection()) { | 532 if (positionIsAtStartOfBox == box->isLeftToRightDirection()) { |
533 // offset is on the left edge | 533 // offset is on the left edge |
534 | 534 |
535 const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); | 535 const InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); |
536 if ((prevBox && prevBox->bidiLevel() == box->bidiLevel()) | 536 if ((prevBox && prevBox->bidiLevel() == box->bidiLevel()) |
537 || box->renderer().containingBlock()->style()->direction() == box->d
irection()) // FIXME: left on 12CBA | 537 || box->layoutObject().containingBlock()->style()->direction() == bo
x->direction()) // FIXME: left on 12CBA |
538 return createPositionWithAffinityForBox(box, box->caretLeftmostOffse
t(), shouldAffinityBeDownstream); | 538 return createPositionWithAffinityForBox(box, box->caretLeftmostOffse
t(), shouldAffinityBeDownstream); |
539 | 539 |
540 if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) { | 540 if (prevBox && prevBox->bidiLevel() > box->bidiLevel()) { |
541 // e.g. left of B in aDC12BAb | 541 // e.g. left of B in aDC12BAb |
542 const InlineBox* leftmostBox; | 542 const InlineBox* leftmostBox; |
543 do { | 543 do { |
544 leftmostBox = prevBox; | 544 leftmostBox = prevBox; |
545 prevBox = leftmostBox->prevLeafChildIgnoringLineBreak(); | 545 prevBox = leftmostBox->prevLeafChildIgnoringLineBreak(); |
546 } while (prevBox && prevBox->bidiLevel() > box->bidiLevel()); | 546 } while (prevBox && prevBox->bidiLevel() > box->bidiLevel()); |
547 return createPositionWithAffinityForBox(leftmostBox, leftmostBox->ca
retRightmostOffset(), shouldAffinityBeDownstream); | 547 return createPositionWithAffinityForBox(leftmostBox, leftmostBox->ca
retRightmostOffset(), shouldAffinityBeDownstream); |
548 } | 548 } |
549 | 549 |
550 if (!prevBox || prevBox->bidiLevel() < box->bidiLevel()) { | 550 if (!prevBox || prevBox->bidiLevel() < box->bidiLevel()) { |
551 // e.g. left of D in aDC12BAb | 551 // e.g. left of D in aDC12BAb |
552 const InlineBox* rightmostBox; | 552 const InlineBox* rightmostBox; |
553 const InlineBox* nextBox = box; | 553 const InlineBox* nextBox = box; |
554 do { | 554 do { |
555 rightmostBox = nextBox; | 555 rightmostBox = nextBox; |
556 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); | 556 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); |
557 } while (nextBox && nextBox->bidiLevel() >= box->bidiLevel()); | 557 } while (nextBox && nextBox->bidiLevel() >= box->bidiLevel()); |
558 return createPositionWithAffinityForBox(rightmostBox, | 558 return createPositionWithAffinityForBox(rightmostBox, |
559 box->isLeftToRightDirection() ? rightmostBox->caretMaxOffset() :
rightmostBox->caretMinOffset(), shouldAffinityBeDownstream); | 559 box->isLeftToRightDirection() ? rightmostBox->caretMaxOffset() :
rightmostBox->caretMinOffset(), shouldAffinityBeDownstream); |
560 } | 560 } |
561 | 561 |
562 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); | 562 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); |
563 } | 563 } |
564 | 564 |
565 const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); | 565 const InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); |
566 if ((nextBox && nextBox->bidiLevel() == box->bidiLevel()) | 566 if ((nextBox && nextBox->bidiLevel() == box->bidiLevel()) |
567 || box->renderer().containingBlock()->style()->direction() == box->direc
tion()) | 567 || box->layoutObject().containingBlock()->style()->direction() == box->d
irection()) |
568 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); | 568 return createPositionWithAffinityForBox(box, box->caretRightmostOffset()
, shouldAffinityBeDownstream); |
569 | 569 |
570 // offset is on the right edge | 570 // offset is on the right edge |
571 if (nextBox && nextBox->bidiLevel() > box->bidiLevel()) { | 571 if (nextBox && nextBox->bidiLevel() > box->bidiLevel()) { |
572 // e.g. right of C in aDC12BAb | 572 // e.g. right of C in aDC12BAb |
573 const InlineBox* rightmostBox; | 573 const InlineBox* rightmostBox; |
574 do { | 574 do { |
575 rightmostBox = nextBox; | 575 rightmostBox = nextBox; |
576 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); | 576 nextBox = rightmostBox->nextLeafChildIgnoringLineBreak(); |
577 } while (nextBox && nextBox->bidiLevel() > box->bidiLevel()); | 577 } while (nextBox && nextBox->bidiLevel() > box->bidiLevel()); |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; | 1857 return Character::characterRangeCodePath(characters16(), length()) == Simple
Path; |
1858 } | 1858 } |
1859 | 1859 |
1860 #if ENABLE(ASSERT) | 1860 #if ENABLE(ASSERT) |
1861 | 1861 |
1862 void LayoutText::checkConsistency() const | 1862 void LayoutText::checkConsistency() const |
1863 { | 1863 { |
1864 #ifdef CHECK_CONSISTENCY | 1864 #ifdef CHECK_CONSISTENCY |
1865 const InlineTextBox* prev = 0; | 1865 const InlineTextBox* prev = 0; |
1866 for (const InlineTextBox* child = m_firstTextBox; child != 0; child = child-
>nextTextBox()) { | 1866 for (const InlineTextBox* child = m_firstTextBox; child != 0; child = child-
>nextTextBox()) { |
1867 ASSERT(child->renderer() == this); | 1867 ASSERT(child->layoutObject() == this); |
1868 ASSERT(child->prevTextBox() == prev); | 1868 ASSERT(child->prevTextBox() == prev); |
1869 prev = child; | 1869 prev = child; |
1870 } | 1870 } |
1871 ASSERT(prev == m_lastTextBox); | 1871 ASSERT(prev == m_lastTextBox); |
1872 #endif | 1872 #endif |
1873 } | 1873 } |
1874 | 1874 |
1875 #endif | 1875 #endif |
1876 | 1876 |
1877 void LayoutText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacter
Offset) | 1877 void LayoutText::momentarilyRevealLastTypedCharacter(unsigned lastTypedCharacter
Offset) |
(...skipping 15 matching lines...) Expand all Loading... |
1893 } | 1893 } |
1894 | 1894 |
1895 void LayoutText::invalidateDisplayItemClients(const LayoutBoxModelObject& paintI
nvalidationContainer) const | 1895 void LayoutText::invalidateDisplayItemClients(const LayoutBoxModelObject& paintI
nvalidationContainer) const |
1896 { | 1896 { |
1897 LayoutObject::invalidateDisplayItemClients(paintInvalidationContainer); | 1897 LayoutObject::invalidateDisplayItemClients(paintInvalidationContainer); |
1898 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) | 1898 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) |
1899 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(box->dis
playItemClient()); | 1899 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(box->dis
playItemClient()); |
1900 } | 1900 } |
1901 | 1901 |
1902 } // namespace blink | 1902 } // namespace blink |
OLD | NEW |