| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 4 * All right reserved. | 4 * All right reserved. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 LineLayoutItem o = root.firstChild(); | 392 LineLayoutItem o = root.firstChild(); |
| 393 // If either there are no children to walk, or the first one is correct | 393 // If either there are no children to walk, or the first one is correct |
| 394 // then just return it. | 394 // then just return it. |
| 395 if (!o || o.isLayoutInline() || isIteratorTarget(o)) | 395 if (!o || o.isLayoutInline() || isIteratorTarget(o)) |
| 396 return o; | 396 return o; |
| 397 | 397 |
| 398 return bidiNextIncludingEmptyInlines(root, o); | 398 return bidiNextIncludingEmptyInlines(root, o); |
| 399 } | 399 } |
| 400 | 400 |
| 401 inline void InlineIterator::fastIncrementInTextNode() { | 401 inline void InlineIterator::fastIncrementInTextNode() { |
| 402 ASSERT(m_lineLayoutItem); | 402 DCHECK(m_lineLayoutItem); |
| 403 ASSERT(m_lineLayoutItem.isText()); | 403 DCHECK(m_lineLayoutItem.isText()); |
| 404 ASSERT(m_pos <= LineLayoutText(m_lineLayoutItem).textLength()); | 404 DCHECK_LE(m_pos, LineLayoutText(m_lineLayoutItem).textLength()); |
| 405 if (m_pos < INT_MAX) | 405 if (m_pos < INT_MAX) |
| 406 m_pos++; | 406 m_pos++; |
| 407 } | 407 } |
| 408 | 408 |
| 409 // FIXME: This is used by LayoutBlockFlow for simplified layout, and has nothing | 409 // FIXME: This is used by LayoutBlockFlow for simplified layout, and has nothing |
| 410 // to do with bidi it shouldn't use functions called bidiFirst and bidiNext. | 410 // to do with bidi it shouldn't use functions called bidiFirst and bidiNext. |
| 411 class InlineWalker { | 411 class InlineWalker { |
| 412 STACK_ALLOCATED(); | 412 STACK_ALLOCATED(); |
| 413 | 413 |
| 414 public: | 414 public: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (!isCollapsibleSpace(current, lastText)) | 560 if (!isCollapsibleSpace(current, lastText)) |
| 561 break; | 561 break; |
| 562 firstSpace--; | 562 firstSpace--; |
| 563 } | 563 } |
| 564 | 564 |
| 565 return firstSpace; | 565 return firstSpace; |
| 566 } | 566 } |
| 567 | 567 |
| 568 template <> | 568 template <> |
| 569 inline int InlineBidiResolver::findFirstTrailingSpaceAtRun(BidiRun* run) { | 569 inline int InlineBidiResolver::findFirstTrailingSpaceAtRun(BidiRun* run) { |
| 570 ASSERT(run); | 570 DCHECK(run); |
| 571 LineLayoutItem lastObject = LineLayoutItem(run->m_lineLayoutItem); | 571 LineLayoutItem lastObject = LineLayoutItem(run->m_lineLayoutItem); |
| 572 if (!lastObject.isText()) | 572 if (!lastObject.isText()) |
| 573 return run->m_stop; | 573 return run->m_stop; |
| 574 | 574 |
| 575 LineLayoutText lastText(lastObject); | 575 LineLayoutText lastText(lastObject); |
| 576 int firstSpace; | 576 int firstSpace; |
| 577 if (lastText.is8Bit()) | 577 if (lastText.is8Bit()) |
| 578 firstSpace = findFirstTrailingSpace(lastText, lastText.characters8(), | 578 firstSpace = findFirstTrailingSpace(lastText, lastText.characters8(), |
| 579 run->start(), run->stop()); | 579 run->start(), run->stop()); |
| 580 else | 580 else |
| (...skipping 26 matching lines...) Expand all Loading... |
| 607 inline bool InlineBidiResolver::needsToApplyL1Rule(BidiRunList<BidiRun>& runs) { | 607 inline bool InlineBidiResolver::needsToApplyL1Rule(BidiRunList<BidiRun>& runs) { |
| 608 if (!runs.logicallyLastRun() | 608 if (!runs.logicallyLastRun() |
| 609 ->m_lineLayoutItem.style() | 609 ->m_lineLayoutItem.style() |
| 610 ->breakOnlyAfterWhiteSpace() || | 610 ->breakOnlyAfterWhiteSpace() || |
| 611 !runs.logicallyLastRun()->m_lineLayoutItem.style()->autoWrap()) | 611 !runs.logicallyLastRun()->m_lineLayoutItem.style()->autoWrap()) |
| 612 return false; | 612 return false; |
| 613 return true; | 613 return true; |
| 614 } | 614 } |
| 615 | 615 |
| 616 static inline bool isIsolatedInline(LineLayoutItem object) { | 616 static inline bool isIsolatedInline(LineLayoutItem object) { |
| 617 ASSERT(object); | 617 DCHECK(object); |
| 618 return object.isLayoutInline() && treatAsIsolated(object.styleRef()); | 618 return object.isLayoutInline() && treatAsIsolated(object.styleRef()); |
| 619 } | 619 } |
| 620 | 620 |
| 621 static inline LineLayoutItem highestContainingIsolateWithinRoot( | 621 static inline LineLayoutItem highestContainingIsolateWithinRoot( |
| 622 LineLayoutItem object, | 622 LineLayoutItem object, |
| 623 LineLayoutItem root) { | 623 LineLayoutItem root) { |
| 624 ASSERT(object); | 624 DCHECK(object); |
| 625 LineLayoutItem containingIsolateObj(nullptr); | 625 LineLayoutItem containingIsolateObj(nullptr); |
| 626 while (object && object != root) { | 626 while (object && object != root) { |
| 627 if (isIsolatedInline(object)) | 627 if (isIsolatedInline(object)) |
| 628 containingIsolateObj = LineLayoutItem(object); | 628 containingIsolateObj = LineLayoutItem(object); |
| 629 | 629 |
| 630 object = object.parent(); | 630 object = object.parent(); |
| 631 ASSERT(object); | 631 DCHECK(object); |
| 632 } | 632 } |
| 633 return containingIsolateObj; | 633 return containingIsolateObj; |
| 634 } | 634 } |
| 635 | 635 |
| 636 static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter) { | 636 static inline unsigned numberOfIsolateAncestors(const InlineIterator& iter) { |
| 637 LineLayoutItem object = iter.getLineLayoutItem(); | 637 LineLayoutItem object = iter.getLineLayoutItem(); |
| 638 if (!object) | 638 if (!object) |
| 639 return 0; | 639 return 0; |
| 640 unsigned count = 0; | 640 unsigned count = 0; |
| 641 while (object && object != iter.root()) { | 641 while (object && object != iter.root()) { |
| 642 if (isIsolatedInline(object)) | 642 if (isIsolatedInline(object)) |
| 643 count++; | 643 count++; |
| 644 object = object.parent(); | 644 object = object.parent(); |
| 645 } | 645 } |
| 646 return count; | 646 return count; |
| 647 } | 647 } |
| 648 | 648 |
| 649 // FIXME: This belongs on InlineBidiResolver, except it's a template | 649 // FIXME: This belongs on InlineBidiResolver, except it's a template |
| 650 // specialization of BidiResolver which knows nothing about LayoutObjects. | 650 // specialization of BidiResolver which knows nothing about LayoutObjects. |
| 651 static inline BidiRun* addPlaceholderRunForIsolatedInline( | 651 static inline BidiRun* addPlaceholderRunForIsolatedInline( |
| 652 InlineBidiResolver& resolver, | 652 InlineBidiResolver& resolver, |
| 653 LineLayoutItem obj, | 653 LineLayoutItem obj, |
| 654 unsigned pos, | 654 unsigned pos, |
| 655 LineLayoutItem root) { | 655 LineLayoutItem root) { |
| 656 ASSERT(obj); | 656 DCHECK(obj); |
| 657 BidiRun* isolatedRun = | 657 BidiRun* isolatedRun = |
| 658 new BidiRun(resolver.context()->override(), resolver.context()->level(), | 658 new BidiRun(resolver.context()->override(), resolver.context()->level(), |
| 659 pos, pos, obj, resolver.dir(), resolver.context()->dir()); | 659 pos, pos, obj, resolver.dir(), resolver.context()->dir()); |
| 660 resolver.runs().addRun(isolatedRun); | 660 resolver.runs().addRun(isolatedRun); |
| 661 // FIXME: isolatedRuns() could be a hash of object->run and then we could | 661 // FIXME: isolatedRuns() could be a hash of object->run and then we could |
| 662 // cheaply ASSERT here that we didn't create multiple objects for the same | 662 // cheaply ASSERT here that we didn't create multiple objects for the same |
| 663 // inline. | 663 // inline. |
| 664 resolver.isolatedRuns().push_back(BidiIsolatedRun( | 664 resolver.isolatedRuns().push_back(BidiIsolatedRun( |
| 665 obj, pos, root, *isolatedRun, resolver.context()->level())); | 665 obj, pos, root, *isolatedRun, resolver.context()->level())); |
| 666 return isolatedRun; | 666 return isolatedRun; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 686 : m_nestedIsolateCount(nestedIsolateCount), | 686 : m_nestedIsolateCount(nestedIsolateCount), |
| 687 m_haveAddedFakeRunForRootIsolate(false), | 687 m_haveAddedFakeRunForRootIsolate(false), |
| 688 m_runs(runs) {} | 688 m_runs(runs) {} |
| 689 | 689 |
| 690 void setMidpointStateForRootIsolate(const LineMidpointState& midpointState) { | 690 void setMidpointStateForRootIsolate(const LineMidpointState& midpointState) { |
| 691 m_midpointStateForRootIsolate = midpointState; | 691 m_midpointStateForRootIsolate = midpointState; |
| 692 } | 692 } |
| 693 | 693 |
| 694 void enterIsolate() { m_nestedIsolateCount++; } | 694 void enterIsolate() { m_nestedIsolateCount++; } |
| 695 void exitIsolate() { | 695 void exitIsolate() { |
| 696 ASSERT(m_nestedIsolateCount >= 1); | 696 DCHECK_GE(m_nestedIsolateCount, 1u); |
| 697 m_nestedIsolateCount--; | 697 m_nestedIsolateCount--; |
| 698 if (!inIsolate()) | 698 if (!inIsolate()) |
| 699 m_haveAddedFakeRunForRootIsolate = false; | 699 m_haveAddedFakeRunForRootIsolate = false; |
| 700 } | 700 } |
| 701 bool inIsolate() const { return m_nestedIsolateCount; } | 701 bool inIsolate() const { return m_nestedIsolateCount; } |
| 702 | 702 |
| 703 // We don't care if we encounter bidi directional overrides. | 703 // We don't care if we encounter bidi directional overrides. |
| 704 void embed(WTF::Unicode::CharDirection, BidiEmbeddingSource) {} | 704 void embed(WTF::Unicode::CharDirection, BidiEmbeddingSource) {} |
| 705 void commitExplicitEmbedding(BidiRunList<BidiRun>&) {} | 705 void commitExplicitEmbedding(BidiRunList<BidiRun>&) {} |
| 706 BidiRunList<BidiRun>& runs() { return m_runs; } | 706 BidiRunList<BidiRun>& runs() { return m_runs; } |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 m_sor = m_eor; | 895 m_sor = m_eor; |
| 896 } | 896 } |
| 897 | 897 |
| 898 m_direction = WTF::Unicode::OtherNeutral; | 898 m_direction = WTF::Unicode::OtherNeutral; |
| 899 m_status.eor = WTF::Unicode::OtherNeutral; | 899 m_status.eor = WTF::Unicode::OtherNeutral; |
| 900 } | 900 } |
| 901 | 901 |
| 902 } // namespace blink | 902 } // namespace blink |
| 903 | 903 |
| 904 #endif // InlineIterator_h | 904 #endif // InlineIterator_h |
| OLD | NEW |