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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2007103003: Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove bad assert. Created 4 years, 6 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
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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 static float maxWordFragmentWidth(LayoutText* layoutText, 861 static float maxWordFragmentWidth(LayoutText* layoutText,
862 const ComputedStyle& style, const Font& font, TextDirection textDirection, 862 const ComputedStyle& style, const Font& font, TextDirection textDirection,
863 Hyphenation& hyphenation, unsigned wordOffset, unsigned wordLength, 863 Hyphenation& hyphenation, unsigned wordOffset, unsigned wordLength,
864 int& suffixStart) 864 int& suffixStart)
865 { 865 {
866 suffixStart = 0; 866 suffixStart = 0;
867 if (wordLength <= Hyphenation::minimumSuffixLength) 867 if (wordLength <= Hyphenation::minimumSuffixLength)
868 return 0; 868 return 0;
869 869
870 Vector<size_t, 8> hyphenLocations = hyphenation.hyphenLocations( 870 Vector<size_t, 8> hyphenLocations = hyphenation.hyphenLocations(
871 layoutText->text().createView(wordOffset, wordLength)); 871 StringView(layoutText->text(), wordOffset, wordLength));
872 if (hyphenLocations.isEmpty()) 872 if (hyphenLocations.isEmpty())
873 return 0; 873 return 0;
874 874
875 float minimumFragmentWidthToConsider = Hyphenation::minimumPrefixWidth(font) ; 875 float minimumFragmentWidthToConsider = Hyphenation::minimumPrefixWidth(font) ;
876 float maxFragmentWidth = 0; 876 float maxFragmentWidth = 0;
877 TextRun run = constructTextRun(font, layoutText, wordOffset, wordLength, sty le, textDirection); 877 TextRun run = constructTextRun(font, layoutText, wordOffset, wordLength, sty le, textDirection);
878 size_t end = wordLength; 878 size_t end = wordLength;
879 for (size_t start : hyphenLocations) { 879 for (size_t start : hyphenLocations) {
880 float fragmentWidth = font.getCharacterRange(run, start, end).width(); 880 float fragmentWidth = font.getCharacterRange(run, start, end).width();
881 881
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1750 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1750 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1751 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1751 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1752 if (box->truncation() != cNoTruncation) { 1752 if (box->truncation() != cNoTruncation) {
1753 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1753 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1754 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason); 1754 paintInvalidationContainer.invalidateDisplayItemClientOnBacking( *ellipsisBox, invalidationReason);
1755 } 1755 }
1756 } 1756 }
1757 } 1757 }
1758 1758
1759 } // namespace blink 1759 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698