 Chromium Code Reviews
 Chromium Code Reviews Issue 2020863002:
  Guard against invalid glyph shaping results  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 2020863002:
  Guard against invalid glyph shaping results  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 
| 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. | 
| 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 
| 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 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 | 760 | 
| 761 Vector<CharacterRange> Font::individualCharacterRanges(const TextRun& run) const | 761 Vector<CharacterRange> Font::individualCharacterRanges(const TextRun& run) const | 
| 762 { | 762 { | 
| 763 // TODO(pdr): Android is temporarily (crbug.com/577306) using the old simple | 763 // TODO(pdr): Android is temporarily (crbug.com/577306) using the old simple | 
| 764 // shaper and using the complex shaper here can show differences between | 764 // shaper and using the complex shaper here can show differences between | 
| 765 // the two shapers. This function is currently only called through SVG | 765 // the two shapers. This function is currently only called through SVG | 
| 766 // which now exclusively uses the complex shaper, so the primary difference | 766 // which now exclusively uses the complex shaper, so the primary difference | 
| 767 // will be improved shaping in SVG when compared to HTML. | 767 // will be improved shaping in SVG when compared to HTML. | 
| 768 FontCachePurgePreventer purgePreventer; | 768 FontCachePurgePreventer purgePreventer; | 
| 769 CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription)); | 769 CachingWordShaper shaper(m_fontFallbackList->shapeCache(m_fontDescription)); | 
| 770 return shaper.individualCharacterRanges(this, run); | 770 auto ranges = shaper.individualCharacterRanges(this, run); | 
| 771 DCHECK(ranges.size() == static_cast<unsigned>(run.length())); | |
| 
fs
2016/05/28 14:08:31
Nit: DCHECK_EQ?
 
pdr.
2016/05/28 22:58:15
Done (also have a followup to remove those unruly
 
fs
2016/05/29 14:35:55
Yeah, no one likes static cats...
 | |
| 772 return ranges; | |
| 771 } | 773 } | 
| 772 | 774 | 
| 773 float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFont Data*>* fallbackFonts, FloatRect* glyphBounds) const | 775 float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFont Data*>* fallbackFonts, FloatRect* glyphBounds) const | 
| 774 { | 776 { | 
| 775 SimpleShaper shaper(this, run, nullptr, fallbackFonts, glyphBounds); | 777 SimpleShaper shaper(this, run, nullptr, fallbackFonts, glyphBounds); | 
| 776 shaper.advance(run.length()); | 778 shaper.advance(run.length()); | 
| 777 return shaper.runWidthSoFar(); | 779 return shaper.runWidthSoFar(); | 
| 778 } | 780 } | 
| 779 | 781 | 
| 780 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to, bool accountForGlyphBounds) const | 782 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FloatPoint& point, int h, int from, int to, bool accountForGlyphBounds) const | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 { | 849 { | 
| 848 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 850 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); | 
| 849 } | 851 } | 
| 850 | 852 | 
| 851 bool Font::isFallbackValid() const | 853 bool Font::isFallbackValid() const | 
| 852 { | 854 { | 
| 853 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 855 return !m_fontFallbackList || m_fontFallbackList->isValid(); | 
| 854 } | 856 } | 
| 855 | 857 | 
| 856 } // namespace blink | 858 } // namespace blink | 
| OLD | NEW |