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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2017303002: Revert of Remove StringBuilder::appendLiteral. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 String CanvasRenderingContext2D::font() const 419 String CanvasRenderingContext2D::font() const
420 { 420 {
421 if (!state().hasRealizedFont()) 421 if (!state().hasRealizedFont())
422 return defaultFont; 422 return defaultFont;
423 423
424 canvas()->document().canvasFontCache()->willUseCurrentFont(); 424 canvas()->document().canvasFontCache()->willUseCurrentFont();
425 StringBuilder serializedFont; 425 StringBuilder serializedFont;
426 const FontDescription& fontDescription = state().font().getFontDescription() ; 426 const FontDescription& fontDescription = state().font().getFontDescription() ;
427 427
428 if (fontDescription.style() == FontStyleItalic) 428 if (fontDescription.style() == FontStyleItalic)
429 serializedFont.append("italic "); 429 serializedFont.appendLiteral("italic ");
430 if (fontDescription.weight() == FontWeightBold) 430 if (fontDescription.weight() == FontWeightBold)
431 serializedFont.append("bold "); 431 serializedFont.appendLiteral("bold ");
432 if (fontDescription.variantCaps() == FontDescription::SmallCaps) 432 if (fontDescription.variantCaps() == FontDescription::SmallCaps)
433 serializedFont.append("small-caps "); 433 serializedFont.appendLiteral("small-caps ");
434 434
435 serializedFont.appendNumber(fontDescription.computedPixelSize()); 435 serializedFont.appendNumber(fontDescription.computedPixelSize());
436 serializedFont.append("px"); 436 serializedFont.appendLiteral("px");
437 437
438 const FontFamily& firstFontFamily = fontDescription.family(); 438 const FontFamily& firstFontFamily = fontDescription.family();
439 for (const FontFamily* fontFamily = &firstFontFamily; fontFamily; fontFamily = fontFamily->next()) { 439 for (const FontFamily* fontFamily = &firstFontFamily; fontFamily; fontFamily = fontFamily->next()) {
440 if (fontFamily != &firstFontFamily) 440 if (fontFamily != &firstFontFamily)
441 serializedFont.append(','); 441 serializedFont.append(',');
442 442
443 // FIXME: We should append family directly to serializedFont rather than building a temporary string. 443 // FIXME: We should append family directly to serializedFont rather than building a temporary string.
444 String family = fontFamily->family(); 444 String family = fontFamily->family();
445 if (family.startsWith("-webkit-")) 445 if (family.startsWith("-webkit-"))
446 family = family.substring(8); 446 family = family.substring(8);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 1060
1061 unsigned CanvasRenderingContext2D::hitRegionsCount() const 1061 unsigned CanvasRenderingContext2D::hitRegionsCount() const
1062 { 1062 {
1063 if (m_hitRegionManager) 1063 if (m_hitRegionManager)
1064 return m_hitRegionManager->getHitRegionsCount(); 1064 return m_hitRegionManager->getHitRegionsCount();
1065 1065
1066 return 0; 1066 return 0;
1067 } 1067 }
1068 1068
1069 } // namespace blink 1069 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698