summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/context
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-10-02 13:50:20 -0700
committerChris Craik <ccraik@google.com>2012-10-02 13:50:20 -0700
commit85fb59060a0fdfcff93ae1c70dd49e0f93e55ab6 (patch)
treec05d501db2bb2bc6cd263beddd5f2314a539d154 /Source/WebCore/platform/graphics/android/context
parent224e946b3cabeaa9c360bdd6865485b5acb34cdc (diff)
downloadexternal_webkit-85fb59060a0fdfcff93ae1c70dd49e0f93e55ab6.zip
external_webkit-85fb59060a0fdfcff93ae1c70dd49e0f93e55ab6.tar.gz
external_webkit-85fb59060a0fdfcff93ae1c70dd49e0f93e55ab6.tar.bz2
Compensate for canvas-side vertical text translation in bounding box computation
bug:7267294 Change-Id: Ia6de9264b6c3680707b8fb8833d69d7cc7e850e8
Diffstat (limited to 'Source/WebCore/platform/graphics/android/context')
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h1
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h2
-rw-r--r--Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.h1
4 files changed, 6 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h
index 56aceff..14537c8 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContext.h
@@ -148,6 +148,7 @@ public:
const IntRect& thumb = IntRect()) = 0;
virtual SkCanvas* recordingCanvas() = 0;
+ virtual void setTextOffset(FloatSize offset) = 0;
void setRawState(State* state) { m_state = state; }
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
index 867ff56..8c87cfb 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.cpp
@@ -914,6 +914,8 @@ void PlatformGraphicsContextRecording::drawPosText(const void* inText, size_t by
return;
}
FloatRect bounds = approximateTextBounds(byteLength / sizeof(uint16_t), inPos, inPaint);
+ bounds.move(m_textOffset); // compensate font rendering-side translates
+
const SkPaint* paint = mRecording->recording()->getSkPaint(inPaint);
size_t posSize = sizeof(SkPoint) * paint->countText(inText, byteLength);
void* text = heap()->alloc(byteLength);
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h
index 061ee0e..b120ac3 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextRecording.h
@@ -64,6 +64,7 @@ public:
virtual bool isPaintingDisabled();
virtual SkCanvas* recordingCanvas();
+ virtual void setTextOffset(FloatSize offset) { m_textOffset = offset; }
virtual ContextType type() { return RecordingContext; }
@@ -209,6 +210,7 @@ private:
bool m_hasText;
bool m_isEmpty;
RecordingContextCanvasProxy m_canvasProxy;
+ FloatSize m_textOffset;
};
}
diff --git a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.h b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.h
index 6bf53d7..2c1d8cb 100644
--- a/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.h
+++ b/Source/WebCore/platform/graphics/android/context/PlatformGraphicsContextSkia.h
@@ -39,6 +39,7 @@ public:
virtual ContextType type() { return PaintingContext; }
virtual SkCanvas* recordingCanvas() { return mCanvas; }
+ virtual void setTextOffset(FloatSize offset) {}
// FIXME: This is used by ImageBufferAndroid, which should really be
// managing the canvas lifecycle itself