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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 504 |
505 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir
ection) | 505 ALWAYS_INLINE TextDirection textDirectionFromUnicode(WTF::Unicode::Direction dir
ection) |
506 { | 506 { |
507 return direction == WTF::Unicode::RightToLeft | 507 return direction == WTF::Unicode::RightToLeft |
508 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR; | 508 || direction == WTF::Unicode::RightToLeftArabic ? RTL : LTR; |
509 } | 509 } |
510 | 510 |
511 ALWAYS_INLINE float textWidth(LayoutText* text, unsigned from, unsigned len, con
st Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontData
*>* fallbackFonts = 0) | 511 ALWAYS_INLINE float textWidth(LayoutText* text, unsigned from, unsigned len, con
st Font& font, float xPos, bool collapseWhiteSpace, HashSet<const SimpleFontData
*>* fallbackFonts = 0) |
512 { | 512 { |
513 GlyphOverflow glyphOverflow; | 513 GlyphOverflow glyphOverflow; |
514 if ((!from && len == text->textLength()) || text->style()->hasTextCombine()) | 514 if ((!from && len == text->textLength()) || text->isCombineText()) |
515 return text->width(from, len, font, xPos, text->style()->direction(), fa
llbackFonts, &glyphOverflow); | 515 return text->width(from, len, font, xPos, text->style()->direction(), fa
llbackFonts, &glyphOverflow); |
516 | 516 |
517 TextRun run = constructTextRun(text, font, text, from, len, text->styleRef()
); | 517 TextRun run = constructTextRun(text, font, text, from, len, text->styleRef()
); |
518 run.setCodePath(text->canUseSimpleFontCodePath() ? TextRun::ForceSimple : Te
xtRun::ForceComplex); | 518 run.setCodePath(text->canUseSimpleFontCodePath() ? TextRun::ForceSimple : Te
xtRun::ForceComplex); |
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) |
(...skipping 21 matching lines...) Expand all Loading... |
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 keepAll = m_currentStyle->wordBreak() == KeepAllWordBreak && m_autoWrap
; |
556 bool prohibitBreakInside = m_currentStyle->hasTextCombine() && layoutText->i
sCombineText() && toLayoutTextCombine(layoutText)->isCombined(); | 556 bool prohibitBreakInside = layoutText->isCombineText() && toLayoutTextCombin
e(layoutText)->isCombined(); |
557 float hyphenWidth = 0; | 557 float hyphenWidth = 0; |
558 | 558 |
559 if (isSVGText) { | 559 if (isSVGText) { |
560 breakWords = false; | 560 breakWords = false; |
561 breakAll = false; | 561 breakAll = false; |
562 keepAll = false; | 562 keepAll = false; |
563 } | 563 } |
564 | 564 |
565 if (layoutText->isWordBreak()) { | 565 if (layoutText->isWordBreak()) { |
566 m_width.commit(); | 566 m_width.commit(); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 898 |
899 if (style.textIndentType() == TextIndentHanging) | 899 if (style.textIndentType() == TextIndentHanging) |
900 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; | 900 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In
dentText; |
901 | 901 |
902 return shouldIndentText; | 902 return shouldIndentText; |
903 } | 903 } |
904 | 904 |
905 } | 905 } |
906 | 906 |
907 #endif // BreakingContextInlineHeaders_h | 907 #endif // BreakingContextInlineHeaders_h |
OLD | NEW |