Diff
Modified: trunk/LayoutTests/ChangeLog (126311 => 126312)
--- trunk/LayoutTests/ChangeLog 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/LayoutTests/ChangeLog 2012-08-22 16:53:51 UTC (rev 126312)
@@ -1,3 +1,23 @@
+2012-08-22 Koji Ishii <[email protected]>
+
+ FontMetrics.unitsPerEm(), FontPlatformData.orientation(), SimpleFontData::platformBoundsForGlyph are not implemented on Chromium Windows
+ https://bugs.webkit.org/show_bug.cgi?id=83512
+
+ Reviewed by Tony Chang.
+
+ Chromium Windows does not implement following 3 functions that are required for bug 51450.
+ 1. FontMetrics.unitsPerEm() always returns the default value (gDefaultUnitsPerEm = 1000).
+ This change requires rebaseline of fast/repaint/stacked-diacritics and fast/text/emphasis-overlap.
+ 2. FontPlatformData.orientation() always returns Horizontal. This has no effect as of this patch.
+ 3. SimpleFontData::platformBoundsForGlyph() always returns FloatRect().
+ This change improves rendering of text-emphasis and 3 existing tests pass now.
+ Tony suggested in bug 51450 review to split code that is not behind
+ #if ENABLE(OPENTYPE_VERTICAL) to a separate patch.
+
+ * platform/chromium-win/fast/repaint/stacked-diacritics-expected.png:
+ * platform/chromium-win/fast/text/emphasis-overlap-expected.txt: Added due to metrics change.
+ * platform/chromium/TestExpectations: Enabled 3 tests for Chromium Win.
+
2012-08-22 Dominic Mazzoni <[email protected]>
REGRESSION (r125710): accessibility/accessibility-node-reparent.html, accessibility/accessibility-node-memory-management.html failing on GTK Linux
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (126311 => 126312)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-08-22 16:53:51 UTC (rev 126312)
@@ -2192,10 +2192,10 @@
// WebKit roll 74255:74308
BUGCR67416 LINUX ANDROID WIN : fast/text/emphasis.html = IMAGE+TEXT
BUGCR67416 : fast/text/emphasis-vertical.html = IMAGE IMAGE+TEXT
-BUGCR67540 LINUX ANDROID WIN : fast/text/emphasis-overlap.html = IMAGE+TEXT
-BUGCR67540 LINUX ANDROID WIN : fast/text/emphasis-avoid-ruby.html = IMAGE
+BUGCR67540 LINUX ANDROID : fast/text/emphasis-overlap.html = IMAGE+TEXT
+BUGCR67540 LINUX ANDROID : fast/text/emphasis-avoid-ruby.html = IMAGE
BUGCR67540 LINUX ANDROID WIN SNOWLEOPARD : fast/repaint/text-emphasis-h.html = IMAGE
-BUGCR67540 LINUX ANDROID WIN : fast/repaint/text-emphasis-v.html = IMAGE
+BUGCR67540 LINUX ANDROID : fast/repaint/text-emphasis-v.html = IMAGE
BUGCR67442 LINUX WIN : fast/canvas/fillText-shadow.html = TEXT
BUGCR67442 LINUX ANDROID WIN : platform/chromium/virtual/gpu/fast/canvas/fillText-shadow.html = TEXT
Modified: trunk/LayoutTests/platform/chromium-win/fast/repaint/stacked-diacritics-expected.png
(Binary files differ)
Added: trunk/LayoutTests/platform/chromium-win/fast/text/emphasis-overlap-expected.txt (0 => 126312)
--- trunk/LayoutTests/platform/chromium-win/fast/text/emphasis-overlap-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium-win/fast/text/emphasis-overlap-expected.txt 2012-08-22 16:53:51 UTC (rev 126312)
@@ -0,0 +1,125 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (0,0) size 784x176
+ RenderBlock {DIV} at (0,24) size 160x144
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#0000FF]
+ RenderText {#text} at (0,80) size 128x32
+ text run at (0,80) width 128: "3333"
+ RenderText {#text} at (128,80) size 32x32
+ text run at (128,80) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,112) size 128x32
+ text run at (0,112) width 128: "4444"
+ RenderText {#text} at (160,147) size 4x19
+ text run at (160,147) width 4: " "
+ RenderBlock {DIV} at (164,24) size 160x144
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#008000]
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32
+ RenderText {#text} at (0,80) size 128x32
+ text run at (0,80) width 128: "3333"
+ RenderText {#text} at (128,80) size 32x32
+ text run at (128,80) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,112) size 128x32
+ text run at (0,112) width 128: "4444"
+ RenderText {#text} at (324,147) size 4x19
+ text run at (324,147) width 4: " "
+ RenderBlock {DIV} at (328,8) size 160x160
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#008000]
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#0000FF]
+ RenderText {#text} at (0,96) size 128x32
+ text run at (0,96) width 128: "3333"
+ RenderText {#text} at (128,96) size 32x32
+ text run at (128,96) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,128) size 128x32
+ text run at (0,128) width 128: "4444"
+ RenderText {#text} at (0,0) size 0x0
+ RenderBlock {DIV} at (0,176) size 784x176
+ RenderBlock {DIV} at (0,8) size 160x144
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#008000]
+ RenderText {#text} at (0,80) size 128x32
+ text run at (0,80) width 128: "3333"
+ RenderText {#text} at (128,80) size 32x32
+ text run at (128,80) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,112) size 128x32
+ text run at (0,112) width 128: "4444"
+ RenderText {#text} at (160,10) size 4x19
+ text run at (160,10) width 4: " "
+ RenderBlock {DIV} at (164,8) size 160x144
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#0000FF]
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32
+ RenderText {#text} at (0,80) size 128x32
+ text run at (0,80) width 128: "3333"
+ RenderText {#text} at (128,80) size 32x32
+ text run at (128,80) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,112) size 128x32
+ text run at (0,112) width 128: "4444"
+ RenderText {#text} at (324,10) size 4x19
+ text run at (324,10) width 4: " "
+ RenderBlock {DIV} at (328,8) size 160x160
+ RenderText {#text} at (0,0) size 160x32
+ text run at (0,0) width 160: "1111 "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#0000FF]
+ RenderText {#text} at (0,32) size 128x32
+ text run at (0,32) width 128: "2222"
+ RenderText {#text} at (128,32) size 32x32
+ text run at (128,32) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderInline {SPAN} at (0,0) size 128x32 [color=#008000]
+ RenderText {#text} at (0,96) size 128x32
+ text run at (0,96) width 128: "3333"
+ RenderText {#text} at (128,96) size 32x32
+ text run at (128,96) width 32: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderText {#text} at (0,128) size 128x32
+ text run at (0,128) width 128: "4444"
+ RenderText {#text} at (0,0) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (126311 => 126312)
--- trunk/Source/WebCore/ChangeLog 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/ChangeLog 2012-08-22 16:53:51 UTC (rev 126312)
@@ -1,3 +1,39 @@
+2012-08-22 Koji Ishii <[email protected]>
+
+ FontMetrics.unitsPerEm(), FontPlatformData.orientation(), SimpleFontData::platformBoundsForGlyph are not implemented on Chromium Windows
+ https://bugs.webkit.org/show_bug.cgi?id=83512
+
+ Reviewed by Tony Chang.
+
+ Chromium Windows does not implement following 3 functions that are required for bug 51450.
+ 1. FontMetrics.unitsPerEm() always returns the default value (gDefaultUnitsPerEm = 1000).
+ 2. FontPlatformData.orientation() always returns Horizontal.
+ 3. SimpleFontData::platformBoundsForGlyph() always returns FloatRect().
+ Tony suggested in bug 51450 review to split code that is not behind
+ #if ENABLE(OPENTYPE_VERTICAL) to a separate patch.
+
+ Test: Following 3 existing but skipped tests are now enabled and pass.
+ fast/text/emphasis-overlap.html
+ fast/text/emphasis-avoid-ruby.html
+ fast/repaint/text-emphasis-v.html
+
+ * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+ (WebCore::FontCache::createFontPlatformData): Add orientation.
+ * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp:
+ (WebCore::FontPlatformData::FontPlatformData): Add orientation.
+ (WebCore::FontPlatformData::operator=): Add orientation.
+ * platform/graphics/chromium/FontPlatformDataChromiumWin.h:
+ (FontPlatformData):
+ (WebCore::FontPlatformData::orientation): Add orientation.
+ (WebCore::FontPlatformData::setOrientation): Add orientation.
+ (WebCore::FontPlatformData::operator==): Add orientation.
+ * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp:
+ (WebCore::SimpleFontData::platformInit): Set FontMetrics.unitsPerEm.
+ (WebCore::SimpleFontData::createScaledFontData): Add orientation.
+ (WebCore::SimpleFontData::platformBoundsForGlyph): Implemented.
+ * platform/graphics/skia/FontCustomPlatformData.cpp:
+ (WebCore::FontCustomPlatformData::fontPlatformData): Add orientation.
+
2012-08-22 Robert Hogan <[email protected]>
REGRESSION(r125578): fast/regex/unicodeCaseInsensitive.html crash on Linux Debug Chromium
Modified: trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp (126311 => 126312)
--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp 2012-08-22 16:53:51 UTC (rev 126312)
@@ -629,7 +629,8 @@
}
return new FontPlatformData(hfont,
- fontDescription.computedPixelSize());
+ fontDescription.computedPixelSize(),
+ fontDescription.orientation());
}
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp (126311 => 126312)
--- trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp 2012-08-22 16:53:51 UTC (rev 126312)
@@ -32,14 +32,16 @@
#include "config.h"
#include "FontPlatformData.h"
-#include <windows.h>
-#include <objidl.h>
-#include <mlang.h>
-
+#include "FontCache.h"
#include "HWndDC.h"
#include "PlatformSupport.h"
+#include "SharedBuffer.h"
#include "SkTypeface_win.h"
#include "SkiaFontWin.h"
+
+#include <mlang.h>
+#include <objidl.h>
+#include <windows.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
@@ -62,6 +64,7 @@
FontPlatformData::FontPlatformData(WTF::HashTableDeletedValueType)
: m_font(hashTableDeletedFontValue())
, m_size(-1)
+ , m_orientation(Horizontal)
, m_scriptCache(0)
, m_scriptFontProperties(0)
, m_typeface(0)
@@ -72,6 +75,7 @@
FontPlatformData::FontPlatformData()
: m_font(0)
, m_size(0)
+ , m_orientation(Horizontal)
, m_scriptCache(0)
, m_scriptFontProperties(0)
, m_typeface(0)
@@ -79,9 +83,10 @@
{
}
-FontPlatformData::FontPlatformData(HFONT font, float size)
+FontPlatformData::FontPlatformData(HFONT font, float size, FontOrientation orientation)
: m_font(RefCountedHFONT::create(font))
, m_size(size)
+ , m_orientation(orientation)
, m_scriptCache(0)
, m_scriptFontProperties(0)
, m_typeface(CreateTypefaceFromHFont(font, 0, &m_lfQuality))
@@ -92,6 +97,7 @@
FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
: m_font(0)
, m_size(size)
+ , m_orientation(Horizontal)
, m_scriptCache(0)
, m_scriptFontProperties(0)
, m_typeface(0)
@@ -102,6 +108,7 @@
FontPlatformData::FontPlatformData(const FontPlatformData& data)
: m_font(data.m_font)
, m_size(data.m_size)
+ , m_orientation(data.m_orientation)
, m_scriptCache(0)
, m_scriptFontProperties(0)
, m_typeface(data.m_typeface)
@@ -115,6 +122,7 @@
if (this != &data) {
m_font = data.m_font;
m_size = data.m_size;
+ m_orientation = data.m_orientation;
SkRefCnt_SafeAssign(m_typeface, data.m_typeface);
m_lfQuality = data.m_lfQuality;
Modified: trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h (126311 => 126312)
--- trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.h 2012-08-22 16:53:51 UTC (rev 126312)
@@ -64,7 +64,7 @@
FontPlatformData(WTF::HashTableDeletedValueType);
FontPlatformData();
// This constructor takes ownership of the HFONT
- FontPlatformData(HFONT, float size);
+ FontPlatformData(HFONT, float size, FontOrientation);
FontPlatformData(float size, bool bold, bool oblique);
FontPlatformData(const FontPlatformData&);
@@ -79,8 +79,8 @@
SkTypeface* typeface() const { return m_typeface; }
int lfQuality() const { return m_lfQuality; }
- FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
- void setOrientation(FontOrientation) { } // FIXME: Implement.
+ FontOrientation orientation() const { return m_orientation; }
+ void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
unsigned hash() const
{
@@ -89,7 +89,7 @@
bool operator==(const FontPlatformData& other) const
{
- return m_font == other.m_font && m_size == other.m_size;
+ return m_font == other.m_font && m_size == other.m_size && m_orientation == other.m_orientation;
}
#ifndef NDEBUG
@@ -137,6 +137,7 @@
RefPtr<RefCountedHFONT> m_font;
float m_size; // Point size of the font in pixels.
+ FontOrientation m_orientation;
SkTypeface* m_typeface; // cached from m_font
int m_lfQuality; // cached from m_font
Modified: trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp (126311 => 126312)
--- trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp 2012-08-22 16:53:51 UTC (rev 126312)
@@ -81,6 +81,8 @@
OUTLINETEXTMETRIC outlineTextMetric;
if (GetOutlineTextMetrics(dc, sizeof(outlineTextMetric), &outlineTextMetric) > 0) {
+ m_fontMetrics.setUnitsPerEm(outlineTextMetric.otmEMSquare);
+
// This is a TrueType font. We might be able to get an accurate xHeight.
GLYPHMETRICS glyphMetrics = {0};
MAT2 identityMatrix = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
@@ -114,7 +116,7 @@
float scaledSize = scaleFactor * fontDescription.computedSize();
winFont.lfHeight = -lroundf(scaledSize);
HFONT hfont = CreateFontIndirect(&winFont);
- return adoptPtr(new SimpleFontData(FontPlatformData(hfont, scaledSize), isCustomFont(), false));
+ return adoptPtr(new SimpleFontData(FontPlatformData(hfont, scaledSize, m_platformData.orientation()), isCustomFont(), false));
}
SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDescription) const
@@ -168,9 +170,28 @@
SelectObject(dc, oldFont);
}
-FloatRect SimpleFontData::platformBoundsForGlyph(Glyph) const
+FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const
{
- return FloatRect();
+ HWndDC hdc(0);
+ SetGraphicsMode(hdc, GM_ADVANCED);
+ HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
+
+ GLYPHMETRICS gdiMetrics;
+ static const MAT2 identity = { 0, 1, 0, 0, 0, 0, 0, 1 };
+ if (GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity) == -1) {
+ if (PlatformSupport::ensureFontLoaded(m_platformData.hfont())) {
+ // Retry GetTextMetrics.
+ // FIXME: Handle gracefully the error if this call also fails.
+ // See http://crbug.com/6401.
+ if (GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity) == -1)
+ LOG_ERROR("Unable to get the glyph metrics after second attempt");
+ }
+ }
+
+ SelectObject(hdc, oldFont);
+
+ return FloatRect(gdiMetrics.gmptGlyphOrigin.x, -gdiMetrics.gmptGlyphOrigin.y,
+ gdiMetrics.gmBlackBoxX, gdiMetrics.gmBlackBoxY);
}
float SimpleFontData::platformWidthForGlyph(Glyph glyph) const
Modified: trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp (126311 => 126312)
--- trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp 2012-08-22 16:36:47 UTC (rev 126311)
+++ trunk/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp 2012-08-22 16:53:51 UTC (rev 126312)
@@ -100,7 +100,7 @@
logFont.lfWeight = bold ? FW_BOLD : FW_DONTCARE;
HFONT hfont = CreateFontIndirect(&logFont);
- return FontPlatformData(hfont, size);
+ return FontPlatformData(hfont, size, orientation);
#elif OS(UNIX)
ASSERT(m_fontReference);
return FontPlatformData(m_fontReference, "", size, bold && !m_fontReference->isBold(), italic && !m_fontReference->isItalic(), orientation, textOrientation);