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

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

Issue 1743803002: Rename enums/functions that collide in chromium style in core/style/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-8
Patch Set: get-names-9: rebase Created 4 years, 9 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) 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // WebKit uses this to justify text. 148 // WebKit uses this to justify text.
149 void HarfBuzzShaper::setExpansion(float padding) 149 void HarfBuzzShaper::setExpansion(float padding)
150 { 150 {
151 m_expansion = padding; 151 m_expansion = padding;
152 if (!m_expansion) 152 if (!m_expansion)
153 return; 153 return;
154 154
155 // If we have padding to distribute, then we try to give an equal 155 // If we have padding to distribute, then we try to give an equal
156 // amount to each expansion opportunity. 156 // amount to each expansion opportunity.
157 bool isAfterExpansion = m_isAfterExpansion; 157 bool isAfterExpansion = m_isAfterExpansion;
158 m_expansionOpportunityCount = Character::expansionOpportunityCount(m_normali zedBuffer.get(), m_normalizedBufferLength, m_textRun.direction(), isAfterExpansi on, m_textRun.textJustify()); 158 m_expansionOpportunityCount = Character::expansionOpportunityCount(m_normali zedBuffer.get(), m_normalizedBufferLength, m_textRun.direction(), isAfterExpansi on, m_textRun.getTextJustify());
159 if (isAfterExpansion && !m_textRun.allowsTrailingExpansion()) { 159 if (isAfterExpansion && !m_textRun.allowsTrailingExpansion()) {
160 ASSERT(m_expansionOpportunityCount > 0); 160 ASSERT(m_expansionOpportunityCount > 0);
161 --m_expansionOpportunityCount; 161 --m_expansionOpportunityCount;
162 } 162 }
163 163
164 if (m_expansionOpportunityCount) 164 if (m_expansionOpportunityCount)
165 m_expansionPerOpportunity = m_expansion / m_expansionOpportunityCount; 165 m_expansionPerOpportunity = m_expansion / m_expansionOpportunityCount;
166 else 166 else
167 m_expansionPerOpportunity = 0; 167 m_expansionPerOpportunity = 0;
168 } 168 }
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 const TextRun& textRun, float positionOffset, unsigned count) 723 const TextRun& textRun, float positionOffset, unsigned count)
724 { 724 {
725 const SimpleFontData* fontData = font->primaryFont(); 725 const SimpleFontData* fontData = font->primaryFont();
726 OwnPtr<ShapeResult::RunInfo> run = adoptPtr(new ShapeResult::RunInfo(fontDat a, 726 OwnPtr<ShapeResult::RunInfo> run = adoptPtr(new ShapeResult::RunInfo(fontDat a,
727 // Tab characters are always LTR or RTL, not TTB, even when isVerticalAn yUpright(). 727 // Tab characters are always LTR or RTL, not TTB, even when isVerticalAn yUpright().
728 textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR, 728 textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR,
729 HB_SCRIPT_COMMON, 0, count, count)); 729 HB_SCRIPT_COMMON, 0, count, count));
730 float position = textRun.xPos() + positionOffset; 730 float position = textRun.xPos() + positionOffset;
731 float startPosition = position; 731 float startPosition = position;
732 for (unsigned i = 0; i < count; i++) { 732 for (unsigned i = 0; i < count; i++) {
733 float advance = font->tabWidth(*fontData, textRun.tabSize(), position); 733 float advance = font->tabWidth(*fontData, textRun.getTabSize(), position );
734 run->m_glyphData[i].characterIndex = i; 734 run->m_glyphData[i].characterIndex = i;
735 run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0); 735 run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0);
736 position += advance; 736 position += advance;
737 } 737 }
738 run->m_width = position - startPosition; 738 run->m_width = position - startPosition;
739 739
740 RefPtr<ShapeResult> result = ShapeResult::create(font, count, textRun.direct ion()); 740 RefPtr<ShapeResult> result = ShapeResult::create(font, count, textRun.direct ion());
741 result->m_width = run->m_width; 741 result->m_width = run->m_width;
742 result->m_numGlyphs = count; 742 result->m_numGlyphs = count;
743 ASSERT(result->m_numGlyphs == count); // no overflow 743 ASSERT(result->m_numGlyphs == count); // no overflow
(...skipping 15 matching lines...) Expand all
759 759
760 if (!m_expansionOpportunityCount) 760 if (!m_expansionOpportunityCount)
761 return spacing; 761 return spacing;
762 762
763 if (treatAsSpace) { 763 if (treatAsSpace) {
764 spacing += nextExpansionPerOpportunity(); 764 spacing += nextExpansionPerOpportunity();
765 m_isAfterExpansion = true; 765 m_isAfterExpansion = true;
766 return spacing; 766 return spacing;
767 } 767 }
768 768
769 if (m_textRun.textJustify() != TextJustify::TextJustifyAuto) { 769 if (m_textRun.getTextJustify() != TextJustify::TextJustifyAuto) {
770 m_isAfterExpansion = false; 770 m_isAfterExpansion = false;
771 return spacing; 771 return spacing;
772 } 772 }
773 773
774 // isCJKIdeographOrSymbol() has expansion opportunities both before and afte r each character. 774 // isCJKIdeographOrSymbol() has expansion opportunities both before and afte r each character.
775 // http://www.w3.org/TR/jlreq/#line_adjustment 775 // http://www.w3.org/TR/jlreq/#line_adjustment
776 if (U16_IS_LEAD(character) && currentCharacterIndex + 1 < m_normalizedBuffer Length && U16_IS_TRAIL(m_normalizedBuffer[currentCharacterIndex + 1])) 776 if (U16_IS_LEAD(character) && currentCharacterIndex + 1 < m_normalizedBuffer Length && U16_IS_TRAIL(m_normalizedBuffer[currentCharacterIndex + 1]))
777 character = U16_GET_SUPPLEMENTARY(character, m_normalizedBuffer[currentC haracterIndex + 1]); 777 character = U16_GET_SUPPLEMENTARY(character, m_normalizedBuffer[currentC haracterIndex + 1]);
778 if (!Character::isCJKIdeographOrSymbol(character)) { 778 if (!Character::isCJKIdeographOrSymbol(character)) {
779 m_isAfterExpansion = false; 779 m_isAfterExpansion = false;
(...skipping 17 matching lines...) Expand all
797 } 797 }
798 798
799 // Don't need to check m_textRun.allowsTrailingExpansion() since it's covere d by !m_expansionOpportunityCount above 799 // Don't need to check m_textRun.allowsTrailingExpansion() since it's covere d by !m_expansionOpportunityCount above
800 spacing += nextExpansionPerOpportunity(); 800 spacing += nextExpansionPerOpportunity();
801 m_isAfterExpansion = true; 801 m_isAfterExpansion = true;
802 return spacing; 802 return spacing;
803 } 803 }
804 804
805 805
806 } // namespace blink 806 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698