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. All right r
eserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All right r
eserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 return WTF::Unicode::OtherNeutral; | 414 return WTF::Unicode::OtherNeutral; |
415 } | 415 } |
416 | 416 |
417 template<> | 417 template<> |
418 inline void InlineBidiResolver::increment() | 418 inline void InlineBidiResolver::increment() |
419 { | 419 { |
420 m_current.increment(this, InlineIterator::FastIncrementInIsolatedRenderer); | 420 m_current.increment(this, InlineIterator::FastIncrementInIsolatedRenderer); |
421 } | 421 } |
422 | 422 |
423 template <> | 423 template <> |
424 inline bool InlineBidiResolver::isEndOfParagraph(const InlineIterator& end) | 424 inline bool InlineBidiResolver::isEndOfLine(const InlineIterator& end) |
425 { | 425 { |
426 bool inEndOfParagraph = m_current == end || m_current.atEnd() || (inIsolate(
) && m_current.m_obj == end.m_obj); | 426 bool inEndOfLine = m_current == end || m_current.atEnd() || (inIsolate() &&
m_current.m_obj == end.m_obj); |
427 if (inIsolate() && inEndOfParagraph) { | 427 if (inIsolate() && inEndOfLine) { |
428 m_current.moveTo(m_current.m_obj, end.m_pos, m_current.m_nextBreakablePo
sition); | 428 m_current.moveTo(m_current.m_obj, end.m_pos, m_current.m_nextBreakablePo
sition); |
429 m_last = m_current; | 429 m_last = m_current; |
430 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); | 430 updateStatusLastFromCurrentDirection(WTF::Unicode::OtherNeutral); |
431 } | 431 } |
432 return inEndOfParagraph; | 432 return inEndOfLine; |
433 } | 433 } |
434 | 434 |
435 static inline bool isIsolatedInline(RenderObject* object) | 435 static inline bool isIsolatedInline(RenderObject* object) |
436 { | 436 { |
437 ASSERT(object); | 437 ASSERT(object); |
438 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); | 438 return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()
); |
439 } | 439 } |
440 | 440 |
441 static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* obj
ect, RenderObject* root) | 441 static inline RenderObject* highestContainingIsolateWithinRoot(RenderObject* obj
ect, RenderObject* root) |
442 { | 442 { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 template <> | 582 template <> |
583 inline void InlineBidiResolver::appendRun() | 583 inline void InlineBidiResolver::appendRun() |
584 { | 584 { |
585 if (!m_emptyRun && !m_eor.atEnd() && !m_reachedEndOfLine) { | 585 if (!m_emptyRun && !m_eor.atEnd() && !m_reachedEndOfLine) { |
586 // Keep track of when we enter/leave "unicode-bidi: isolate" inlines. | 586 // Keep track of when we enter/leave "unicode-bidi: isolate" inlines. |
587 // Initialize our state depending on if we're starting in the middle of
such an inline. | 587 // Initialize our state depending on if we're starting in the middle of
such an inline. |
588 // FIXME: Could this initialize from this->inIsolate() instead of walkin
g up the render tree? | 588 // FIXME: Could this initialize from this->inIsolate() instead of walkin
g up the render tree? |
589 IsolateTracker isolateTracker(numberOfIsolateAncestors(m_sor)); | 589 IsolateTracker isolateTracker(numberOfIsolateAncestors(m_sor)); |
590 int start = m_sor.m_pos; | 590 int start = m_sor.m_pos; |
591 RenderObject* obj = m_sor.m_obj; | 591 RenderObject* obj = m_sor.m_obj; |
592 while (obj && obj != m_eor.m_obj && obj != endOfLine.m_obj) { | 592 while (obj && obj != m_eor.m_obj && obj != m_endOfRunAtEndOfLine.m_obj)
{ |
593 if (isolateTracker.inIsolate()) | 593 if (isolateTracker.inIsolate()) |
594 isolateTracker.addFakeRunIfNecessary(obj, start, obj->length(),
*this); | 594 isolateTracker.addFakeRunIfNecessary(obj, start, obj->length(),
*this); |
595 else | 595 else |
596 RenderBlockFlow::appendRunsForObject(m_runs, start, obj->length(
), obj, *this); | 596 RenderBlockFlow::appendRunsForObject(m_runs, start, obj->length(
), obj, *this); |
597 // FIXME: start/obj should be an InlineIterator instead of two separ
ate variables. | 597 // FIXME: start/obj should be an InlineIterator instead of two separ
ate variables. |
598 start = 0; | 598 start = 0; |
599 obj = bidiNextSkippingEmptyInlines(m_sor.root(), obj, &isolateTracke
r); | 599 obj = bidiNextSkippingEmptyInlines(m_sor.root(), obj, &isolateTracke
r); |
600 } | 600 } |
601 if (obj) { | 601 bool isEndOfLine = obj == m_endOfLine.m_obj && !m_endOfLine.m_pos; |
| 602 if (obj && !isEndOfLine) { |
602 unsigned pos = obj == m_eor.m_obj ? m_eor.m_pos : INT_MAX; | 603 unsigned pos = obj == m_eor.m_obj ? m_eor.m_pos : INT_MAX; |
603 if (obj == endOfLine.m_obj && endOfLine.m_pos <= pos) { | 604 if (obj == m_endOfRunAtEndOfLine.m_obj && m_endOfRunAtEndOfLine.m_po
s <= pos) { |
604 m_reachedEndOfLine = true; | 605 m_reachedEndOfLine = true; |
605 pos = endOfLine.m_pos; | 606 pos = m_endOfRunAtEndOfLine.m_pos; |
606 } | 607 } |
607 // It's OK to add runs for zero-length RenderObjects, just don't mak
e the run larger than it should be | 608 // It's OK to add runs for zero-length RenderObjects, just don't mak
e the run larger than it should be |
608 int end = obj->length() ? pos + 1 : 0; | 609 int end = obj->length() ? pos + 1 : 0; |
609 if (isolateTracker.inIsolate()) | 610 if (isolateTracker.inIsolate()) |
610 isolateTracker.addFakeRunIfNecessary(obj, start, end, *this); | 611 isolateTracker.addFakeRunIfNecessary(obj, start, end, *this); |
611 else | 612 else |
612 RenderBlockFlow::appendRunsForObject(m_runs, start, end, obj, *t
his); | 613 RenderBlockFlow::appendRunsForObject(m_runs, start, end, obj, *t
his); |
613 } | 614 } |
614 | 615 |
615 m_eor.increment(); | 616 m_eor.increment(); |
616 m_sor = m_eor; | 617 m_sor = m_eor; |
617 } | 618 } |
618 | 619 |
619 m_direction = WTF::Unicode::OtherNeutral; | 620 m_direction = WTF::Unicode::OtherNeutral; |
620 m_status.eor = WTF::Unicode::OtherNeutral; | 621 m_status.eor = WTF::Unicode::OtherNeutral; |
621 } | 622 } |
622 | 623 |
623 } | 624 } |
624 | 625 |
625 #endif // InlineIterator_h | 626 #endif // InlineIterator_h |
OLD | NEW |