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

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

Issue 1838723002: Stop tracking trailing-space when we leave it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/fast/text/whitespace/nowrap-previous-trailing-space-expected.txt ('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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc tion())) + wordSpacing 605 font.width(constructTextRun(font, &spaceCharacter, 1, style, style.direc tion())) + wordSpacing
606 : 0; 606 : 0;
607 607
608 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter(); 608 UChar lastCharacter = m_layoutTextInfo.m_lineBreakIterator.lastCharacter();
609 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL astCharacter(); 609 UChar secondToLastCharacter = m_layoutTextInfo.m_lineBreakIterator.secondToL astCharacter();
610 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement InTextNode()) { 610 for (; m_current.offset() < layoutText.textLength(); m_current.fastIncrement InTextNode()) {
611 bool previousCharacterIsSpace = m_currentCharacterIsSpace; 611 bool previousCharacterIsSpace = m_currentCharacterIsSpace;
612 UChar c = m_current.current(); 612 UChar c = m_current.current();
613 m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharac ter || (!m_preservesNewline && (c == newlineCharacter)); 613 m_currentCharacterIsSpace = c == spaceCharacter || c == tabulationCharac ter || (!m_preservesNewline && (c == newlineCharacter));
614 614
615 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) 615 if (!m_collapseWhiteSpace || !m_currentCharacterIsSpace) {
616 m_lineInfo.setEmpty(false, m_block, &m_width); 616 m_lineInfo.setEmpty(false, m_block, &m_width);
617 m_width.setTrailingWhitespaceWidth(0);
618 }
617 619
618 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) { 620 if (c == softHyphenCharacter && m_autoWrap && !hyphenWidth) {
619 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode( m_resolver.position().direction())); 621 hyphenWidth = layoutText.hyphenWidth(font, textDirectionFromUnicode( m_resolver.position().direction()));
620 m_width.addUncommittedWidth(hyphenWidth); 622 m_width.addUncommittedWidth(hyphenWidth);
621 } 623 }
622 624
623 bool applyWordSpacing = false; 625 bool applyWordSpacing = false;
624 626
625 // Determine if we should try breaking in the middle of a word. 627 // Determine if we should try breaking in the middle of a word.
626 if (breakWords && !midWordBreak && !U16_IS_TRAIL(c)) { 628 if (breakWords && !midWordBreak && !U16_IS_TRAIL(c)) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 981
980 if (style.getTextIndentType() == TextIndentHanging) 982 if (style.getTextIndentType() == TextIndentHanging)
981 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 983 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
982 984
983 return indentText; 985 return indentText;
984 } 986 }
985 987
986 } // namespace blink 988 } // namespace blink
987 989
988 #endif // BreakingContextInlineHeaders_h 990 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/whitespace/nowrap-previous-trailing-space-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698