WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch (moved test case from platform/chromium to platform/chromium-linux because it's only applicable to chromium-linux and chromium-android)
bug-88684-20120712110054.patch (text/plain), 10.59 KB, created by
Xianzhu Wang
on 2012-07-12 11:00:55 PDT
(
hide
)
Description:
Patch (moved test case from platform/chromium to platform/chromium-linux because it's only applicable to chromium-linux and chromium-android)
Filename:
MIME Type:
Creator:
Xianzhu Wang
Created:
2012-07-12 11:00:55 PDT
Size:
10.59 KB
patch
obsolete
>Subversion Revision: 122278 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 516a1395a33a47ae6231190678e1de7196f76b83..2d49f317cc1dc3d1f075e57f59773c137c4092ed 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2012-07-10 Xianzhu Wang <wangxianzhu@chromium.org> >+ >+ [Chromium] Sometimes bottom of text is truncated when page has a fractional scale >+ https://bugs.webkit.org/show_bug.cgi?id=88684 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When the page has a fractional scale, the ascent and descent part of the fonts might be fractional. >+ If the descent part is rounded down, the bottom of the text might be truncated when displayed >+ when subpixel text positioning is enabled. >+ To avoid that, borrow one unit from the ascent when possible. >+ >+ Test: platform/chromium/fast/text/descent-clip-in-scaled-page.html >+ >+ * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: >+ (WebCore::FontPlatformData::setupPaint): Moved NoPreference handling into querySystemForRenderStyle so that fontRenderStyle() can have actual styles without NoPreference. >+ (WebCore::FontPlatformData::querySystemForRenderStyle): Added NoPreference handling (moved from setupPaint) >+ * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: >+ (FontPlatformData): >+ (WebCore::FontPlatformData::fontRenderStyle): Added to let SimpleFontDataSkia access the font render styles. >+ * platform/graphics/skia/SimpleFontDataSkia.cpp: >+ (WebCore::SimpleFontData::platformInit): >+ > 2012-07-10 Philip Rogers <pdr@google.com> > > Crash due to SVG animation element not removed from target (before reset) >diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp >index 2655b61ab1f916eed7063b8e8f466aee8f2041f9..63ca1ad9405dfb1a2c8f5efafca792188c45e3ca 100644 >--- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp >+++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp >@@ -175,31 +175,19 @@ String FontPlatformData::description() const > > void FontPlatformData::setupPaint(SkPaint* paint) const > { >- const float ts = m_textSize >= 0 ? m_textSize : 12; >+ paint->setAntiAlias(m_style.useAntiAlias); >+ paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); >+ paint->setEmbeddedBitmapText(m_style.useBitmaps); >+ paint->setAutohinted(m_style.useAutoHint); >+ paint->setSubpixelText(m_style.useSubpixelPositioning); >+ if (m_style.useAntiAlias) >+ paint->setLCDRenderText(m_style.useSubpixelRendering); > >- paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? useSkiaAntiAlias : m_style.useAntiAlias); >- switch (m_style.useHinting) { >- case FontRenderStyle::NoPreference: >- paint->setHinting(skiaHinting); >- break; >- case 0: >- paint->setHinting(SkPaint::kNo_Hinting); >- break; >- default: >- paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); >- break; >- } >- >- paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? useSkiaBitmaps : m_style.useBitmaps); >+ const float ts = m_textSize >= 0 ? m_textSize : 12; > paint->setTextSize(SkFloatToScalar(ts)); > paint->setTypeface(m_typeface); > paint->setFakeBoldText(m_fakeBold); > paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); >- paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? useSkiaAutoHint : m_style.useAutoHint); >- paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? useSkiaSubpixelPositioning : m_style.useSubpixelPositioning); >- >- if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && useSkiaAntiAlias)) >- paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? useSkiaSubpixelRendering : m_style.useSubpixelRendering); > } > > SkFontID FontPlatformData::uniqueID() const >@@ -262,6 +250,26 @@ HarfbuzzFace* FontPlatformData::harfbuzzFace() const > void FontPlatformData::querySystemForRenderStyle() > { > PlatformSupport::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style); >+ >+ // Fix FontRenderStyle::NoPreference to actual styles. >+ if (m_style.useAntiAlias == FontRenderStyle::NoPreference) >+ m_style.useAntiAlias = useSkiaAntiAlias; >+ >+ if (!m_style.useHinting) >+ m_style.hintStyle = SkPaint::kNo_Hinting; >+ else if (m_style.useHinting == FontRenderStyle::NoPreference) >+ m_style.hintStyle = skiaHinting; >+ >+ if (m_style.useBitmaps == FontRenderStyle::NoPreference) >+ m_style.useBitmaps = useSkiaBitmaps; >+ if (m_style.useAutoHint == FontRenderStyle::NoPreference) >+ m_style.useAutoHint = useSkiaAutoHint; >+ if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) >+ m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; >+ if (m_style.useAntiAlias == FontRenderStyle::NoPreference) >+ m_style.useAntiAlias = useSkiaAntiAlias; >+ if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) >+ m_style.useSubpixelRendering = useSkiaSubpixelRendering; > } > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h >index 246a7a49c3c6bd7ed108300529a601d6081e12e4..7c27dd1200f00eca6b07c63cb9594cc41a2e6031 100644 >--- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h >+++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h >@@ -130,6 +130,9 @@ public: > > HarfbuzzFace* harfbuzzFace() const; > >+ // The returned styles are all actual styles without FontRenderStyle::NoPreference. >+ const FontRenderStyle& fontRenderStyle() const { return m_style; } >+ > // ------------------------------------------------------------------------- > // Global font preferences... > >diff --git a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp >index b4d20b03a6c7c7355c7b1ca58aa3e0a396f22fea..ec591017c3b234fbb7946303d78ef0d1dfe6f931 100644 >--- a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp >+++ b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp >@@ -86,7 +86,7 @@ void SimpleFontData::platformInit() > float descent; > > // Beware those who step here: This code is designed to match Win32 font >- // metrics *exactly*. >+ // metrics *exactly* (except the adjustment of ascent/descent on Linux/Android). > if (isVDMXValid) { > ascent = vdmxAscent; > descent = -vdmxDescent; >@@ -94,6 +94,16 @@ void SimpleFontData::platformInit() > SkScalar height = -metrics.fAscent + metrics.fDescent + metrics.fLeading; > ascent = SkScalarRound(-metrics.fAscent); > descent = SkScalarRound(height) - ascent; >+#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. >+ // FIXME: This can be removed if sub-pixel ascent/descent is supported. >+ if (platformData().fontRenderStyle().useSubpixelPositioning && descent < SkScalarToFloat(metrics.fDescent) && ascent >= 1) { >+ descent++; >+ ascent--; >+ } >+#endif > } > > m_fontMetrics.setAscent(ascent); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index b1adce8b7209296b3256298c1de54f49cf2cd86e..93b4b923c3ee5b33f26beb333b25e05d6ee1922e 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2012-07-10 Xianzhu Wang <wangxianzhu@chromium.org> >+ >+ [Chromium] Sometimes bottom of text is truncated when page has a fractional scale >+ https://bugs.webkit.org/show_bug.cgi?id=88684 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/chromium/fast/text/descent-clip-in-scaled-page-expected.html: Added. >+ * platform/chromium/fast/text/descent-clip-in-scaled-page.html: Added. >+ > 2012-07-10 Philip Rogers <pdr@google.com> > > Crash due to SVG animation element not removed from target (before reset) >diff --git a/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page-expected.html b/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4fd0485472293ec9b8c288a200a5752b2112ea9d >--- /dev/null >+++ b/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page-expected.html >@@ -0,0 +1,24 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+ div { >+ font-family: ahem; >+ font-size: 16px; >+ } >+</style> >+<script> >+ if (window.layoutTestController) >+ window.layoutTestController.setTextSubpixelPositioning(true); >+ if (window.internals) >+ window.internals.settings.setPageScaleFactor(1.7, 0, 0); >+</script> >+</head> >+<body onload="test()"> >+ Tests if the bottom of the text is truncated when the page is scaled by a fractional factor. >+ If success, the text in the "overflow: hidden" div (the test case) should be displayed >+ the same as in a normal div (the ref html). >+ 'p' is the character in ahem font with only the descent part. >+ <div> pppp </div> >+</body> >+</html> >diff --git a/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page.html b/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page.html >new file mode 100644 >index 0000000000000000000000000000000000000000..7c76979c0e47af87690101dbe241abd916f7b079 >--- /dev/null >+++ b/LayoutTests/platform/chromium-linux/fast/text/descent-clip-in-scaled-page.html >@@ -0,0 +1,25 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+ div { >+ font-family: ahem; >+ font-size: 16px; >+ overflow: hidden; >+ } >+</style> >+<script> >+ if (window.layoutTestController) >+ window.layoutTestController.setTextSubpixelPositioning(true); >+ if (window.internals) >+ window.internals.settings.setPageScaleFactor(1.7, 0, 0); >+</script> >+</head> >+<body onload="test()"> >+ Tests if the bottom of the text is truncated when the page is scaled by a fractional factor. >+ If success, the text in the "overflow: hidden" div (the test case) should be displayed >+ the same as in a normal div (the ref html). >+ 'p' is the character in ahem font with only the descent part. >+ <div> pppp </div> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 88684
:
151557
|
151563
|
151734
|
151988
|
152001
|
152085
|
152309
|
152339
|
155634