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

Side by Side Diff: Source/core/css/resolver/FontBuilder.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 glyphOrientation = NonCJKGlyphOrientationVerticalRight; 288 glyphOrientation = NonCJKGlyphOrientationVerticalRight;
289 return; 289 return;
290 default: 290 default:
291 ASSERT_NOT_REACHED(); 291 ASSERT_NOT_REACHED();
292 fontOrientation = Horizontal; 292 fontOrientation = Horizontal;
293 glyphOrientation = NonCJKGlyphOrientationVerticalRight; 293 glyphOrientation = NonCJKGlyphOrientationVerticalRight;
294 return; 294 return;
295 } 295 }
296 } 296 }
297 297
298 void FontBuilder::checkForOrientationChange(RenderStyle* style) 298 void FontBuilder::checkForOrientationChange(const RenderStyle* style)
299 { 299 {
300 FontOrientation fontOrientation; 300 FontOrientation fontOrientation;
301 NonCJKGlyphOrientation glyphOrientation; 301 NonCJKGlyphOrientation glyphOrientation;
302 getFontAndGlyphOrientation(style, fontOrientation, glyphOrientation); 302 getFontAndGlyphOrientation(style, fontOrientation, glyphOrientation);
303 303
304 FontDescriptionChangeScope scope(this); 304 FontDescriptionChangeScope scope(this);
305 305
306 if (m_fontDescription.orientation() == fontOrientation && m_fontDescription. nonCJKGlyphOrientation() == glyphOrientation) 306 if (m_fontDescription.orientation() == fontOrientation && m_fontDescription. nonCJKGlyphOrientation() == glyphOrientation)
307 return; 307 return;
308 308
309 m_fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 309 m_fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
310 m_fontDescription.setOrientation(fontOrientation); 310 m_fontDescription.setOrientation(fontOrientation);
311 } 311 }
312 312
313 void FontBuilder::checkForGenericFamilyChange(RenderStyle* style, const RenderSt yle* parentStyle) 313 void FontBuilder::checkForGenericFamilyChange(const RenderStyle* style, const Re nderStyle* parentStyle)
314 { 314 {
315 FontDescriptionChangeScope scope(this); 315 FontDescriptionChangeScope scope(this);
316 316
317 if (m_fontDescription.isAbsoluteSize() || !parentStyle) 317 if (m_fontDescription.isAbsoluteSize() || !parentStyle)
318 return; 318 return;
319 319
320 const FontDescription& parentFontDescription = parentStyle->fontDescription( ); 320 const FontDescription& parentFontDescription = parentStyle->fontDescription( );
321 if (m_fontDescription.fixedPitchFontType() == parentFontDescription.fixedPit chFontType()) 321 if (m_fontDescription.fixedPitchFontType() == parentFontDescription.fixedPit chFontType())
322 return; 322 return;
323 323
(...skipping 16 matching lines...) Expand all
340 : 1; 340 : 1;
341 size = parentFontDescription.fixedPitchFontType() == FixedPitchFont ? 341 size = parentFontDescription.fixedPitchFontType() == FixedPitchFont ?
342 m_fontDescription.specifiedSize() / fixedScaleFactor : 342 m_fontDescription.specifiedSize() / fixedScaleFactor :
343 m_fontDescription.specifiedSize() * fixedScaleFactor; 343 m_fontDescription.specifiedSize() * fixedScaleFactor;
344 } 344 }
345 345
346 m_fontDescription.setSpecifiedSize(size); 346 m_fontDescription.setSpecifiedSize(size);
347 updateComputedSize(m_fontDescription, style); 347 updateComputedSize(m_fontDescription, style);
348 } 348 }
349 349
350 void FontBuilder::updateComputedSize(RenderStyle* style, const RenderStyle* pare ntStyle) 350 void FontBuilder::updateComputedSize(const RenderStyle* style, const RenderStyle * parentStyle)
351 { 351 {
352 FontDescriptionChangeScope scope(this); 352 FontDescriptionChangeScope scope(this);
353 updateComputedSize(m_fontDescription, style); 353 updateComputedSize(m_fontDescription, style);
354 } 354 }
355 355
356 void FontBuilder::updateComputedSize(FontDescription& fontDescription, RenderSty le* style) 356 void FontBuilder::updateComputedSize(FontDescription& fontDescription, const Ren derStyle* style)
357 { 357 {
358 float computedSize = getComputedSizeFromSpecifiedSize(fontDescription, style ->effectiveZoom(), fontDescription.specifiedSize()); 358 float computedSize = getComputedSizeFromSpecifiedSize(fontDescription, style ->effectiveZoom(), fontDescription.specifiedSize());
359 float multiplier = style->textAutosizingMultiplier(); 359 float multiplier = style->textAutosizingMultiplier();
360 if (multiplier > 1) 360 if (multiplier > 1)
361 computedSize = TextAutosizer::computeAutosizedFontSize(computedSize, mul tiplier); 361 computedSize = TextAutosizer::computeAutosizedFontSize(computedSize, mul tiplier);
362 fontDescription.setComputedSize(computedSize); 362 fontDescription.setComputedSize(computedSize);
363 } 363 }
364 364
365 void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, RenderStyle* style, const RenderStyle* parentStyle) 365 void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, RenderStyle* style, const RenderStyle* parentStyle)
366 { 366 {
(...skipping 21 matching lines...) Expand all
388 FontOrientation fontOrientation; 388 FontOrientation fontOrientation;
389 NonCJKGlyphOrientation glyphOrientation; 389 NonCJKGlyphOrientation glyphOrientation;
390 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ; 390 getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation) ;
391 fontDescription.setOrientation(fontOrientation); 391 fontDescription.setOrientation(fontOrientation);
392 fontDescription.setNonCJKGlyphOrientation(glyphOrientation); 392 fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
393 documentStyle->setFontDescription(fontDescription); 393 documentStyle->setFontDescription(fontDescription);
394 documentStyle->font().update(fontSelector); 394 documentStyle->font().update(fontSelector);
395 } 395 }
396 396
397 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698