summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/svg
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-11-24 14:02:29 +0000
committerSteve Block <steveblock@google.com>2011-11-24 14:02:29 +0000
commit7839f0a8c60340239148921eb35c3e2afc750701 (patch)
tree3d658e1608d073dfb43f921e9130d659f582751b /Source/WebCore/rendering/svg
parent3eaf0f8cdb150a43732c8391a73046811b3c378d (diff)
downloadexternal_webkit-7839f0a8c60340239148921eb35c3e2afc750701.zip
external_webkit-7839f0a8c60340239148921eb35c3e2afc750701.tar.gz
external_webkit-7839f0a8c60340239148921eb35c3e2afc750701.tar.bz2
Fix SVG text rendering
Android's implementation of GraphicsContext::setCTM() is broken, because Skia's Picture mode does not support setMatrix(). This broken code was added in https://android-git.corp.google.com/g/#/c/112636 as part of the merge to WebKit r80534. This change modifies SVGInlineTextBox to avoid calling GraphicsContext::setCTM() and makes clear that the method should not be used. Bug: 5590123 Change-Id: I45a3c8c356b7f068bb943a45b9f10cbc041331e2
Diffstat (limited to 'Source/WebCore/rendering/svg')
-rw-r--r--Source/WebCore/rendering/svg/SVGInlineTextBox.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
index bc550a6..bb34652 100644
--- a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
+++ b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
@@ -573,11 +573,18 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, ETextD
width *= scalingFactor;
decorationOrigin.scale(scalingFactor, scalingFactor);
+#if PLATFORM(ANDROID)
+ // Android does not support GraphicsContext::setCTM().
+ AffineTransform scaleTransform;
+ scaleTransform.scale(1 / scalingFactor);
+ context->concatCTM(scaleTransform);
+#else
AffineTransform newTransform = context->getCTM();
newTransform.scale(1 / scalingFactor);
normalizeTransform(newTransform);
context->setCTM(newTransform);
+#endif
}
decorationOrigin.move(0, -scaledFontMetrics.floatAscent() + positionOffsetForDecoration(decoration, scaledFontMetrics, thickness));
@@ -622,6 +629,13 @@ void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl
AffineTransform originalTransform;
if (scalingFactor != 1) {
+#if PLATFORM(ANDROID)
+ // Android does not support GraphicsContext::setCTM().
+ context->save();
+ AffineTransform scaleTransform;
+ scaleTransform.scale(1 / scalingFactor);
+ context->concatCTM(scaleTransform);
+#else
originalTransform = context->getCTM();
AffineTransform newTransform = originalTransform;
@@ -629,12 +643,18 @@ void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl
normalizeTransform(newTransform);
context->setCTM(newTransform);
+#endif
}
scaledFont.drawText(context, textRun, textOrigin + extraOffset, startPosition, endPosition);
if (scalingFactor != 1)
+#if PLATFORM(ANDROID)
+ // Android does not support GraphicsContext::setCTM().
+ context->restore();
+#else
context->setCTM(originalTransform);
+#endif
restoreGraphicsContextAfterTextPainting(context, textRun);