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

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

Issue 2713553007: Merge 2987: Fix hyphenated words not to overflow on Android (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | third_party/WebKit/Source/platform/BUILD.gn » ('j') | 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. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
4 * All right reserved. 4 * All right reserved.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * Copyright (C) 2013 Adobe Systems Incorporated. 6 * Copyright (C) 2013 Adobe Systems Incorporated.
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 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 TextRun run = constructTextRun(font, text, start, len, style); 883 TextRun run = constructTextRun(font, text, start, len, style);
884 run.setTabSize(!m_collapseWhiteSpace, style.getTabSize()); 884 run.setTabSize(!m_collapseWhiteSpace, style.getTabSize());
885 run.setXPos(m_width.currentWidth()); 885 run.setXPos(m_width.currentWidth());
886 unsigned maxPrefixLength = font.offsetForPosition(run, maxPrefixWidth, false); 886 unsigned maxPrefixLength = font.offsetForPosition(run, maxPrefixWidth, false);
887 if (maxPrefixLength < Hyphenation::minimumPrefixLength) 887 if (maxPrefixLength < Hyphenation::minimumPrefixLength)
888 return false; 888 return false;
889 889
890 unsigned prefixLength = hyphenation.lastHyphenLocation( 890 unsigned prefixLength = hyphenation.lastHyphenLocation(
891 StringView(text.text(), start, len), 891 StringView(text.text(), start, len),
892 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1); 892 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1);
893 DCHECK_LE(prefixLength, maxPrefixLength);
893 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength) 894 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength)
894 return false; 895 return false;
895 896
896 // TODO(kojii): getCharacterRange() measures as if the word were not broken 897 // TODO(kojii): getCharacterRange() measures as if the word were not broken
897 // as defined in the spec, and is faster than measuring each fragment, but 898 // as defined in the spec, and is faster than measuring each fragment, but
898 // ignores the kerning between the last letter and the hyphen. 899 // ignores the kerning between the last letter and the hyphen.
899 return rewindToMidWordBreak( 900 return rewindToMidWordBreak(
900 wordMeasurement, start + prefixLength, 901 wordMeasurement, start + prefixLength,
901 font.getCharacterRange(run, 0, prefixLength).width()); 902 font.getCharacterRange(run, 0, prefixLength).width());
902 } 903 }
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 1543
1543 if (style.getTextIndentType() == TextIndentHanging) 1544 if (style.getTextIndentType() == TextIndentHanging)
1544 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 1545 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
1545 1546
1546 return indentText; 1547 return indentText;
1547 } 1548 }
1548 1549
1549 } // namespace blink 1550 } // namespace blink
1550 1551
1551 #endif // BreakingContextInlineHeaders_h 1552 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698