diff options
Diffstat (limited to 'Source')
7 files changed, 41 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp index e26fa9e..7bed5bb 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp @@ -63,6 +63,7 @@ using namespace android; namespace WebCore { typedef std::pair<int, float> FallbackFontKey; + typedef HashMap<FallbackFontKey, FontPlatformData*> FallbackHash; static void updateForFont(SkPaint* paint, const SimpleFontData* font) { @@ -696,7 +697,17 @@ const FontPlatformData* TextRunWalker::setupComplexFont( { static FallbackHash fallbackPlatformData; - FallbackFontKey key(script, platformData.size()); + // generate scriptStyleIndex - we need unique hash IDs for each style + // of each script - normal, bold, italic, bolditalic. the first set of + // NUM_SCRIPTS are the normal style version, followed by bold, then + // italic, then bold italic. additional fake style bits can be added. + int scriptStyleIndex = script; + if (platformData.isFakeBold()) + scriptStyleIndex += NUM_SCRIPTS; + if (platformData.isFakeItalic()) + scriptStyleIndex += NUM_SCRIPTS << 1; + + FallbackFontKey key(scriptStyleIndex, platformData.size()); FontPlatformData* newPlatformData = 0; if (!fallbackPlatformData.contains(key)) { diff --git a/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp index 5696a46..4bb388c 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp @@ -175,7 +175,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD } result = new FontPlatformData(tf, fontDescription.computedSize(), - (style & SkTypeface::kBold) && !tf->isBold(), + (style & SkTypeface::kBold), (style & SkTypeface::kItalic) && !tf->isItalic(), fontDescription.orientation(), fontDescription.textOrientation()); diff --git a/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h b/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h index 1e46971..02a0cea 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h @@ -92,6 +92,9 @@ public: HB_FaceRec_* harfbuzzFace() const; SkTypeface* typeface() const { return mTypeface; } + bool isFakeBold() const { return mFakeBold; } + bool isFakeItalic() const { return mFakeItalic; } + private: class RefCountedHarfbuzzFace : public RefCounted<RefCountedHarfbuzzFace> { public: diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp index 8069778..9ee97ac 100644 --- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp @@ -89,7 +89,8 @@ void BaseLayerAndroid::updatePositionsRecursive(const SkRect& visibleContentRect // dynamically increase in size to cover the viewport, and we cache its draw // clip. This way the base layer will never have it's visible area clipped // by its m_clippingRect, only the viewport. - FloatRect clip(0, 0, 1e10, 1e10); + // Note: values larger than this suffer from floating point rounding issues + FloatRect clip(0, 0, 1e7, 1e7); bool forcePositionCalculation = !m_positionsCalculated; float scale = 1.0f; diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp index 0f01fe2..d709a9c 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp @@ -273,6 +273,9 @@ void LayerAndroid::addDirtyArea() return; } + // TODO: rewrite this to handle partial invalidate, and to handle base + // layer's large clip correctly + IntSize layerSize(getSize().width(), getSize().height()); FloatRect area = @@ -284,6 +287,7 @@ void LayerAndroid::addDirtyArea() area.intersect(clip); IntRect dirtyArea(area.x(), area.y(), area.width(), area.height()); + state()->addDirtyArea(dirtyArea); } diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index d68051d..73466d3 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -90,13 +90,24 @@ bool Surface::tryUpdateSurface(Surface* oldSurface) return true; } + SkRegion invalRegion; + bool fullInval = false; if (singleLayer() && oldSurface->singleLayer()) { // both are single matching layers, simply apply inval SkRegion* layerInval = getFirstLayer()->getInvalRegion(); - m_surfaceBacking->markAsDirty(*layerInval); + invalRegion = *layerInval; + + if (isBase()) { + // the base layer paints outside it's content area to ensure the + // viewport is convered, so fully invalidate all tiles if its size + // changes to ensure no stale content remains + LayerContent* newContent = getFirstLayer()->content(); + LayerContent* oldContent = oldSurface->getFirstLayer()->content(); + fullInval = newContent->width() != oldContent->width() + || newContent->height() != oldContent->height(); + } } else { - SkRegion invalRegion; - bool fullInval = m_layers.size() != oldSurface->m_layers.size(); + fullInval = m_layers.size() != oldSurface->m_layers.size(); if (!fullInval) { for (unsigned int i = 0; i < m_layers.size(); i++) { if ((m_layers[i]->uniqueId() != oldSurface->m_layers[i]->uniqueId()) @@ -111,16 +122,15 @@ bool Surface::tryUpdateSurface(Surface* oldSurface) FloatRect layerPos = m_layers[i]->fullContentAreaMapped(); m_layers[i]->getInvalRegion()->translate(layerPos.x(), layerPos.y()); invalRegion.op(*(m_layers[i]->getInvalRegion()), SkRegion::kUnion_Op); - break; } } } + } - if (fullInval) - invalRegion.setRect(-1e8, -1e8, 2e8, 2e8); + if (fullInval) + invalRegion.setRect(-1e8, -1e8, 2e8, 2e8); - m_surfaceBacking->markAsDirty(invalRegion); - } + m_surfaceBacking->markAsDirty(invalRegion); return true; } diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index fae566c..5e2354b 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -716,7 +716,7 @@ void findMaxVisibleRect(int movingLayerId, SkIRect& visibleContentRect) if (findMaskedRectsForLayer(m_baseLayer, rects, movingLayerId)) { float maxSize = 0.0; const FloatRect* largest = 0; - for (int i = 0; i < rects.size(); i++) { + for (unsigned int i = 0; i < rects.size(); i++) { const FloatRect& rect = rects[i]; float size = rect.width() * rect.height(); if (size > maxSize) { |