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

Side by Side Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 1108663003: Always initialize |m_totalWidth| in HarfBuzzShaper::shape. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Initialize in ctor Created 5 years, 8 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
« no previous file with comments | « LayoutTests/fast/text/shaping/shaping-width-initialized-expected.txt ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. 3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, const Glyph Data* emphasisData, 379 HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run, const Glyph Data* emphasisData,
380 HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* bounds) 380 HashSet<const SimpleFontData*>* fallbackFonts, FloatRect* bounds)
381 : Shaper(font, run, emphasisData, fallbackFonts, bounds) 381 : Shaper(font, run, emphasisData, fallbackFonts, bounds)
382 , m_normalizedBufferLength(0) 382 , m_normalizedBufferLength(0)
383 , m_wordSpacingAdjustment(font->fontDescription().wordSpacing()) 383 , m_wordSpacingAdjustment(font->fontDescription().wordSpacing())
384 , m_letterSpacing(font->fontDescription().letterSpacing()) 384 , m_letterSpacing(font->fontDescription().letterSpacing())
385 , m_expansionOpportunityCount(0) 385 , m_expansionOpportunityCount(0)
386 , m_fromIndex(0) 386 , m_fromIndex(0)
387 , m_toIndex(m_run.length()) 387 , m_toIndex(m_run.length())
388 , m_totalWidth(0)
388 { 389 {
389 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); 390 m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]);
390 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm alizedBufferLength); 391 normalizeCharacters(m_run, m_run.length(), m_normalizedBuffer.get(), &m_norm alizedBufferLength);
391 setExpansion(m_run.expansion()); 392 setExpansion(m_run.expansion());
392 setFontFeatures(); 393 setFontFeatures();
393 } 394 }
394 395
395 float HarfBuzzShaper::nextExpansionPerOpportunity() 396 float HarfBuzzShaper::nextExpansionPerOpportunity()
396 { 397 {
397 if (!m_expansionOpportunityCount) { 398 if (!m_expansionOpportunityCount) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]); 532 feature.tag = HB_TAG(tag[0], tag[1], tag[2], tag[3]);
532 feature.value = settings->at(i).value(); 533 feature.value = settings->at(i).value();
533 feature.start = 0; 534 feature.start = 0;
534 feature.end = static_cast<unsigned>(-1); 535 feature.end = static_cast<unsigned>(-1);
535 m_features.append(feature); 536 m_features.append(feature);
536 } 537 }
537 } 538 }
538 539
539 bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer) 540 bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer)
540 { 541 {
542 m_totalWidth = 0;
leviw_travelin_and_unemployed 2015/04/27 18:19:35 This should be redundant now that it's in the c'to
541 if (!createHarfBuzzRuns()) 543 if (!createHarfBuzzRuns())
542 return false; 544 return false;
543 545
544 m_totalWidth = 0;
545 if (!shapeHarfBuzzRuns()) 546 if (!shapeHarfBuzzRuns())
546 return false; 547 return false;
547 548
548 if (glyphBuffer && !fillGlyphBuffer(glyphBuffer)) 549 if (glyphBuffer && !fillGlyphBuffer(glyphBuffer))
549 return false; 550 return false;
550 551
551 return true; 552 return true;
552 } 553 }
553 554
554 struct CandidateRun { 555 struct CandidateRun {
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 // possibly invalid from, to arguments. 1207 // possibly invalid from, to arguments.
1207 if (!foundToX && !foundFromX) 1208 if (!foundToX && !foundFromX)
1208 fromX = toX = 0; 1209 fromX = toX = 0;
1209 1210
1210 if (fromX < toX) 1211 if (fromX < toX)
1211 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); 1212 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height);
1212 return FloatRect(point.x() + toX, point.y(), fromX - toX, height); 1213 return FloatRect(point.x() + toX, point.y(), fromX - toX, height);
1213 } 1214 }
1214 1215
1215 } // namespace blink 1216 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/shaping/shaping-width-initialized-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698