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

Side by Side Diff: Source/core/rendering/RenderCombineText.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 float emWidth = description.computedSize() * textCombineMargin; 108 float emWidth = description.computedSize() * textCombineMargin;
109 bool shouldUpdateFont = false; 109 bool shouldUpdateFont = false;
110 110
111 description.setOrientation(Horizontal); // We are going to draw combined tex t horizontally. 111 description.setOrientation(Horizontal); // We are going to draw combined tex t horizontally.
112 m_combinedTextWidth = originalFont().width(run); 112 m_combinedTextWidth = originalFont().width(run);
113 m_isCombined = m_combinedTextWidth <= emWidth; 113 m_isCombined = m_combinedTextWidth <= emWidth;
114 114
115 FontSelector* fontSelector = style()->font().fontSelector(); 115 FontSelector* fontSelector = style()->font().fontSelector();
116 116
117 if (m_isCombined) 117 if (m_isCombined)
118 shouldUpdateFont = style()->setFontDescription(description); // Need to change font orientation to horizontal. 118 shouldUpdateFont = deprecatedMutableStyle()->setFontDescription(descript ion); // Need to change font orientation to horizontal.
119 else { 119 else {
120 // Need to try compressed glyphs. 120 // Need to try compressed glyphs.
121 static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth }; 121 static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
122 for (size_t i = 0 ; i < WTF_ARRAY_LENGTH(widthVariants) ; ++i) { 122 for (size_t i = 0 ; i < WTF_ARRAY_LENGTH(widthVariants) ; ++i) {
123 description.setWidthVariant(widthVariants[i]); 123 description.setWidthVariant(widthVariants[i]);
124 Font compressedFont = Font(description); 124 Font compressedFont = Font(description);
125 compressedFont.update(fontSelector); 125 compressedFont.update(fontSelector);
126 float runWidth = compressedFont.width(run); 126 float runWidth = compressedFont.width(run);
127 if (runWidth <= emWidth) { 127 if (runWidth <= emWidth) {
128 m_combinedTextWidth = runWidth; 128 m_combinedTextWidth = runWidth;
129 m_isCombined = true; 129 m_isCombined = true;
130 130
131 // Replace my font with the new one. 131 // Replace my font with the new one.
132 shouldUpdateFont = style()->setFontDescription(description); 132 shouldUpdateFont = deprecatedMutableStyle()->setFontDescription( description);
133 break; 133 break;
134 } 134 }
135 } 135 }
136 } 136 }
137 137
138 if (!m_isCombined) 138 if (!m_isCombined)
139 shouldUpdateFont = style()->setFontDescription(originalFont().fontDescri ption()); 139 shouldUpdateFont = deprecatedMutableStyle()->setFontDescription(original Font().fontDescription());
140 140
141 if (shouldUpdateFont) 141 if (shouldUpdateFont)
142 style()->font().update(fontSelector); 142 style()->font().update(fontSelector);
143 143
144 if (m_isCombined) { 144 if (m_isCombined) {
145 DEFINE_STATIC_LOCAL(String, objectReplacementCharacterString, (&objectRe placementCharacter, 1)); 145 DEFINE_STATIC_LOCAL(String, objectReplacementCharacterString, (&objectRe placementCharacter, 1));
146 m_renderingText = text(); 146 m_renderingText = text();
147 RenderText::setTextInternal(objectReplacementCharacterString.impl()); 147 RenderText::setTextInternal(objectReplacementCharacterString.impl());
148 } 148 }
149 } 149 }
150 150
151 } // namespace blink 151 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698