diff options
Diffstat (limited to 'WebCore')
4 files changed, 43 insertions, 13 deletions
diff --git a/WebCore/platform/android/RenderThemeAndroid.cpp b/WebCore/platform/android/RenderThemeAndroid.cpp index 944504e..113fa63 100644 --- a/WebCore/platform/android/RenderThemeAndroid.cpp +++ b/WebCore/platform/android/RenderThemeAndroid.cpp @@ -44,6 +44,7 @@ #include "RenderSkinRadio.h" #include "SkCanvas.h" #include "UserAgentStyleSheets.h" +#include "WebCoreFrameBridge.h" namespace WebCore { @@ -67,6 +68,13 @@ static SkCanvas* getCanvasFromInfo(const PaintInfo& info) return info.context->platformContext()->mCanvas; } +static android::WebFrame* getWebFrame(const Node* node) +{ + if (!node) + return 0; + return android::WebFrame::getWebFrame(node->document()->frame()); +} + RenderTheme* theme() { DEFINE_STATIC_LOCAL(RenderThemeAndroid, androidTheme, ()); @@ -223,9 +231,15 @@ bool RenderThemeAndroid::paintButton(RenderObject* obj, const PaintInfo& info, c // If it is a disabled button, simply paint it to the master picture. Node* node = obj->node(); Element* formControlElement = static_cast<Element*>(node); - if (formControlElement && !formControlElement->isEnabledFormControl()) - RenderSkinButton::Draw(getCanvasFromInfo(info), rect, RenderSkinAndroid::kDisabled); - else + if (formControlElement && !formControlElement->isEnabledFormControl()) { + android::WebFrame* webFrame = getWebFrame(node); + if (webFrame) { + const RenderSkinAndroid* skins = webFrame->renderSkins(); + if (skins) + skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect, + RenderSkinAndroid::kDisabled); + } + } else // Store all the important information in the platform context. info.context->platformContext()->storeButtonInfo(node, rect); diff --git a/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp index 352516b..337a94d 100644 --- a/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp +++ b/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp @@ -163,11 +163,15 @@ void FontPlatformData::setupPaint(SkPaint* paint) const if (!(ts > 0)) ts = 12; + if (hashTableDeletedFontValue() == mTypeface) + paint->setTypeface(0); + else + paint->setTypeface(mTypeface); + paint->setAntiAlias(true); paint->setSubpixelText(true); paint->setHinting(SkPaint::kSlight_Hinting); paint->setTextSize(SkFloatToScalar(ts)); - paint->setTypeface(mTypeface); paint->setFakeBoldText(mFakeBold); paint->setTextSkewX(mFakeItalic ? -SK_Scalar1/4 : 0); #ifndef SUPPORT_COMPLEX_SCRIPTS @@ -177,7 +181,10 @@ void FontPlatformData::setupPaint(SkPaint* paint) const uint32_t FontPlatformData::uniqueID() const { - return mTypeface->uniqueID(); + if (hashTableDeletedFontValue() == mTypeface) + return SkTypeface::UniqueID(0); + else + return SkTypeface::UniqueID(mTypeface); } bool FontPlatformData::operator==(const FontPlatformData& a) const @@ -207,7 +214,10 @@ unsigned FontPlatformData::hash() const bool FontPlatformData::isFixedPitch() const { - return mTypeface ? mTypeface->isFixedWidth() : false; + if (mTypeface && (mTypeface != hashTableDeletedFontValue())) + return mTypeface->isFixedWidth(); + else + return false; } HB_FaceRec_* FontPlatformData::harfbuzzFace() const diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index f9df8cc..ef0cc25 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -70,10 +70,16 @@ template <typename T> T* deepCopyPtr(const T* src) // Is Color premultiplied or not? If it is, then I can't blindly pass it to paint.setColor() struct ShadowRec { - SkScalar blur; // >0 means valid shadow + SkScalar blur; SkScalar dx; SkScalar dy; - SkColor color; + SkColor color; // alpha>0 means valid shadow + ShadowRec(SkScalar b = 0, + SkScalar x = 0, + SkScalar y = 0, + SkColor c = 0) // by default, alpha=0, so no shadow + : blur(b), dx(x), dy(y), color(c) + {}; }; class GraphicsContextPlatformPrivate { @@ -110,7 +116,6 @@ public: , strokeColor(SK_ColorBLACK) , useAA(true) { - shadow.blur = 0; } State(const State& other) @@ -252,7 +257,7 @@ public: paint->setAntiAlias(m_state->useAA); paint->setDither(true); paint->setXfermodeMode(m_state->mode); - if (m_state->shadow.blur > 0) { + if (SkColorGetA(m_state->shadow.color) > 0) { SkDrawLooper* looper = new SkBlurDrawLooper(m_state->shadow.blur, m_state->shadow.dx, m_state->shadow.dy, diff --git a/WebCore/platform/graphics/android/PlatformGraphicsContext.h b/WebCore/platform/graphics/android/PlatformGraphicsContext.h index 8d0df36..0ce86d2 100644 --- a/WebCore/platform/graphics/android/PlatformGraphicsContext.h +++ b/WebCore/platform/graphics/android/PlatformGraphicsContext.h @@ -106,7 +106,8 @@ public: // corresponds to the focused node passed in. If its state has changed, // re-record to the subpicture, so the master picture will reflect the // change. - void updateFocusState(WebCore::RenderSkinAndroid::State state) + void updateFocusState(WebCore::RenderSkinAndroid::State state, + const WebCore::RenderSkinButton* buttonSkin) { if (state == m_state) return; @@ -117,8 +118,8 @@ public: state == WebCore::RenderSkinAndroid::kFocused) return; m_state = state; - SkCanvas* canvas = m_picture->beginRecording(m_rect.width(), m_rect.height()); - WebCore::RenderSkinButton::Draw(canvas, m_rect, state); + SkCanvas* canvas = m_picture->beginRecording(m_rect.right(), m_rect.bottom()); + buttonSkin->draw(canvas, m_rect, state); m_picture->endRecording(); } private: |