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

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

Issue 2548333004: Fix not to double count the widths of hyphens (Closed)
Patch Set: Created 4 years 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/hyphens/hyphens-align-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 * 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 StringView(text.text(), start, len), 885 StringView(text.text(), start, len),
886 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1); 886 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1);
887 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength) 887 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength)
888 return false; 888 return false;
889 889
890 // TODO(kojii): getCharacterRange() measures as if the word were not broken 890 // TODO(kojii): getCharacterRange() measures as if the word were not broken
891 // as defined in the spec, and is faster than measuring each fragment, but 891 // as defined in the spec, and is faster than measuring each fragment, but
892 // ignores the kerning between the last letter and the hyphen. 892 // ignores the kerning between the last letter and the hyphen.
893 return rewindToMidWordBreak( 893 return rewindToMidWordBreak(
894 wordMeasurement, start + prefixLength, 894 wordMeasurement, start + prefixLength,
895 font.getCharacterRange(run, 0, prefixLength).width() + hyphenWidth); 895 font.getCharacterRange(run, 0, prefixLength).width());
896 } 896 }
897 897
898 ALWAYS_INLINE bool BreakingContext::isBreakAtSoftHyphen() const { 898 ALWAYS_INLINE bool BreakingContext::isBreakAtSoftHyphen() const {
899 return m_lineBreak != m_resolver.position() 899 return m_lineBreak != m_resolver.position()
900 ? m_lineBreak.previousInSameNode() == softHyphenCharacter 900 ? m_lineBreak.previousInSameNode() == softHyphenCharacter
901 : m_current.previousInSameNode() == softHyphenCharacter; 901 : m_current.previousInSameNode() == softHyphenCharacter;
902 } 902 }
903 903
904 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, 904 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
905 bool& hyphenated) { 905 bool& hyphenated) {
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 1527
1528 if (style.getTextIndentType() == TextIndentHanging) 1528 if (style.getTextIndentType() == TextIndentHanging)
1529 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 1529 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
1530 1530
1531 return indentText; 1531 return indentText;
1532 } 1532 }
1533 1533
1534 } // namespace blink 1534 } // namespace blink
1535 1535
1536 #endif // BreakingContextInlineHeaders_h 1536 #endif // BreakingContextInlineHeaders_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/hyphens/hyphens-align-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698