Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h

Issue 1575333002: Fix word-wrap: break-word with fit-content not to break surrogate pairs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test was upstreamed Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 m_lineInfo.setEmpty(false, m_block, &m_width); 617 m_lineInfo.setEmpty(false, m_block, &m_width);
618 618
619 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) { 619 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) {
620 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode( m_resolver.position().direction())); 620 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode( m_resolver.position().direction()));
621 m_width.addUncommittedWidth(hyphenWidth); 621 m_width.addUncommittedWidth(hyphenWidth);
622 } 622 }
623 623
624 bool applyWordSpacing = false; 624 bool applyWordSpacing = false;
625 625
626 // Determine if we should try breaking in the middle of a word. 626 // Determine if we should try breaking in the middle of a word.
627 if (breakWords && !midWordBreak) { 627 if (breakWords && !midWordBreak && !U16_IS_TRAIL(c)) {
628 widthFromLastBreakingOpportunity += charWidth; 628 widthFromLastBreakingOpportunity += charWidth;
629 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current .offset() + 1 < layoutText.textLength() && U16_IS_TRAIL(layoutText.uncheckedChar acterAt(m_current.offset() + 1)); 629 bool midWordBreakIsBeforeSurrogatePair = U16_IS_LEAD(c) && m_current .offset() + 1 < layoutText.textLength() && U16_IS_TRAIL(layoutText.uncheckedChar acterAt(m_current.offset() + 1));
630 charWidth = textWidth(layoutText, m_current.offset(), midWordBreakIs BeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + widthFromLastBreak ingOpportunity, m_collapseWhiteSpace); 630 charWidth = textWidth(layoutText, m_current.offset(), midWordBreakIs BeforeSurrogatePair ? 2 : 1, font, m_width.committedWidth() + widthFromLastBreak ingOpportunity, m_collapseWhiteSpace);
631 midWordBreak = m_width.committedWidth() + widthFromLastBreakingOppor tunity + charWidth > m_width.availableWidth(); 631 midWordBreak = m_width.committedWidth() + widthFromLastBreakingOppor tunity + charWidth > m_width.availableWidth();
632 } 632 }
633 633
634 // Determine if we are in the whitespace between words. 634 // Determine if we are in the whitespace between words.
635 int nextBreakablePosition = m_current.nextBreakablePosition(); 635 int nextBreakablePosition = m_current.nextBreakablePosition();
636 bool betweenWords = c == newlineCharacter || (m_currWS != PRE && !m_atSt art && m_layoutTextInfo.m_lineBreakIterator.isBreakable(m_current.offset(), next BreakablePosition, breakAll ? LineBreakType::BreakAll : keepAll ? LineBreakType: :KeepAll : LineBreakType::Normal)); 636 bool betweenWords = c == newlineCharacter || (m_currWS != PRE && !m_atSt art && m_layoutTextInfo.m_lineBreakIterator.isBreakable(m_current.offset(), next BreakablePosition, breakAll ? LineBreakType::BreakAll : keepAll ? LineBreakType: :KeepAll : LineBreakType::Normal));
637 m_current.setNextBreakablePosition(nextBreakablePosition); 637 m_current.setNextBreakablePosition(nextBreakablePosition);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 980
981 if (style.textIndentType() == TextIndentHanging) 981 if (style.textIndentType() == TextIndentHanging)
982 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText; 982 shouldIndentText = shouldIndentText == IndentText ? DoNotIndentText : In dentText;
983 983
984 return shouldIndentText; 984 return shouldIndentText;
985 } 985 }
986 986
987 } 987 }
988 988
989 #endif // BreakingContextInlineHeaders_h 989 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698