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

Unified Diff: third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp

Issue 2797423005: Always use original ascent/descent for FontMetrics::floatAscent|floatDescent (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
index 55662ca66843899c8f322fe8ea6595279b40d3f7..60acc2da186cb3574971e8c0bc494ef9f58b1e19 100644
--- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
+++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
@@ -57,8 +57,7 @@ static const size_t maxVDMXTableSize = 1024 * 1024; // 1 MB
SimpleFontData::SimpleFontData(const FontPlatformData& platformData,
PassRefPtr<CustomFontData> customData,
- bool isTextOrientationFallback,
- bool subpixelAscentDescent)
+ bool isTextOrientationFallback)
: m_maxCharWidth(-1),
m_avgCharWidth(-1),
m_platformData(platformData),
@@ -66,7 +65,7 @@ SimpleFontData::SimpleFontData(const FontPlatformData& platformData,
m_verticalData(nullptr),
m_hasVerticalGlyphs(false),
m_customFontData(std::move(customData)) {
- platformInit(subpixelAscentDescent);
+ platformInit();
platformGlyphInit();
if (platformData.isVerticalAnyUpright() && !isTextOrientationFallback) {
m_verticalData = platformData.verticalData();
@@ -82,7 +81,7 @@ SimpleFontData::SimpleFontData(const FontPlatformData& platformData,
m_verticalData(verticalData),
m_hasVerticalGlyphs(false) {}
-void SimpleFontData::platformInit(bool subpixelAscentDescent) {
+void SimpleFontData::platformInit() {
if (!m_platformData.size()) {
m_fontMetrics.reset();
m_avgCharWidth = 0;
@@ -133,38 +132,9 @@ void SimpleFontData::platformInit(bool subpixelAscentDescent) {
if (isVDMXValid) {
ascent = vdmxAscent;
descent = -vdmxDescent;
- } else if (subpixelAscentDescent &&
- (-metrics.fAscent < 3 ||
- -metrics.fAscent + metrics.fDescent < 2)) {
- // For tiny fonts, the rounding of fAscent and fDescent results in equal
- // baseline for different types of text baselines (crbug.com/338908).
- // Please see CanvasRenderingContext2D::getFontBaseline for the heuristic.
+ } else {
ascent = -metrics.fAscent;
descent = metrics.fDescent;
- } else {
- ascent = SkScalarRoundToScalar(-metrics.fAscent);
- descent = SkScalarRoundToScalar(metrics.fDescent);
-
- int overflowInflationForAscent = ascent < -metrics.fAscent ? 1 : 0;
- int overflowInflationForDescent = descent < metrics.fDescent ? 1 : 0;
- if (overflowInflationForDescent) {
-#if OS(LINUX) || OS(ANDROID)
- // When subpixel positioning is enabled, if the descent is rounded down,
- // the descent part of the glyph may be truncated when displayed in a
- // 'overflow: hidden' container. To avoid that, borrow 1 unit from the
- // ascent when possible.
- if (platformData().getFontRenderStyle().useSubpixelPositioning &&
- ascent >= 1) {
- ++descent;
- --ascent;
- // We should inflate overflow 1 more pixel for ascent instead.
- overflowInflationForDescent = 0;
- ++overflowInflationForAscent;
- }
-#endif
- }
- m_fontMetrics.setVisualOverflowInflations(overflowInflationForAscent,
- overflowInflationForDescent);
}
#if OS(MACOSX)
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/SimpleFontData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698