- Revision
- 129054
- Author
- [email protected]
- Date
- 2012-09-19 15:43:51 -0700 (Wed, 19 Sep 2012)
Log Message
[chromium] Store the contents scale factor in PlatformContextSkia on initialization
https://bugs.webkit.org/show_bug.cgi?id=96137
Patch by Terry Anderson <[email protected]> on 2012-09-19
Reviewed by Stephen White.
Source/WebCore:
When the compositor creates a PlatformContextSkia, the scale on |canvas| will
be equal to the content scale factor (which, without pinch-to-zoom, will be
the same as the device scale factor). Set this value as a member on PlatformContextSkia,
which will be used to correctly render glyphs when hinting is used and the device
scale factor is not 1.
Tests: added two new unit tests.
* platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp:
(WebCore::OpaqueRectTrackingContentLayerDelegate::paintContents):
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::PlatformContextSkia):
(WebCore::PlatformContextSkia::setupPaintCommon):
* platform/graphics/skia/PlatformContextSkia.h:
(PlatformContextSkia):
(WebCore::PlatformContextSkia::setHintingScaleFactor):
(WebCore::PlatformContextSkia::hintingScaleFactor):
Source/WebKit/chromium:
Define SK_SUPPORT_HINTING_SCALE_FACTOR by default. This is also used
for the skia patch here: https://codereview.appspot.com/6506099/.
Also added two new unit tests.
* features.gypi:
* tests/OpaqueRectTrackingContentLayerDelegateTest.cpp:
(WebCore):
(WebCore::HintingScaleCallback::HintingScaleCallback):
(HintingScaleCallback):
(WebCore::HintingScaleCallback::operator()):
(WebCore::TEST_F):
* tests/PlatformContextSkiaTest.cpp:
(WebCore):
(WebCore::TEST):
LayoutTests:
These tests will fail due to a font hinting/rasterization issue with
chromium DRT pixel tests having a page/device scale factor of 2.
See crbug.com/150682.
* platform/chromium/TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (129053 => 129054)
--- trunk/LayoutTests/ChangeLog 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/LayoutTests/ChangeLog 2012-09-19 22:43:51 UTC (rev 129054)
@@ -1,3 +1,16 @@
+2012-09-19 Terry Anderson <[email protected]>
+
+ [chromium] Store the contents scale factor in PlatformContextSkia on initialization
+ https://bugs.webkit.org/show_bug.cgi?id=96137
+
+ Reviewed by Stephen White.
+
+ These tests will fail due to a font hinting/rasterization issue with
+ chromium DRT pixel tests having a page/device scale factor of 2.
+ See crbug.com/150682.
+
+ * platform/chromium/TestExpectations:
+
2012-09-19 Dirk Pranke <[email protected]>
nrwt: replace TEXT, AUDIO, and IMAGE+TEXT with FAIL
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (129053 => 129054)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-09-19 22:43:51 UTC (rev 129054)
@@ -2595,6 +2595,24 @@
BUGCR146756 LINUX WIN ANDROID MAC : platform/chromium/virtual/gpu/fast/hidpi/broken-image-icon-hidpi.html = IMAGE
BUGCR146756 LINUX WIN ANDROID MAC : platform/chromium/virtual/gpu/fast/hidpi/broken-image-with-size-hidpi.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/clip-text-in-hidpi.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-as-background.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-background-dynamic.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-background-repeat-without-size.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-background-repeat.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-border-image-comparison.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-border-image-dynamic.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-border-image-simple.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-in-content-dynamic.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-out-of-order.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-simple.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/image-set-without-specified-width.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/resize-corner-hidpi.html = IMAGE
+BUGCR150682 : platform/chromium/virtual/gpu/fast/hidpi/video-controls-in-hidpi.html = IMAGE
+BUGCR150682 : compositing/geometry/fixed-position-composited-page-scale.html = IMAGE
+BUGCR150682 : compositing/geometry/fixed-position-iframe-composited-page-scale-down.html = IMAGE
+BUGCR150682 : compositing/geometry/fixed-position-iframe-composited-page-scale.html = IMAGE
+
BUGWK70866 LINUX ANDROID MAC DEBUG : fast/forms/form-associated-element-crash3.html = TIMEOUT PASS
BUGWK72039 RELEASE : fast/forms/form-associated-element-crash3.html = MISSING PASS
BUGWK72039 LINUX ANDROID RELEASE : fast/forms/form-associated-element-crash.html = MISSING PASS
Modified: trunk/Source/WebCore/ChangeLog (129053 => 129054)
--- trunk/Source/WebCore/ChangeLog 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebCore/ChangeLog 2012-09-19 22:43:51 UTC (rev 129054)
@@ -1,3 +1,28 @@
+2012-09-19 Terry Anderson <[email protected]>
+
+ [chromium] Store the contents scale factor in PlatformContextSkia on initialization
+ https://bugs.webkit.org/show_bug.cgi?id=96137
+
+ Reviewed by Stephen White.
+
+ When the compositor creates a PlatformContextSkia, the scale on |canvas| will
+ be equal to the content scale factor (which, without pinch-to-zoom, will be
+ the same as the device scale factor). Set this value as a member on PlatformContextSkia,
+ which will be used to correctly render glyphs when hinting is used and the device
+ scale factor is not 1.
+
+ Tests: added two new unit tests.
+
+ * platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp:
+ (WebCore::OpaqueRectTrackingContentLayerDelegate::paintContents):
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (WebCore::PlatformContextSkia::PlatformContextSkia):
+ (WebCore::PlatformContextSkia::setupPaintCommon):
+ * platform/graphics/skia/PlatformContextSkia.h:
+ (PlatformContextSkia):
+ (WebCore::PlatformContextSkia::setHintingScaleFactor):
+ (WebCore::PlatformContextSkia::hintingScaleFactor):
+
2012-09-19 Kenichi Ishibashi <[email protected]>
[Chromium] HarfBuzzShaper should take into account combining characters
Modified: trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp (129053 => 129054)
--- trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebCore/platform/graphics/chromium/OpaqueRectTrackingContentLayerDelegate.cpp 2012-09-19 22:43:51 UTC (rev 129054)
@@ -52,6 +52,10 @@
void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, const WebRect& clip, WebFloatRect& opaque)
{
PlatformContextSkia platformContext(canvas);
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+ if (canvas)
+ platformContext.setHintingScaleFactor(canvas->getTotalMatrix().getScaleX());
+#endif
platformContext.setTrackOpaqueRegion(!m_opaque);
GraphicsContext context(&platformContext);
Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (129053 => 129054)
--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2012-09-19 22:43:51 UTC (rev 129054)
@@ -188,6 +188,9 @@
, m_accelerated(false)
, m_deferred(false)
, m_drawingToImageBuffer(false)
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+ , m_hintingScaleFactor(SK_Scalar1)
+#endif
{
m_stateStack.append(State());
m_state = &m_stateStack.last();
@@ -357,6 +360,9 @@
paint->setAntiAlias(m_state->m_useAntialiasing);
paint->setXfermodeMode(m_state->m_xferMode);
paint->setLooper(m_state->m_looper);
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+ paint->setHintingScaleFactor(m_hintingScaleFactor);
+#endif
}
void PlatformContextSkia::setupShader(SkPaint* paint, Gradient* grad, Pattern* pat, SkColor color) const
Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h (129053 => 129054)
--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h 2012-09-19 22:43:51 UTC (rev 129054)
@@ -203,6 +203,11 @@
void adjustTextRenderMode(SkPaint*);
bool couldUseLCDRenderedText();
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+ void setHintingScaleFactor(SkScalar factor) { m_hintingScaleFactor = factor; }
+ SkScalar hintingScaleFactor() const { return m_hintingScaleFactor; }
+#endif
+
private:
// Used when restoring and the state has an image clip. Only shows the pixels in
// m_canvas that are also in imageBuffer.
@@ -234,6 +239,9 @@
bool m_accelerated;
bool m_deferred;
bool m_drawingToImageBuffer;
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+ SkScalar m_hintingScaleFactor;
+#endif
};
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (129053 => 129054)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-19 22:43:51 UTC (rev 129054)
@@ -1,3 +1,25 @@
+2012-09-19 Terry Anderson <[email protected]>
+
+ [chromium] Store the contents scale factor in PlatformContextSkia on initialization
+ https://bugs.webkit.org/show_bug.cgi?id=96137
+
+ Reviewed by Stephen White.
+
+ Define SK_SUPPORT_HINTING_SCALE_FACTOR by default. This is also used
+ for the skia patch here: https://codereview.appspot.com/6506099/.
+ Also added two new unit tests.
+
+ * features.gypi:
+ * tests/OpaqueRectTrackingContentLayerDelegateTest.cpp:
+ (WebCore):
+ (WebCore::HintingScaleCallback::HintingScaleCallback):
+ (HintingScaleCallback):
+ (WebCore::HintingScaleCallback::operator()):
+ (WebCore::TEST_F):
+ * tests/PlatformContextSkiaTest.cpp:
+ (WebCore):
+ (WebCore::TEST):
+
2012-09-19 David Grogan <[email protected]>
Disable some failing IDB tests
Modified: trunk/Source/WebKit/chromium/features.gypi (129053 => 129054)
--- trunk/Source/WebKit/chromium/features.gypi 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebKit/chromium/features.gypi 2012-09-19 22:43:51 UTC (rev 129054)
@@ -119,6 +119,7 @@
'ENABLE_WORKERS=1',
'ENABLE_XHR_RESPONSE_BLOB=1',
'ENABLE_XSLT=1',
+ 'SK_SUPPORT_HINTING_SCALE_FACTOR',
'WTF_USE_LEVELDB=1',
'WTF_USE_BUILTIN_UTF8_CODEC=1',
# WTF_USE_DYNAMIC_ANNOTATIONS=1 may be defined in build/common.gypi
Modified: trunk/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp (129053 => 129054)
--- trunk/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebKit/chromium/tests/OpaqueRectTrackingContentLayerDelegateTest.cpp 2012-09-19 22:43:51 UTC (rev 129054)
@@ -29,6 +29,7 @@
#include "Color.h"
#include "GraphicsContext.h"
#include "IntRect.h"
+#include "PlatformContextSkia.h"
#include "skia/ext/platform_canvas.h"
#include <public/WebFloatRect.h>
#include <public/WebRect.h>
@@ -100,6 +101,22 @@
IntRect m_opaqueRect;
};
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+struct HintingScaleCallback : public PaintCallback {
+ HintingScaleCallback()
+ : hintingScale(SK_Scalar1)
+ {
+ }
+
+ virtual void operator()(GraphicsContext& context, const IntRect& contentRect)
+ {
+ hintingScale = context.platformContext()->hintingScaleFactor();
+ }
+
+ SkScalar hintingScale;
+};
+#endif
+
#define EXPECT_EQ_RECT(a, b) \
EXPECT_EQ(a.x, b.x); \
EXPECT_EQ(a.width, b.width); \
@@ -194,4 +211,23 @@
EXPECT_EQ_RECT(WebFloatRect(partialRect.x(), partialRect.y(), partialRect.width(), partialRect.height()), opaqueRect);
}
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+TEST_F(OpaqueRectTrackingContentLayerDelegateTest, testHintingScaleFactorSet)
+{
+ HintingScaleCallback callback;
+ TestLayerPainterChromium painter(callback);
+ OpaqueRectTrackingContentLayerDelegate delegate(&painter);
+
+ SkScalar hintingScale = SkIntToScalar(2);
+ SkCanvas canvas;
+ canvas.scale(hintingScale, hintingScale);
+ EXPECT_EQ(callback.hintingScale, SK_Scalar1);
+
+ IntRect rectA;
+ WebFloatRect rectB;
+ delegate.paintContents(&canvas, rectA, rectB);
+ EXPECT_EQ(callback.hintingScale, hintingScale);
+}
+#endif
+
} // namespace
Modified: trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp (129053 => 129054)
--- trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp 2012-09-19 22:36:44 UTC (rev 129053)
+++ trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp 2012-09-19 22:43:51 UTC (rev 129054)
@@ -830,4 +830,21 @@
EXPECT_PIXELS_MATCH_EXACT(bitmap, platformContext.opaqueRegion().asRect());
}
+#if defined(SK_SUPPORT_HINTING_SCALE_FACTOR)
+TEST(PlatformContextSkiaTest, hintingScaleFactorAppliedOnPaint)
+{
+ SkBitmap bitmap;
+ SkCanvas canvas(bitmap);
+
+ SkScalar hintingScale = SkIntToScalar(2);
+ PlatformContextSkia platformContext(&canvas);
+ platformContext.setHintingScaleFactor(hintingScale);
+
+ SkPaint paint;
+ EXPECT_EQ(paint.getHintingScaleFactor(), SK_Scalar1);
+ platformContext.setupPaintCommon(&paint);
+ EXPECT_EQ(paint.getHintingScaleFactor(), hintingScale);
+}
+#endif
+
} // namespace