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, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * Copyright (C) 2013 Adobe Systems Incorporated. | 5 * Copyright (C) 2013 Adobe Systems Incorporated. |
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 run.setTabSize(!collapseWhiteSpace, text->style()->tabSize()); | 519 run.setTabSize(!collapseWhiteSpace, text->style()->tabSize()); |
520 run.setXPos(xPos); | 520 run.setXPos(xPos); |
521 return font.width(run, fallbackFonts, &glyphOverflow); | 521 return font.width(run, fallbackFonts, &glyphOverflow); |
522 } | 522 } |
523 | 523 |
524 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
& hyphenated) | 524 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, bool
& hyphenated) |
525 { | 525 { |
526 if (!m_current.offset()) | 526 if (!m_current.offset()) |
527 m_appliedStartWidth = false; | 527 m_appliedStartWidth = false; |
528 | 528 |
529 LayoutText* renderText = toLayoutText(m_current.object()); | 529 LayoutText* layoutText = toLayoutText(m_current.object()); |
530 | 530 |
531 bool isSVGText = renderText->isSVGInlineText(); | 531 bool isSVGText = layoutText->isSVGInlineText(); |
532 | 532 |
533 // If we have left a no-wrap inline and entered an autowrap inline while ign
oring spaces | 533 // If we have left a no-wrap inline and entered an autowrap inline while ign
oring spaces |
534 // then we need to mark the start of the autowrap inline as a potential line
break now. | 534 // then we need to mark the start of the autowrap inline as a potential line
break now. |
535 if (m_autoWrap && !ComputedStyle::autoWrap(m_lastWS) && m_ignoringSpaces) { | 535 if (m_autoWrap && !ComputedStyle::autoWrap(m_lastWS) && m_ignoringSpaces) { |
536 m_width.commit(); | 536 m_width.commit(); |
537 m_lineBreak.moveToStartOf(m_current.object()); | 537 m_lineBreak.moveToStartOf(m_current.object()); |
538 } | 538 } |
539 | 539 |
540 const ComputedStyle& style = renderText->styleRef(m_lineInfo.isFirstLine()); | 540 const ComputedStyle& style = layoutText->styleRef(m_lineInfo.isFirstLine()); |
541 const Font& font = style.font(); | 541 const Font& font = style.font(); |
542 | 542 |
543 unsigned lastSpace = m_current.offset(); | 543 unsigned lastSpace = m_current.offset(); |
544 float wordSpacing = m_currentStyle->wordSpacing(); | 544 float wordSpacing = m_currentStyle->wordSpacing(); |
545 float lastSpaceWordSpacing = 0; | 545 float lastSpaceWordSpacing = 0; |
546 float wordSpacingForWordMeasurement = 0; | 546 float wordSpacingForWordMeasurement = 0; |
547 | 547 |
548 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje
ct(), !m_appliedStartWidth, true); | 548 float wrapW = m_width.uncommittedWidth() + inlineLogicalWidth(m_current.obje
ct(), !m_appliedStartWidth, true); |
549 float charWidth = 0; | 549 float charWidth = 0; |
550 // Auto-wrapping text should wrap in the middle of a word only if it could n
ot wrap before the word, | 550 // Auto-wrapping text should wrap in the middle of a word only if it could n
ot wrap before the word, |
551 // which is only possible if the word is the first thing on the line, that i
s, if |w| is zero. | 551 // which is only possible if the word is the first thing on the line, that i
s, if |w| is zero. |
552 bool breakWords = m_currentStyle->breakWords() && ((m_autoWrap && !m_width.c
ommittedWidth()) || m_currWS == PRE); | 552 bool breakWords = m_currentStyle->breakWords() && ((m_autoWrap && !m_width.c
ommittedWidth()) || m_currWS == PRE); |
553 bool midWordBreak = false; | 553 bool midWordBreak = false; |
554 bool breakAll = m_currentStyle->wordBreak() == BreakAllWordBreak && m_autoWr
ap; | 554 bool breakAll = m_currentStyle->wordBreak() == BreakAllWordBreak && m_autoWr
ap; |
555 bool prohibitBreakInside = m_currentStyle->hasTextCombine() && renderText->i
sCombineText() && toLayoutTextCombine(renderText)->isCombined(); | 555 bool prohibitBreakInside = m_currentStyle->hasTextCombine() && layoutText->i
sCombineText() && toLayoutTextCombine(layoutText)->isCombined(); |
556 float hyphenWidth = 0; | 556 float hyphenWidth = 0; |
557 | 557 |
558 if (isSVGText) { | 558 if (isSVGText) { |
559 breakWords = false; | 559 breakWords = false; |
560 breakAll = false; | 560 breakAll = false; |
561 } | 561 } |
562 | 562 |
563 if (renderText->isWordBreak()) { | 563 if (layoutText->isWordBreak()) { |
564 m_width.commit(); | 564 m_width.commit(); |
565 m_lineBreak.moveToStartOf(m_current.object()); | 565 m_lineBreak.moveToStartOf(m_current.object()); |
566 ASSERT(m_current.offset() == renderText->textLength()); | 566 ASSERT(m_current.offset() == layoutText->textLength()); |
567 } | 567 } |
568 | 568 |
569 if (m_renderTextInfo.m_text != renderText) { | 569 if (m_renderTextInfo.m_text != layoutText) { |
570 m_renderTextInfo.m_text = renderText; | 570 m_renderTextInfo.m_text = layoutText; |
571 m_renderTextInfo.m_font = &font; | 571 m_renderTextInfo.m_font = &font; |
572 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(rende
rText->text(), style.locale()); | 572 m_renderTextInfo.m_lineBreakIterator.resetStringAndReleaseIterator(layou
tText->text(), style.locale()); |
573 } else if (m_renderTextInfo.m_font != &font) { | 573 } else if (m_renderTextInfo.m_font != &font) { |
574 m_renderTextInfo.m_font = &font; | 574 m_renderTextInfo.m_font = &font; |
575 } | 575 } |
576 | 576 |
577 // Non-zero only when kerning is enabled, in which case we measure | 577 // Non-zero only when kerning is enabled, in which case we measure |
578 // words with their trailing space, then subtract its width. | 578 // words with their trailing space, then subtract its width. |
579 float wordTrailingSpaceWidth = (font.fontDescription().typesettingFeatures()
& Kerning) ? | 579 float wordTrailingSpaceWidth = (font.fontDescription().typesettingFeatures()
& Kerning) ? |
580 font.width(constructTextRun(renderText, font, &space, 1, style, style.di
rection())) + wordSpacing | 580 font.width(constructTextRun(layoutText, font, &space, 1, style, style.di
rection())) + wordSpacing |
581 : 0; | 581 : 0; |
582 | 582 |
583 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter(); | 583 UChar lastCharacter = m_renderTextInfo.m_lineBreakIterator.lastCharacter(); |
584 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL
astCharacter(); | 584 UChar secondToLastCharacter = m_renderTextInfo.m_lineBreakIterator.secondToL
astCharacter(); |
585 for (; m_current.offset() < renderText->textLength(); m_current.fastIncremen
tInTextNode()) { | 585 for (; m_current.offset() < layoutText->textLength(); m_current.fastIncremen
tInTextNode()) { |
586 bool previousCharacterIsSpace = m_currentCharacterIsSpace; | 586 bool previousCharacterIsSpace = m_currentCharacterIsSpace; |
587 bool previousCharacterShouldCollapseIfPreWap = m_currentCharacterShouldC
ollapseIfPreWap; | 587 bool previousCharacterShouldCollapseIfPreWap = m_currentCharacterShouldC
ollapseIfPreWap; |
588 UChar c = m_current.current(); | 588 UChar c = m_current.current(); |
589 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = c
== ' ' || c == '\t' || (!m_preservesNewline && (c == '\n')); | 589 m_currentCharacterShouldCollapseIfPreWap = m_currentCharacterIsSpace = c
== ' ' || c == '\t' || (!m_preservesNewline && (c == '\n')); |
590 | 590 |
591 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) | 591 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) |
592 m_lineInfo.setEmpty(false, m_block, &m_width); | 592 m_lineInfo.setEmpty(false, m_block, &m_width); |
593 | 593 |
594 if (c == softHyphen && m_autoWrap && !hyphenWidth) { | 594 if (c == softHyphen && m_autoWrap && !hyphenWidth) { |
595 hyphenWidth = measureHyphenWidth(renderText, font, textDirectionFrom
Unicode(m_resolver.position().direction())); | 595 hyphenWidth = measureHyphenWidth(layoutText, font, textDirectionFrom
Unicode(m_resolver.position().direction())); |
596 m_width.addUncommittedWidth(hyphenWidth); | 596 m_width.addUncommittedWidth(hyphenWidth); |
597 } | 597 } |
598 | 598 |
599 bool applyWordSpacing = false; | 599 bool applyWordSpacing = false; |
600 | 600 |
601 if (breakWords && !midWordBreak) { | 601 if (breakWords && !midWordBreak) { |
602 wrapW += charWidth; | 602 wrapW += charWidth; |
603 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current
.offset() + 1 < renderText->textLength() && U16_IS_TRAIL((*renderText)[m_current
.offset() + 1]); | 603 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current
.offset() + 1 < layoutText->textLength() && U16_IS_TRAIL((*layoutText)[m_current
.offset() + 1]); |
604 charWidth = textWidth(renderText, m_current.offset(), midWordBreakIs
BeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, m_collapseW
hiteSpace); | 604 charWidth = textWidth(layoutText, m_current.offset(), midWordBreakIs
BeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, m_collapseW
hiteSpace); |
605 midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_widt
h.availableWidth(); | 605 midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_widt
h.availableWidth(); |
606 } | 606 } |
607 | 607 |
608 int nextBreakablePosition = m_current.nextBreakablePosition(); | 608 int nextBreakablePosition = m_current.nextBreakablePosition(); |
609 bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && m_ren
derTextInfo.m_lineBreakIterator.isBreakable(m_current.offset(), nextBreakablePos
ition, breakAll ? LineBreakType::BreakAll : LineBreakType::Normal)); | 609 bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && m_ren
derTextInfo.m_lineBreakIterator.isBreakable(m_current.offset(), nextBreakablePos
ition, breakAll ? LineBreakType::BreakAll : LineBreakType::Normal)); |
610 m_current.setNextBreakablePosition(nextBreakablePosition); | 610 m_current.setNextBreakablePosition(nextBreakablePosition); |
611 | 611 |
612 if (betweenWords || midWordBreak) { | 612 if (betweenWords || midWordBreak) { |
613 bool stoppedIgnoringSpaces = false; | 613 bool stoppedIgnoringSpaces = false; |
614 if (m_ignoringSpaces) { | 614 if (m_ignoringSpaces) { |
615 lastSpaceWordSpacing = 0; | 615 lastSpaceWordSpacing = 0; |
616 if (!m_currentCharacterIsSpace) { | 616 if (!m_currentCharacterIsSpace) { |
617 // Stop ignoring spaces and begin at this | 617 // Stop ignoring spaces and begin at this |
618 // new point. | 618 // new point. |
619 m_ignoringSpaces = false; | 619 m_ignoringSpaces = false; |
620 wordSpacingForWordMeasurement = 0; | 620 wordSpacingForWordMeasurement = 0; |
621 lastSpace = m_current.offset(); // e.g., "Foo goo", don't
add in any of the ignored spaces. | 621 lastSpace = m_current.offset(); // e.g., "Foo goo", don't
add in any of the ignored spaces. |
622 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_c
urrent.object(), m_current.offset())); | 622 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_c
urrent.object(), m_current.offset())); |
623 stoppedIgnoringSpaces = true; | 623 stoppedIgnoringSpaces = true; |
624 } else { | 624 } else { |
625 // Just keep ignoring these spaces. | 625 // Just keep ignoring these spaces. |
626 nextCharacter(c, lastCharacter, secondToLastCharacter); | 626 nextCharacter(c, lastCharacter, secondToLastCharacter); |
627 continue; | 627 continue; |
628 } | 628 } |
629 } | 629 } |
630 | 630 |
631 wordMeasurements.grow(wordMeasurements.size() + 1); | 631 wordMeasurements.grow(wordMeasurements.size() + 1); |
632 WordMeasurement& wordMeasurement = wordMeasurements.last(); | 632 WordMeasurement& wordMeasurement = wordMeasurements.last(); |
633 | 633 |
634 wordMeasurement.renderer = renderText; | 634 wordMeasurement.renderer = layoutText; |
635 wordMeasurement.endOffset = m_current.offset(); | 635 wordMeasurement.endOffset = m_current.offset(); |
636 wordMeasurement.startOffset = lastSpace; | 636 wordMeasurement.startOffset = lastSpace; |
637 | 637 |
638 float additionalTempWidth; | 638 float additionalTempWidth; |
639 if (wordTrailingSpaceWidth && c == ' ') | 639 if (wordTrailingSpaceWidth && c == ' ') |
640 additionalTempWidth = textWidth(renderText, lastSpace, m_current
.offset() + 1 - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &
wordMeasurement.fallbackFonts) - wordTrailingSpaceWidth; | 640 additionalTempWidth = textWidth(layoutText, lastSpace, m_current
.offset() + 1 - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &
wordMeasurement.fallbackFonts) - wordTrailingSpaceWidth; |
641 else | 641 else |
642 additionalTempWidth = textWidth(renderText, lastSpace, m_current
.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &word
Measurement.fallbackFonts); | 642 additionalTempWidth = textWidth(layoutText, lastSpace, m_current
.offset() - lastSpace, font, m_width.currentWidth(), m_collapseWhiteSpace, &word
Measurement.fallbackFonts); |
643 | 643 |
644 wordMeasurement.width = additionalTempWidth + wordSpacingForWordMeas
urement; | 644 wordMeasurement.width = additionalTempWidth + wordSpacingForWordMeas
urement; |
645 additionalTempWidth += lastSpaceWordSpacing; | 645 additionalTempWidth += lastSpaceWordSpacing; |
646 m_width.addUncommittedWidth(additionalTempWidth); | 646 m_width.addUncommittedWidth(additionalTempWidth); |
647 | 647 |
648 if (m_collapseWhiteSpace && previousCharacterIsSpace && m_currentCha
racterIsSpace && additionalTempWidth) | 648 if (m_collapseWhiteSpace && previousCharacterIsSpace && m_currentCha
racterIsSpace && additionalTempWidth) |
649 m_width.setTrailingWhitespaceWidth(additionalTempWidth); | 649 m_width.setTrailingWhitespaceWidth(additionalTempWidth); |
650 | 650 |
651 if (!m_appliedStartWidth) { | 651 if (!m_appliedStartWidth) { |
652 m_width.addUncommittedWidth(inlineLogicalWidth(m_current.object(
), true, false).toFloat()); | 652 m_width.addUncommittedWidth(inlineLogicalWidth(m_current.object(
), true, false).toFloat()); |
653 m_appliedStartWidth = true; | 653 m_appliedStartWidth = true; |
654 } | 654 } |
655 | 655 |
656 applyWordSpacing = wordSpacing && m_currentCharacterIsSpace; | 656 applyWordSpacing = wordSpacing && m_currentCharacterIsSpace; |
657 | 657 |
658 if (!m_width.committedWidth() && m_autoWrap && !m_width.fitsOnLine()
) | 658 if (!m_width.committedWidth() && m_autoWrap && !m_width.fitsOnLine()
) |
659 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); | 659 m_width.fitBelowFloats(m_lineInfo.isFirstLine()); |
660 | 660 |
661 if (m_autoWrap || breakWords) { | 661 if (m_autoWrap || breakWords) { |
662 // If we break only after white-space, consider the current char
acter | 662 // If we break only after white-space, consider the current char
acter |
663 // as candidate width for this line. | 663 // as candidate width for this line. |
664 bool lineWasTooWide = false; | 664 bool lineWasTooWide = false; |
665 if (m_width.fitsOnLine() && m_currentCharacterIsSpace && m_curre
ntStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) { | 665 if (m_width.fitsOnLine() && m_currentCharacterIsSpace && m_curre
ntStyle->breakOnlyAfterWhiteSpace() && !midWordBreak) { |
666 float charWidth = textWidth(renderText, m_current.offset(),
1, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallback
Fonts) + (applyWordSpacing ? wordSpacing : 0); | 666 float charWidth = textWidth(layoutText, m_current.offset(),
1, font, m_width.currentWidth(), m_collapseWhiteSpace, &wordMeasurement.fallback
Fonts) + (applyWordSpacing ? wordSpacing : 0); |
667 // Check if line is too big even without the extra space | 667 // Check if line is too big even without the extra space |
668 // at the end of the line. If it is not, do nothing. | 668 // at the end of the line. If it is not, do nothing. |
669 // If the line needs the extra whitespace to be too long, | 669 // If the line needs the extra whitespace to be too long, |
670 // then move the line break to the space and skip all | 670 // then move the line break to the space and skip all |
671 // additional whitespace. | 671 // additional whitespace. |
672 if (!m_width.fitsOnLine(charWidth)) { | 672 if (!m_width.fitsOnLine(charWidth)) { |
673 lineWasTooWide = true; | 673 lineWasTooWide = true; |
674 m_lineBreak.moveTo(m_current.object(), m_current.offset(
), m_current.nextBreakablePosition()); | 674 m_lineBreak.moveTo(m_current.object(), m_current.offset(
), m_current.nextBreakablePosition()); |
675 skipTrailingWhitespace(m_lineBreak, m_lineInfo); | 675 skipTrailingWhitespace(m_lineBreak, m_lineInfo); |
676 } | 676 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 // new point. | 757 // new point. |
758 m_ignoringSpaces = false; | 758 m_ignoringSpaces = false; |
759 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; | 759 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; |
760 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement
s.last().width) ? wordSpacing : 0; | 760 wordSpacingForWordMeasurement = (applyWordSpacing && wordMeasurement
s.last().width) ? wordSpacing : 0; |
761 lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in
any of the ignored spaces. | 761 lastSpace = m_current.offset(); // e.g., "Foo goo", don't add in
any of the ignored spaces. |
762 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.o
bject(), m_current.offset())); | 762 m_lineMidpointState.stopIgnoringSpaces(InlineIterator(0, m_current.o
bject(), m_current.offset())); |
763 } | 763 } |
764 | 764 |
765 if (isSVGText && m_current.offset()) { | 765 if (isSVGText && m_current.offset()) { |
766 // Force creation of new InlineBoxes for each absolute positioned ch
aracter (those that start new text chunks). | 766 // Force creation of new InlineBoxes for each absolute positioned ch
aracter (those that start new text chunks). |
767 if (toLayoutSVGInlineText(renderText)->characterStartsNewTextChunk(m
_current.offset())) | 767 if (toLayoutSVGInlineText(layoutText)->characterStartsNewTextChunk(m
_current.offset())) |
768 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); | 768 m_lineMidpointState.ensureCharacterGetsLineBox(m_current); |
769 } | 769 } |
770 | 770 |
771 if (prohibitBreakInside) { | 771 if (prohibitBreakInside) { |
772 m_current.setNextBreakablePosition(renderText->textLength()); | 772 m_current.setNextBreakablePosition(layoutText->textLength()); |
773 prohibitBreakInside = false; | 773 prohibitBreakInside = false; |
774 } | 774 } |
775 | 775 |
776 if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { | 776 if (m_currentCharacterIsSpace && !previousCharacterIsSpace) { |
777 m_startOfIgnoredSpaces.setObject(m_current.object()); | 777 m_startOfIgnoredSpaces.setObject(m_current.object()); |
778 m_startOfIgnoredSpaces.setOffset(m_current.offset()); | 778 m_startOfIgnoredSpaces.setOffset(m_current.offset()); |
779 } | 779 } |
780 | 780 |
781 if (!m_currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWa
p) { | 781 if (!m_currentCharacterIsSpace && previousCharacterShouldCollapseIfPreWa
p) { |
782 if (m_autoWrap && m_currentStyle->breakOnlyAfterWhiteSpace()) | 782 if (m_autoWrap && m_currentStyle->breakOnlyAfterWhiteSpace()) |
783 m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_cur
rent.nextBreakablePosition()); | 783 m_lineBreak.moveTo(m_current.object(), m_current.offset(), m_cur
rent.nextBreakablePosition()); |
784 } | 784 } |
785 | 785 |
786 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && !m_ignoringSpac
es) | 786 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && !m_ignoringSpac
es) |
787 m_trailingObjects.setTrailingWhitespace(toLayoutText(m_current.objec
t())); | 787 m_trailingObjects.setTrailingWhitespace(toLayoutText(m_current.objec
t())); |
788 else if (!m_currentStyle->collapseWhiteSpace() || !m_currentCharacterIsS
pace) | 788 else if (!m_currentStyle->collapseWhiteSpace() || !m_currentCharacterIsS
pace) |
789 m_trailingObjects.clear(); | 789 m_trailingObjects.clear(); |
790 | 790 |
791 m_atStart = false; | 791 m_atStart = false; |
792 nextCharacter(c, lastCharacter, secondToLastCharacter); | 792 nextCharacter(c, lastCharacter, secondToLastCharacter); |
793 } | 793 } |
794 | 794 |
795 m_renderTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondTo
LastCharacter); | 795 m_renderTextInfo.m_lineBreakIterator.setPriorContext(lastCharacter, secondTo
LastCharacter); |
796 | 796 |
797 wordMeasurements.grow(wordMeasurements.size() + 1); | 797 wordMeasurements.grow(wordMeasurements.size() + 1); |
798 WordMeasurement& wordMeasurement = wordMeasurements.last(); | 798 WordMeasurement& wordMeasurement = wordMeasurements.last(); |
799 wordMeasurement.renderer = renderText; | 799 wordMeasurement.renderer = layoutText; |
800 | 800 |
801 // IMPORTANT: current.m_pos is > length here! | 801 // IMPORTANT: current.m_pos is > length here! |
802 float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(renderText, las
tSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapse
WhiteSpace, &wordMeasurement.fallbackFonts); | 802 float additionalTempWidth = m_ignoringSpaces ? 0 : textWidth(layoutText, las
tSpace, m_current.offset() - lastSpace, font, m_width.currentWidth(), m_collapse
WhiteSpace, &wordMeasurement.fallbackFonts); |
803 wordMeasurement.startOffset = lastSpace; | 803 wordMeasurement.startOffset = lastSpace; |
804 wordMeasurement.endOffset = m_current.offset(); | 804 wordMeasurement.endOffset = m_current.offset(); |
805 wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTempWidth + wordSpa
cingForWordMeasurement; | 805 wordMeasurement.width = m_ignoringSpaces ? 0 : additionalTempWidth + wordSpa
cingForWordMeasurement; |
806 additionalTempWidth += lastSpaceWordSpacing; | 806 additionalTempWidth += lastSpaceWordSpacing; |
807 | 807 |
808 LayoutUnit inlineLogicalTempWidth = inlineLogicalWidth(m_current.object(), !
m_appliedStartWidth, m_includeEndWidth); | 808 LayoutUnit inlineLogicalTempWidth = inlineLogicalWidth(m_current.object(), !
m_appliedStartWidth, m_includeEndWidth); |
809 m_width.addUncommittedWidth(additionalTempWidth + inlineLogicalTempWidth); | 809 m_width.addUncommittedWidth(additionalTempWidth + inlineLogicalTempWidth); |
810 | 810 |
811 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && additionalTempWidth
) | 811 if (m_collapseWhiteSpace && m_currentCharacterIsSpace && additionalTempWidth
) |
812 m_width.setTrailingWhitespaceWidth(additionalTempWidth + inlineLogicalTe
mpWidth); | 812 m_width.setTrailingWhitespaceWidth(additionalTempWidth + inlineLogicalTe
mpWidth); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 | 896 |
897 if (style.textIndentType() == TextIndentHanging) | 897 if (style.textIndentType() == TextIndentHanging) |
898 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 898 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
899 | 899 |
900 return shouldIndentText; | 900 return shouldIndentText; |
901 } | 901 } |
902 | 902 |
903 } | 903 } |
904 | 904 |
905 #endif // BreakingContextInlineHeaders_h | 905 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |