diff options
Diffstat (limited to 'Source/WebKit/android/nav/WebView.cpp')
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index a4381e6..44ad1c5 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -306,7 +306,8 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, DrawExtras extras, bool spli int sc = canvas->save(SkCanvas::kClip_SaveFlag); canvas->clipRect(SkRect::MakeLTRB(0, 0, content->width(), content->height()), SkRegion::kDifference_Op); - canvas->drawColor(bgColor); + Color c = m_baseLayer->getBackgroundColor(); + canvas->drawColor(SkColorSetARGBInline(c.alpha(), c.red(), c.green(), c.blue())); canvas->restoreToCount(sc); // call this to be sure we've adjusted for any scrolling or animations @@ -592,6 +593,19 @@ void setTextSelection(SelectText *selection) { setDrawExtra(selection, DrawExtrasSelection); } +const TransformationMatrix* getLayerTransform(int layerId) { + if (layerId != -1 && m_baseLayer) { + LayerAndroid* layer = m_baseLayer->findById(layerId); + // We need to make sure the drawTransform is up to date as this is + // called before a draw() or drawGL() + if (layer) { + m_baseLayer->updateLayerPositions(m_visibleRect); + return layer->drawTransform(); + } + } + return 0; +} + int getHandleLayerId(SelectText::HandleId handleId, SkIPoint& cursorPoint, FloatQuad& textBounds) { SelectText* selectText = static_cast<SelectText*>(getDrawExtra(DrawExtrasSelection)); @@ -602,36 +616,24 @@ int getHandleLayerId(SelectText::HandleId handleId, SkIPoint& cursorPoint, IntRect textRect = selectText->textRect(handleId); // Rects exclude the last pixel on right/bottom. We want only included pixels. cursorPoint.set(cursorRect.x(), cursorRect.maxY() - 1); - textRect.setHeight(textRect.height() - 1); - textRect.setWidth(textRect.width() - 1); + textRect.setHeight(std::max(1, textRect.height() - 1)); + textRect.setWidth(std::max(1, textRect.width() - 1)); textBounds = FloatQuad(textRect); - if (layerId != -1) { - // We need to make sure the drawTransform is up to date as this is - // called before a draw() or drawGL() - m_baseLayer->updateLayerPositions(m_visibleRect); - LayerAndroid* root = m_baseLayer; - LayerAndroid* layer = root ? root->findById(layerId) : 0; - if (layer && layer->drawTransform()) { - const TransformationMatrix* transform = layer->drawTransform(); - // We're overloading the concept of Rect to be just the two - // points (bottom-left and top-right. - cursorPoint = transform->mapPoint(cursorPoint); - textBounds = transform->mapQuad(textBounds); - } + const TransformationMatrix* transform = getLayerTransform(layerId); + if (transform) { + // We're overloading the concept of Rect to be just the two + // points (bottom-left and top-right. + cursorPoint = transform->mapPoint(cursorPoint); + textBounds = transform->mapQuad(textBounds); } return layerId; } void mapLayerRect(int layerId, SkIRect& rect) { - if (layerId != -1) { - // We need to make sure the drawTransform is up to date as this is - // called before a draw() or drawGL() - m_baseLayer->updateLayerPositions(m_visibleRect); - LayerAndroid* layer = m_baseLayer ? m_baseLayer->findById(layerId) : 0; - if (layer && layer->drawTransform()) - rect = layer->drawTransform()->mapRect(rect); - } + const TransformationMatrix* transform = getLayerTransform(layerId); + if (transform) + transform->mapRect(rect); } void floatQuadToQuadF(JNIEnv* env, const FloatQuad& nativeTextQuad, |