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

Side by Side Diff: Source/core/rendering/RenderText.cpp

Issue 721433002: Take text path into account when stripping spaces (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years, 1 month 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 | « LayoutTests/fast/text/international/complex-text-leading-space-wrapping-expected.html ('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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 801
802 hasBreakableChar = m_hasBreakableChar; 802 hasBreakableChar = m_hasBreakableChar;
803 hasBreak = m_hasBreak; 803 hasBreak = m_hasBreak;
804 804
805 ASSERT(m_text); 805 ASSERT(m_text);
806 StringImpl& text = *m_text.impl(); 806 StringImpl& text = *m_text.impl();
807 if (text[0] == space || (text[0] == newlineCharacter && !style()->preserveNe wline()) || text[0] == characterTabulation) { 807 if (text[0] == space || (text[0] == newlineCharacter && !style()->preserveNe wline()) || text[0] == characterTabulation) {
808 const Font& font = style()->font(); // FIXME: This ignores first-line. 808 const Font& font = style()->font(); // FIXME: This ignores first-line.
809 if (stripFrontSpaces) { 809 if (stripFrontSpaces) {
810 const UChar spaceChar = space; 810 const UChar spaceChar = space;
811 float spaceWidth = font.width(constructTextRun(this, font, &spaceCha r, 1, style(), direction)); 811 TextRun run = constructTextRun(this, font, &spaceChar, 1, style(), d irection);
812 run.setUseComplexCodePath(!canUseSimpleFontCodePath());
813 float spaceWidth = font.width(run);
812 maxWidth -= spaceWidth; 814 maxWidth -= spaceWidth;
813 } else { 815 } else {
814 maxWidth += font.fontDescription().wordSpacing(); 816 maxWidth += font.fontDescription().wordSpacing();
815 } 817 }
816 } 818 }
817 819
818 stripFrontSpaces = collapseWhiteSpace && m_hasEndWhiteSpace; 820 stripFrontSpaces = collapseWhiteSpace && m_hasEndWhiteSpace;
819 821
820 if (!style()->autoWrap() || minWidth > maxWidth) 822 if (!style()->autoWrap() || minWidth > maxWidth)
821 minWidth = maxWidth; 823 minWidth = maxWidth;
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 } 1863 }
1862 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1864 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1863 } 1865 }
1864 1866
1865 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1867 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1866 { 1868 {
1867 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1869 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1868 } 1870 }
1869 1871
1870 } // namespace blink 1872 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/international/complex-text-leading-space-wrapping-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698