| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 public: | 66 public: |
| 67 static const size_t size = 256; // Usually covers Latin-1 in a single page. | 67 static const size_t size = 256; // Usually covers Latin-1 in a single page. |
| 68 GlyphMetricsPage() {} | 68 GlyphMetricsPage() {} |
| 69 | 69 |
| 70 T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } | 70 T metricsForGlyph(Glyph glyph) const { return m_metrics[glyph % size]; } |
| 71 void setMetricsForGlyph(Glyph glyph, const T& metrics) { | 71 void setMetricsForGlyph(Glyph glyph, const T& metrics) { |
| 72 setMetricsForIndex(glyph % size, metrics); | 72 setMetricsForIndex(glyph % size, metrics); |
| 73 } | 73 } |
| 74 void setMetricsForIndex(unsigned index, const T& metrics) { | 74 void setMetricsForIndex(unsigned index, const T& metrics) { |
| 75 ASSERT_WITH_SECURITY_IMPLICATION(index < size); | 75 SECURITY_DCHECK(index < size); |
| 76 m_metrics[index] = metrics; | 76 m_metrics[index] = metrics; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 T m_metrics[size]; | 80 T m_metrics[size]; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 GlyphMetricsPage* locatePage(unsigned pageNumber) { | 83 GlyphMetricsPage* locatePage(unsigned pageNumber) { |
| 84 if (!pageNumber && m_filledPrimaryPage) | 84 if (!pageNumber && m_filledPrimaryPage) |
| 85 return &m_primaryPage; | 85 return &m_primaryPage; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Fill in the whole page with the unknown glyph information. | 129 // Fill in the whole page with the unknown glyph information. |
| 130 for (unsigned i = 0; i < GlyphMetricsPage::size; i++) | 130 for (unsigned i = 0; i < GlyphMetricsPage::size; i++) |
| 131 page->setMetricsForIndex(i, unknownMetrics()); | 131 page->setMetricsForIndex(i, unknownMetrics()); |
| 132 | 132 |
| 133 return page; | 133 return page; |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| 137 | 137 |
| 138 #endif | 138 #endif |
| OLD | NEW |