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

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

Issue 2564263002: Merge 2924: 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 StringView(text.text(), start, len), 879 StringView(text.text(), start, len),
880 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1); 880 std::min(maxPrefixLength, len - Hyphenation::minimumSuffixLength) + 1);
881 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength) 881 if (!prefixLength || prefixLength < Hyphenation::minimumPrefixLength)
882 return false; 882 return false;
883 883
884 // TODO(kojii): getCharacterRange() measures as if the word were not broken 884 // TODO(kojii): getCharacterRange() measures as if the word were not broken
885 // as defined in the spec, and is faster than measuring each fragment, but 885 // as defined in the spec, and is faster than measuring each fragment, but
886 // ignores the kerning between the last letter and the hyphen. 886 // ignores the kerning between the last letter and the hyphen.
887 return rewindToMidWordBreak( 887 return rewindToMidWordBreak(
888 wordMeasurement, start + prefixLength, 888 wordMeasurement, start + prefixLength,
889 font.getCharacterRange(run, 0, prefixLength).width() + hyphenWidth); 889 font.getCharacterRange(run, 0, prefixLength).width());
890 } 890 }
891 891
892 ALWAYS_INLINE bool BreakingContext::isBreakAtSoftHyphen() const { 892 ALWAYS_INLINE bool BreakingContext::isBreakAtSoftHyphen() const {
893 return m_lineBreak != m_resolver.position() 893 return m_lineBreak != m_resolver.position()
894 ? m_lineBreak.previousInSameNode() == softHyphenCharacter 894 ? m_lineBreak.previousInSameNode() == softHyphenCharacter
895 : m_current.previousInSameNode() == softHyphenCharacter; 895 : m_current.previousInSameNode() == softHyphenCharacter;
896 } 896 }
897 897
898 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements, 898 inline bool BreakingContext::handleText(WordMeasurements& wordMeasurements,
899 bool& hyphenated) { 899 bool& hyphenated) {
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 1521
1522 if (style.getTextIndentType() == TextIndentHanging) 1522 if (style.getTextIndentType() == TextIndentHanging)
1523 indentText = indentText == IndentText ? DoNotIndentText : IndentText; 1523 indentText = indentText == IndentText ? DoNotIndentText : IndentText;
1524 1524
1525 return indentText; 1525 return indentText;
1526 } 1526 }
1527 1527
1528 } // namespace blink 1528 } // namespace blink
1529 1529
1530 #endif // BreakingContextInlineHeaders_h 1530 #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