diff options
Diffstat (limited to 'Source/WebCore')
4 files changed, 46 insertions, 30 deletions
diff --git a/Source/WebCore/platform/android/ScrollViewAndroid.cpp b/Source/WebCore/platform/android/ScrollViewAndroid.cpp index f54e5ea..f29e998 100644 --- a/Source/WebCore/platform/android/ScrollViewAndroid.cpp +++ b/Source/WebCore/platform/android/ScrollViewAndroid.cpp @@ -100,7 +100,8 @@ void ScrollView::platformSetScrollPosition(const WebCore::IntPoint& pt) { if (parent()) // don't attempt to scroll subframes; they're fully visible return; - PlatformBridge::setScrollPosition(this, pt.x(), pt.y()); + PlatformBridge::setScrollPosition(this, m_scrollOrigin.x() + pt.x(), + m_scrollOrigin.y() + pt.y()); } void ScrollView::platformSetScrollbarModes() @@ -119,7 +120,9 @@ void ScrollView::platformScrollbarModes(ScrollbarMode& h, ScrollbarMode& v) cons void ScrollView::platformRepaintContentRectangle(const IntRect &rect, bool now) { - android::WebViewCore::getWebViewCore(this)->contentInvalidate(rect); + IntRect offsetRect = rect; + offsetRect.move(m_scrollOrigin.x(), m_scrollOrigin.y()); + android::WebViewCore::getWebViewCore(this)->contentInvalidate(offsetRect); } #ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp index 3528d47..81dbdae 100644 --- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp @@ -59,6 +59,9 @@ using namespace android; namespace WebCore { +typedef std::pair<int, float> FallbackFontKey; +typedef HashMap<FallbackFontKey, FontPlatformData*> FallbackHash; + static void updateForFont(SkPaint* paint, const SimpleFontData* font) { font->platformData().setupPaint(paint); paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding); @@ -445,16 +448,17 @@ public: private: enum CustomScript { - Hindi, - Thai, - Naskh, + Bengali, + Devanagari, Hebrew, HebrewBold, + Naskh, + Tamil, + Thai, NUM_SCRIPTS }; static const char* paths[NUM_SCRIPTS]; - static const FontPlatformData* s_fallbackPlatformData[NUM_SCRIPTS]; void setupFontForScriptRun(); const FontPlatformData* setupComplexFont(CustomScript script, @@ -502,16 +506,15 @@ private: // Indexed using enum CustomScript const char* TextRunWalker::paths[] = { + "/system/fonts/Lohit-Bengali.ttf", "/system/fonts/Lohit-Devanagari.ttf", - "/system/fonts/DroidSansThai.ttf", - "/system/fonts/DroidNaskh-Regular.ttf", "/system/fonts/DroidSansHebrew-Regular.ttf", - "/system/fonts/DroidSansHebrew-Bold.ttf" + "/system/fonts/DroidSansHebrew-Bold.ttf", + "/system/fonts/DroidNaskh-Regular.ttf", + "/system/fonts/Lohit-Tamil.ttf", + "/system/fonts/DroidSansThai.ttf" }; -// Indexed using enum CustomScript -const FontPlatformData* TextRunWalker::s_fallbackPlatformData[] = {}; - TextRunWalker::TextRunWalker(const TextRun& run, unsigned startingX, const Font* font) : m_font(font) , m_startingX(startingX) @@ -668,17 +671,23 @@ const FontPlatformData* TextRunWalker::setupComplexFont( CustomScript script, const FontPlatformData& platformData) { - if (!s_fallbackPlatformData[script]) { + static FallbackHash fallbackPlatformData; + + FallbackFontKey key(script, platformData.size()); + FontPlatformData* newPlatformData = 0; + + if (!fallbackPlatformData.contains(key)) { SkTypeface* typeface = SkTypeface::CreateFromFile(paths[script]); - s_fallbackPlatformData[script] = new FontPlatformData(platformData, typeface); + newPlatformData = new FontPlatformData(platformData, typeface); SkSafeUnref(typeface); + fallbackPlatformData.set(key, newPlatformData); } - // If we couldn't allocate a new FontPlatformData, revert to the one passed - if (!s_fallbackPlatformData[script]) - return &platformData; + if (!newPlatformData) + newPlatformData = fallbackPlatformData.get(key); - return s_fallbackPlatformData[script]; + // If we couldn't allocate a new FontPlatformData, revert to the one passed + return newPlatformData ? newPlatformData : &platformData; } void TextRunWalker::setupFontForScriptRun() @@ -689,14 +698,11 @@ void TextRunWalker::setupFontForScriptRun() const FontPlatformData* complexPlatformData = &platformData; switch (m_item.item.script) { + case HB_Script_Bengali: + complexPlatformData = setupComplexFont(Bengali, platformData); + break; case HB_Script_Devanagari: - complexPlatformData = setupComplexFont(Hindi, platformData); - break; - case HB_Script_Thai: - complexPlatformData = setupComplexFont(Thai, platformData); - break; - case HB_Script_Arabic: - complexPlatformData = setupComplexFont(Naskh, platformData); + complexPlatformData = setupComplexFont(Devanagari, platformData); break; case HB_Script_Hebrew: switch (platformData.typeface()->style()) { @@ -711,6 +717,15 @@ void TextRunWalker::setupFontForScriptRun() break; } break; + case HB_Script_Arabic: + complexPlatformData = setupComplexFont(Naskh, platformData); + break; + case HB_Script_Tamil: + complexPlatformData = setupComplexFont(Tamil, platformData); + break; + case HB_Script_Thai: + complexPlatformData = setupComplexFont(Thai, platformData); + break; default: // HB_Script_Common; includes Ethiopic complexPlatformData = &platformData; diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index e997b57..fa22593 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -549,10 +549,8 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, // TODO: upload as many textures as possible within a certain time limit bool ret = ImagesManager::instance()->uploadTextures(); - if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) { + if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) XLOGC("WARNING, scale seems corrupted after update: %e", scale); - CRASH(); - } // gather the textures we can use TilesManager::instance()->gatherLayerTextures(); diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index c097c58..3c262d4 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -374,8 +374,8 @@ void TiledPage::draw(float transparency, const SkIRect& tileBounds) bool TiledPage::paint(BaseTile* tile, SkCanvas* canvas, unsigned int* pictureUsed) { - // TODO: consider other flags so the pre-rendered tiles aren't so ugly - static SkPaintFlagsDrawFilter prefetchFilter(SkPaint::kAllFlags, 0); + static SkPaintFlagsDrawFilter prefetchFilter(SkPaint::kAllFlags, + SkPaint::kAntiAlias_Flag); if (!m_glWebViewState) return false; |