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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp

Issue 2427773002: Fixing superscript and subscript baseline for tiny fonts in SVG
Patch Set: Created 4 years, 2 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) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 FontDescription fontDescription(style->getFontDescription()); 391 FontDescription fontDescription(style->getFontDescription());
392 392
393 Document& document = layoutObject->document(); 393 Document& document = layoutObject->document();
394 // FIXME: We need to better handle the case when we compute very small fonts 394 // FIXME: We need to better handle the case when we compute very small fonts
395 // below (below 1pt). 395 // below (below 1pt).
396 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize( 396 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(
397 &document, scalingFactor, fontDescription.isAbsoluteSize(), 397 &document, scalingFactor, fontDescription.isAbsoluteSize(),
398 fontDescription.specifiedSize(), DoNotUseSmartMinimumForFontSize)); 398 fontDescription.specifiedSize(), DoNotUseSmartMinimumForFontSize));
399 399
400 scaledFont = Font(fontDescription); 400 scaledFont = Font(fontDescription);
401 // If the font size is smaller than 3, rounding ascent and descent values
402 // ignores the baseline shifts for superscript and subscript. In this case,
403 // we use subpixel ascent and descent.
404 if (scaledFont.getFontDescription().getSize().value < 3)
405 scaledFont.getFontDescription().setSubpixelAscentDescent(true);
eae 2016/10/17 20:14:23 It's not clear that updateScaledFont is guaranteed
zakerinasab 2016/10/18 15:51:16 Correct. The problem is that the rounding at the b
401 scaledFont.update(document.styleEngine().fontSelector()); 406 scaledFont.update(document.styleEngine().fontSelector());
402 } 407 }
403 408
404 LayoutRect LayoutSVGInlineText::absoluteClippedOverflowRect() const { 409 LayoutRect LayoutSVGInlineText::absoluteClippedOverflowRect() const {
405 return parent()->absoluteClippedOverflowRect(); 410 return parent()->absoluteClippedOverflowRect();
406 } 411 }
407 412
408 FloatRect LayoutSVGInlineText::paintInvalidationRectInLocalSVGCoordinates() 413 FloatRect LayoutSVGInlineText::paintInvalidationRectInLocalSVGCoordinates()
409 const { 414 const {
410 return parent()->paintInvalidationRectInLocalSVGCoordinates(); 415 return parent()->paintInvalidationRectInLocalSVGCoordinates();
411 } 416 }
412 417
413 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const { 418 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const {
414 RefPtr<StringImpl> result = LayoutText::originalText(); 419 RefPtr<StringImpl> result = LayoutText::originalText();
415 if (!result) 420 if (!result)
416 return nullptr; 421 return nullptr;
417 return normalizeWhitespace(result); 422 return normalizeWhitespace(result);
418 } 423 }
419 424
420 } // namespace blink 425 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698