| 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 keepAll = m_currentStyle->wordBreak() == KeepAllWordBreak && m_autoWrap
; |
| 555 bool prohibitBreakInside = m_currentStyle->hasTextCombine() && layoutText->i
sCombineText() && toLayoutTextCombine(layoutText)->isCombined(); | 556 bool prohibitBreakInside = m_currentStyle->hasTextCombine() && layoutText->i
sCombineText() && toLayoutTextCombine(layoutText)->isCombined(); |
| 556 float hyphenWidth = 0; | 557 float hyphenWidth = 0; |
| 557 | 558 |
| 558 if (isSVGText) { | 559 if (isSVGText) { |
| 559 breakWords = false; | 560 breakWords = false; |
| 560 breakAll = false; | 561 breakAll = false; |
| 562 keepAll = false; |
| 561 } | 563 } |
| 562 | 564 |
| 563 if (layoutText->isWordBreak()) { | 565 if (layoutText->isWordBreak()) { |
| 564 m_width.commit(); | 566 m_width.commit(); |
| 565 m_lineBreak.moveToStartOf(m_current.object()); | 567 m_lineBreak.moveToStartOf(m_current.object()); |
| 566 ASSERT(m_current.offset() == layoutText->textLength()); | 568 ASSERT(m_current.offset() == layoutText->textLength()); |
| 567 } | 569 } |
| 568 | 570 |
| 569 if (m_renderTextInfo.m_text != layoutText) { | 571 if (m_renderTextInfo.m_text != layoutText) { |
| 570 m_renderTextInfo.m_text = layoutText; | 572 m_renderTextInfo.m_text = layoutText; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 599 bool applyWordSpacing = false; | 601 bool applyWordSpacing = false; |
| 600 | 602 |
| 601 if (breakWords && !midWordBreak) { | 603 if (breakWords && !midWordBreak) { |
| 602 wrapW += charWidth; | 604 wrapW += charWidth; |
| 603 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current
.offset() + 1 < layoutText->textLength() && U16_IS_TRAIL((*layoutText)[m_current
.offset() + 1]); | 605 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current
.offset() + 1 < layoutText->textLength() && U16_IS_TRAIL((*layoutText)[m_current
.offset() + 1]); |
| 604 charWidth = textWidth(layoutText, m_current.offset(), midWordBreakIs
BeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + wrapW, m_collapseW
hiteSpace); | 606 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(); | 607 midWordBreak = m_width.committedWidth() + wrapW + charWidth > m_widt
h.availableWidth(); |
| 606 } | 608 } |
| 607 | 609 |
| 608 int nextBreakablePosition = m_current.nextBreakablePosition(); | 610 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)); | 611 bool betweenWords = c == '\n' || (m_currWS != PRE && !m_atStart && m_ren
derTextInfo.m_lineBreakIterator.isBreakable(m_current.offset(), nextBreakablePos
ition, breakAll ? LineBreakType::BreakAll : keepAll ? LineBreakType::KeepAll : L
ineBreakType::Normal)); |
| 610 m_current.setNextBreakablePosition(nextBreakablePosition); | 612 m_current.setNextBreakablePosition(nextBreakablePosition); |
| 611 | 613 |
| 612 if (betweenWords || midWordBreak) { | 614 if (betweenWords || midWordBreak) { |
| 613 bool stoppedIgnoringSpaces = false; | 615 bool stoppedIgnoringSpaces = false; |
| 614 if (m_ignoringSpaces) { | 616 if (m_ignoringSpaces) { |
| 615 lastSpaceWordSpacing = 0; | 617 lastSpaceWordSpacing = 0; |
| 616 if (!m_currentCharacterIsSpace) { | 618 if (!m_currentCharacterIsSpace) { |
| 617 // Stop ignoring spaces and begin at this | 619 // Stop ignoring spaces and begin at this |
| 618 // new point. | 620 // new point. |
| 619 m_ignoringSpaces = false; | 621 m_ignoringSpaces = false; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 | 898 |
| 897 if (style.textIndentType() == TextIndentHanging) | 899 if (style.textIndentType() == TextIndentHanging) |
| 898 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 900 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
| 899 | 901 |
| 900 return shouldIndentText; | 902 return shouldIndentText; |
| 901 } | 903 } |
| 902 | 904 |
| 903 } | 905 } |
| 904 | 906 |
| 905 #endif // BreakingContextInlineHeaders_h | 907 #endif // BreakingContextInlineHeaders_h |
| OLD | NEW |