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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutListMarker.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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 m_text = ListMarkerText::text(style()->listStyleType(), m_listItem->valu e()); 196 m_text = ListMarkerText::text(style()->listStyleType(), m_listItem->valu e());
197 break; 197 break;
198 } 198 }
199 } 199 }
200 200
201 LayoutUnit LayoutListMarker::getWidthOfTextWithSuffix() const 201 LayoutUnit LayoutListMarker::getWidthOfTextWithSuffix() const
202 { 202 {
203 if (m_text.isEmpty()) 203 if (m_text.isEmpty())
204 return LayoutUnit(); 204 return LayoutUnit();
205 const Font& font = style()->font(); 205 const Font& font = style()->font();
206 LayoutUnit itemWidth = LayoutUnit(font.width(m_text)); 206 LayoutUnit itemWidth = LayoutUnit(font.width(TextRun(m_text)));
207 // TODO(wkorman): Look into constructing a text run for both text and suffix 207 // TODO(wkorman): Look into constructing a text run for both text and suffix
208 // and painting them together. 208 // and painting them together.
209 UChar suffix[2] = { ListMarkerText::suffix(style()->listStyleType(), m_listI tem->value()), ' ' }; 209 UChar suffix[2] = { ListMarkerText::suffix(style()->listStyleType(), m_listI tem->value()), ' ' };
210 TextRun run = constructTextRun(font, suffix, 2, styleRef(), style()->directi on()); 210 TextRun run = constructTextRun(font, suffix, 2, styleRef(), style()->directi on());
211 LayoutUnit suffixSpaceWidth = LayoutUnit(font.width(run)); 211 LayoutUnit suffixSpaceWidth = LayoutUnit(font.width(run));
212 return itemWidth + suffixSpaceWidth; 212 return itemWidth + suffixSpaceWidth;
213 } 213 }
214 214
215 void LayoutListMarker::computePreferredLogicalWidths() 215 void LayoutListMarker::computePreferredLogicalWidths()
216 { 216 {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (style()) { 447 if (style()) {
448 // Reuse the current margins. Otherwise resetting the margins to initial values 448 // Reuse the current margins. Otherwise resetting the margins to initial values
449 // would trigger unnecessary layout. 449 // would trigger unnecessary layout.
450 newStyle->setMarginStart(style()->marginStart()); 450 newStyle->setMarginStart(style()->marginStart());
451 newStyle->setMarginEnd(style()->marginRight()); 451 newStyle->setMarginEnd(style()->marginRight());
452 } 452 }
453 setStyle(newStyle.release()); 453 setStyle(newStyle.release());
454 } 454 }
455 455
456 } // namespace blink 456 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLSrcsetParser.h ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698