diff options
Diffstat (limited to 'Source/WebCore')
26 files changed, 239 insertions, 401 deletions
diff --git a/Source/WebCore/css/AndroidCSSPropertyNames.in b/Source/WebCore/css/AndroidCSSPropertyNames.in index ef67d6b..be751da 100644 --- a/Source/WebCore/css/AndroidCSSPropertyNames.in +++ b/Source/WebCore/css/AndroidCSSPropertyNames.in @@ -21,14 +21,5 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # --webkit-ring --webkit-ring-fill-color --webkit-ring-inner-width --webkit-ring-outer-width --webkit-ring-outset --webkit-ring-pressed-inner-color --webkit-ring-pressed-outer-color --webkit-ring-radius --webkit-ring-selected-inner-color --webkit-ring-selected-outer-color + -webkit-tap-highlight-color diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 4c0571d..4922109 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -291,18 +291,6 @@ static const int computedProperties[] = { CSSPropertyWebkitSvgShadow, CSSPropertyVectorEffect #endif -#ifdef ANDROID_CSS_RING - , - CSSPropertyWebkitRingFillColor, - CSSPropertyWebkitRingInnerWidth, - CSSPropertyWebkitRingOuterWidth, - CSSPropertyWebkitRingOutset, - CSSPropertyWebkitRingPressedInnerColor, - CSSPropertyWebkitRingPressedOuterColor, - CSSPropertyWebkitRingRadius, - CSSPropertyWebkitRingSelectedInnerColor, - CSSPropertyWebkitRingSelectedOuterColor -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , CSSPropertyWebkitTapHighlightColor @@ -1818,29 +1806,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitTransformOriginZ: case CSSPropertyWebkitTransition: break; -#ifdef ANDROID_CSS_RING - case CSSPropertyWebkitRing: - // shorthand property currently not supported see bug 13658 - break; - case CSSPropertyWebkitRingFillColor: - return primitiveValueCache->createColorValue(style->ringFillColor().rgb()); - case CSSPropertyWebkitRingInnerWidth: - return primitiveValueCache->createValue(style->ringInnerWidth()); - case CSSPropertyWebkitRingOuterWidth: - return primitiveValueCache->createValue(style->ringOuterWidth()); - case CSSPropertyWebkitRingOutset: - return primitiveValueCache->createValue(style->ringOutset()); - case CSSPropertyWebkitRingPressedInnerColor: - return primitiveValueCache->createColorValue(style->ringPressedInnerColor().rgb()); - case CSSPropertyWebkitRingPressedOuterColor: - return primitiveValueCache->createColorValue(style->ringPressedOuterColor().rgb()); - case CSSPropertyWebkitRingRadius: - return primitiveValueCache->createValue(style->ringRadius()); - case CSSPropertyWebkitRingSelectedInnerColor: - return primitiveValueCache->createColorValue(style->ringSelectedInnerColor().rgb()); - case CSSPropertyWebkitRingSelectedOuterColor: - return primitiveValueCache->createColorValue(style->ringSelectedOuterColor().rgb()); -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: return primitiveValueCache->createColorValue(style->tapHighlightColor().rgb()); diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp index ba3332d..ece418a 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.cpp @@ -261,20 +261,6 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const return value->cssText(); } #endif -#ifdef ANDROID_CSS_RING - case CSSPropertyWebkitRing: { - const int properties[9] = { CSSPropertyWebkitRingFillColor, - CSSPropertyWebkitRingInnerWidth, - CSSPropertyWebkitRingOuterWidth, - CSSPropertyWebkitRingOutset, - CSSPropertyWebkitRingPressedInnerColor, - CSSPropertyWebkitRingPressedOuterColor, - CSSPropertyWebkitRingRadius, - CSSPropertyWebkitRingSelectedInnerColor, - CSSPropertyWebkitRingSelectedOuterColor }; - return getLayeredShorthandValue(properties, 9); - } -#endif } return String(); } diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 78b6b24..b78a6d0 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -2008,36 +2008,6 @@ bool CSSParser::parseValue(int propId, bool important) return parseLineBoxContain(important); break; -#ifdef ANDROID_CSS_RING - case CSSPropertyWebkitRing: - { - const int properties[9] = { CSSPropertyWebkitRingFillColor, - CSSPropertyWebkitRingInnerWidth, - CSSPropertyWebkitRingOuterWidth, - CSSPropertyWebkitRingOutset, - CSSPropertyWebkitRingPressedInnerColor, - CSSPropertyWebkitRingPressedOuterColor, - CSSPropertyWebkitRingRadius, - CSSPropertyWebkitRingSelectedInnerColor, - CSSPropertyWebkitRingSelectedOuterColor }; - return parseShorthand(propId, properties, 9, important); - } - case CSSPropertyWebkitRingFillColor: - case CSSPropertyWebkitRingPressedInnerColor: - case CSSPropertyWebkitRingPressedOuterColor: - case CSSPropertyWebkitRingSelectedInnerColor: - case CSSPropertyWebkitRingSelectedOuterColor: - parsedValue = parseColor(); - if (parsedValue) - m_valueList->next(); - break; - case CSSPropertyWebkitRingInnerWidth: - case CSSPropertyWebkitRingOuterWidth: - case CSSPropertyWebkitRingOutset: - case CSSPropertyWebkitRingRadius: - validPrimitive = validUnit(value, FLength | FNonNeg, m_strict); - break; -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: parsedValue = parseColor(); diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index b79f2dc..0b6fd35 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -6054,138 +6054,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) ASSERT_NOT_REACHED(); return; -#ifdef ANDROID_CSS_RING - case CSSPropertyWebkitRing: - if (valueType != CSSValue::CSS_INHERIT || !m_parentNode) return; - m_style->setRingFillColor(m_parentStyle->ringFillColor()); - m_style->setRingInnerWidth(m_parentStyle->ringInnerWidth()); - m_style->setRingOuterWidth(m_parentStyle->ringOuterWidth()); - m_style->setRingOutset(m_parentStyle->ringOutset()); - m_style->setRingPressedInnerColor(m_parentStyle->ringPressedInnerColor()); - m_style->setRingPressedOuterColor(m_parentStyle->ringPressedOuterColor()); - m_style->setRingRadius(m_parentStyle->ringRadius()); - m_style->setRingSelectedInnerColor(m_parentStyle->ringSelectedInnerColor()); - m_style->setRingSelectedOuterColor(m_parentStyle->ringSelectedOuterColor()); - return; - case CSSPropertyWebkitRingFillColor: { - HANDLE_INHERIT_AND_INITIAL(ringFillColor, RingFillColor); - if (!primitiveValue) - break; - Color col = getColorFromPrimitiveValue(primitiveValue).blendWithWhite(); - m_style->setRingFillColor(col); - return; - } - case CSSPropertyWebkitRingInnerWidth: { - HANDLE_INHERIT_AND_INITIAL(ringInnerWidth, RingInnerWidth) - if (!primitiveValue) - break; - Length l; - int type = primitiveValue->primitiveType(); - if (CSSPrimitiveValue::isUnitTypeLength(type)) { - // width can be specified with fractional px - // scale by 16 here (and unscale in android_graphics) to keep - // 4 bits of fraction - RefPtr<CSSPrimitiveValue> scaledValue = CSSPrimitiveValue::create( - primitiveValue->getFloatValue() * 16, - (CSSPrimitiveValue::UnitTypes) type); - l = Length(scaledValue->computeLengthIntForLength(style(), - m_rootElementStyle, zoomFactor), Fixed); - scaledValue.release(); - } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) - l = Length(primitiveValue->getDoubleValue(), Percent); - else - return; - m_style->setRingInnerWidth(l); - return; - } - case CSSPropertyWebkitRingOuterWidth: { - HANDLE_INHERIT_AND_INITIAL(ringOuterWidth, RingOuterWidth) - if (!primitiveValue) - break; - Length l; - int type = primitiveValue->primitiveType(); - if (CSSPrimitiveValue::isUnitTypeLength(type)) { - // width can be specified with fractional px - // scale by 16 here (and unscale in android_graphics) to keep - // 4 bits of fraction - RefPtr<CSSPrimitiveValue> scaledValue = CSSPrimitiveValue::create( - primitiveValue->getFloatValue() * 16, - (CSSPrimitiveValue::UnitTypes) type); - l = Length(scaledValue->computeLengthIntForLength(style(), - m_rootElementStyle, zoomFactor), Fixed); - scaledValue.release(); - } else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) - l = Length(primitiveValue->getDoubleValue(), Percent); - else - return; - m_style->setRingOuterWidth(l); - return; - } - case CSSPropertyWebkitRingOutset: { - HANDLE_INHERIT_AND_INITIAL(ringOutset, RingOutset) - if (!primitiveValue) - break; - Length l; - int type = primitiveValue->primitiveType(); - if (CSSPrimitiveValue::isUnitTypeLength(type)) - l = Length(primitiveValue->computeLengthIntForLength(style(), - m_rootElementStyle, zoomFactor), Fixed); - else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) - l = Length(primitiveValue->getDoubleValue(), Percent); - else - return; - m_style->setRingOutset(l); - return; - } - case CSSPropertyWebkitRingPressedInnerColor: { - HANDLE_INHERIT_AND_INITIAL(ringPressedInnerColor, RingPressedInnerColor); - if (!primitiveValue) - break; - Color col = getColorFromPrimitiveValue(primitiveValue).blendWithWhite(); - m_style->setRingPressedInnerColor(col); - return; - } - case CSSPropertyWebkitRingPressedOuterColor: { - HANDLE_INHERIT_AND_INITIAL(ringPressedOuterColor, RingPressedOuterColor); - if (!primitiveValue) - break; - Color col = getColorFromPrimitiveValue(primitiveValue).blendWithWhite(); - m_style->setRingPressedOuterColor(col); - return; - } - case CSSPropertyWebkitRingRadius: { - HANDLE_INHERIT_AND_INITIAL(ringRadius, RingRadius) - if (!primitiveValue) - break; - Length l; - int type = primitiveValue->primitiveType(); - if (CSSPrimitiveValue::isUnitTypeLength(type)) - l = Length(primitiveValue->computeLengthIntForLength(style(), - m_rootElementStyle, zoomFactor), Fixed); - else if (type == CSSPrimitiveValue::CSS_PERCENTAGE) - l = Length(primitiveValue->getDoubleValue(), Percent); - else - return; - m_style->setRingRadius(l); - return; - } - case CSSPropertyWebkitRingSelectedInnerColor: { - HANDLE_INHERIT_AND_INITIAL(ringSelectedInnerColor, RingSelectedInnerColor); - if (!primitiveValue) - break; - Color col = getColorFromPrimitiveValue(primitiveValue).blendWithWhite(); - m_style->setRingSelectedInnerColor(col); - return; - } - case CSSPropertyWebkitRingSelectedOuterColor: { - HANDLE_INHERIT_AND_INITIAL(ringSelectedOuterColor, RingSelectedOuterColor); - if (!primitiveValue) - break; - Color col = getColorFromPrimitiveValue(primitiveValue).blendWithWhite(); - m_style->setRingSelectedOuterColor(col); - return; - } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR case CSSPropertyWebkitTapHighlightColor: { HANDLE_INHERIT_AND_INITIAL(tapHighlightColor, TapHighlightColor); diff --git a/Source/WebCore/platform/android/RenderThemeAndroid.cpp b/Source/WebCore/platform/android/RenderThemeAndroid.cpp index 843068a..5f40ede 100644 --- a/Source/WebCore/platform/android/RenderThemeAndroid.cpp +++ b/Source/WebCore/platform/android/RenderThemeAndroid.cpp @@ -38,10 +38,10 @@ #include "RenderMediaControls.h" #endif #include "RenderSkinAndroid.h" -#include "RenderSkinButton.h" #include "RenderSkinCombo.h" #include "RenderSkinMediaButton.h" #include "RenderSkinRadio.h" +#include "RoundedIntRect.h" #include "SkCanvas.h" #include "UserAgentStyleSheets.h" #include "WebCoreFrameBridge.h" @@ -63,6 +63,20 @@ const int listboxPadding = 5; const RGBA32 selectionColor = makeRGB(181, 224, 136); +// Colors copied from the holo resources +const RGBA32 defaultBgColor = makeRGBA(204, 204, 204, 197); +const RGBA32 defaultBgBright = makeRGBA(213, 213, 213, 221); +const RGBA32 defaultBgDark = makeRGBA(92, 92, 92, 160); +const RGBA32 defaultFgColor = makeRGBA(101, 101, 101, 225); + +const RGBA32 disabledBgColor = makeRGBA(205, 205, 205, 107); +const RGBA32 disabledBgBright = makeRGBA(213, 213, 213, 133); +const RGBA32 disabledBgDark = makeRGBA(92, 92, 92, 96); +const RGBA32 disabledFgColor = makeRGBA(148, 148, 148, 137); + +const int paddingButton = 2; +const int cornerButton = 2; + static SkCanvas* getCanvasFromInfo(const PaintInfo& info) { return info.context->platformContext()->mCanvas; @@ -174,10 +188,10 @@ void RenderThemeAndroid::addIntrinsicMargins(RenderStyle* style) const // Cut out the intrinsic margins completely if we end up using a small font size if (style->fontSize() < 11) return; - + // Intrinsic margin value. const int m = 2; - + // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed. if (style->width().isIntrinsicOrAuto()) { if (style->marginLeft().quirk()) @@ -210,17 +224,6 @@ bool RenderThemeAndroid::supportsFocus(ControlPart appearance) void RenderThemeAndroid::adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, WebCore::Element*) const { - // Code is taken from RenderThemeSafari.cpp - // It makes sure we have enough space for the button text. - const int paddingHoriz = 12; - const int paddingVert = 8; - style->setPaddingLeft(Length(paddingHoriz, Fixed)); - style->setPaddingRight(Length(paddingHoriz, Fixed)); - style->setPaddingTop(Length(paddingVert, Fixed)); - style->setPaddingBottom(Length(paddingVert, Fixed)); - - // Set a min-height so that we can't get smaller than the mini button. - style->setMinHeight(Length(15, Fixed)); } bool RenderThemeAndroid::paintCheckbox(RenderObject* obj, const PaintInfo& info, const IntRect& rect) @@ -237,16 +240,42 @@ bool RenderThemeAndroid::paintButton(RenderObject* obj, const PaintInfo& info, c if (formControlElement) { android::WebFrame* webFrame = getWebFrame(node); if (webFrame) { - RenderSkinAndroid* skins = webFrame->renderSkins(); - if (skins) { - RenderSkinAndroid::State state = RenderSkinAndroid::kNormal; - if (!formControlElement->isEnabledFormControl()) - state = RenderSkinAndroid::kDisabled; - skins->renderSkinButton()->draw(getCanvasFromInfo(info), rect, state); + GraphicsContext *context = info.context; + IntRect innerrect = IntRect(rect.x() + paddingButton, rect.y() + paddingButton, + rect.width() - 2 * paddingButton, rect.height() - 2 * paddingButton); + IntSize cornerrect = IntSize(cornerButton, cornerButton); + Color bg, bright, dark; + if (formControlElement->isEnabledFormControl()) { + bg = Color(defaultBgColor); + bright = Color(defaultBgBright); + dark = Color(defaultBgDark); + } else { + bg = Color(disabledBgColor); + bright = Color(disabledBgBright); + dark = Color(disabledBgDark); } + context->save(); + context->clip( + IntRect(innerrect.x(), innerrect.y(), innerrect.width(), 1)); + context->fillRoundedRect(innerrect, cornerrect, cornerrect, + cornerrect, cornerrect, bright, context->fillColorSpace()); + context->restore(); + context->save(); + context->clip(IntRect(innerrect.x(), innerrect.y() + innerrect.height() - 1, + innerrect.width(), 1)); + context->fillRoundedRect(innerrect, cornerrect, cornerrect, + cornerrect, cornerrect, dark, context->fillColorSpace()); + context->restore(); + context->save(); + context->clip(IntRect(innerrect.x(), innerrect.y() + 1, innerrect.width(), + innerrect.height() - 2)); + context->fillRoundedRect(innerrect, cornerrect, cornerrect, + cornerrect, cornerrect, bg, context->fillColorSpace()); + context->restore(); } } + // We always return false so we do not request to be redrawn. return false; } @@ -400,7 +429,7 @@ void RenderThemeAndroid::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* st bool RenderThemeAndroid::paintTextField(RenderObject*, const PaintInfo&, const IntRect&) { - return true; + return true; } void RenderThemeAndroid::adjustTextAreaStyle(CSSStyleSelector*, RenderStyle* style, WebCore::Element*) const @@ -422,7 +451,7 @@ void RenderThemeAndroid::adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle* bool RenderThemeAndroid::paintSearchField(RenderObject*, const PaintInfo&, const IntRect&) { - return true; + return true; } static void adjustMenuListStyleCommon(RenderStyle* style) @@ -453,8 +482,8 @@ bool RenderThemeAndroid::paintCombo(RenderObject* obj, const PaintInfo& info, c return RenderSkinCombo::Draw(getCanvasFromInfo(info), obj->node(), rect.x(), rect.y(), rect.width(), rect.height()); } -bool RenderThemeAndroid::paintMenuList(RenderObject* obj, const PaintInfo& info, const IntRect& rect) -{ +bool RenderThemeAndroid::paintMenuList(RenderObject* obj, const PaintInfo& info, const IntRect& rect) +{ return paintCombo(obj, info, rect); } @@ -465,13 +494,13 @@ void RenderThemeAndroid::adjustMenuListButtonStyle(CSSStyleSelector*, const float baseFontSize = 11.0f; const int baseBorderRadius = 5; float fontScale = style->fontSize() / baseFontSize; - + style->resetPadding(); style->setBorderRadius(IntSize(int(baseBorderRadius + fontScale - 1), int(baseBorderRadius + fontScale - 1))); // FIXME: Round up? const int minHeight = 15; style->setMinHeight(Length(minHeight, Fixed)); - + style->setLineHeight(RenderStyle::initialLineHeight()); // Found these padding numbers by trial and error. const int padding = 4; @@ -480,7 +509,7 @@ void RenderThemeAndroid::adjustMenuListButtonStyle(CSSStyleSelector*, adjustMenuListStyleCommon(style); } -bool RenderThemeAndroid::paintMenuListButton(RenderObject* obj, const PaintInfo& info, const IntRect& rect) +bool RenderThemeAndroid::paintMenuListButton(RenderObject* obj, const PaintInfo& info, const IntRect& rect) { return paintCombo(obj, info, rect); } @@ -488,10 +517,10 @@ bool RenderThemeAndroid::paintMenuListButton(RenderObject* obj, const PaintInfo& bool RenderThemeAndroid::supportsFocusRing(const RenderStyle* style) const { return style->opacity() > 0 - && style->hasAppearance() - && style->appearance() != TextFieldPart - && style->appearance() != SearchFieldPart - && style->appearance() != TextAreaPart + && style->hasAppearance() + && style->appearance() != TextFieldPart + && style->appearance() != SearchFieldPart + && style->appearance() != TextAreaPart && style->appearance() != CheckboxPart && style->appearance() != RadioPart && style->appearance() != PushButtonPart diff --git a/Source/WebCore/platform/android/RenderThemeAndroid.h b/Source/WebCore/platform/android/RenderThemeAndroid.h index e3922a1..7ac372d 100644 --- a/Source/WebCore/platform/android/RenderThemeAndroid.h +++ b/Source/WebCore/platform/android/RenderThemeAndroid.h @@ -31,7 +31,6 @@ namespace WebCore { -class RenderSkinButton; class RenderSkinRadio; class RenderSkinCombo; diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h index 02ec005..0fb355b 100644 --- a/Source/WebCore/platform/graphics/Color.h +++ b/Source/WebCore/platform/graphics/Color.h @@ -162,15 +162,8 @@ public: static const RGBA32 lightGray = 0xFFC0C0C0; static const RGBA32 transparent = 0x00000000; -#ifdef ANDROID_CSS_RING - static const RGBA32 ringFill = 0x666699FF; - static const RGBA32 ringPressedInner = 0x006699FF; - static const RGBA32 ringPressedOuter = 0x336699FF; - static const RGBA32 ringSelectedInner = 0xAA6699FF; - static const RGBA32 ringSelectedOuter = 0x336699FF; -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR - static const RGBA32 tap = 0x4D1A1A1A; + static const RGBA32 tap = 0x6633B5E5; #endif private: diff --git a/Source/WebCore/platform/graphics/android/GLExtras.cpp b/Source/WebCore/platform/graphics/android/GLExtras.cpp index bf489c9..9ad369a 100644 --- a/Source/WebCore/platform/graphics/android/GLExtras.cpp +++ b/Source/WebCore/platform/graphics/android/GLExtras.cpp @@ -165,6 +165,10 @@ void GLExtras::drawRegion(const SkRegion& region, bool fill, void GLExtras::drawCursorRings(const LayerAndroid* layer) { + int layerId = layer ? layer->uniqueId() : -1; + if (layerId != m_ring->layerId()) + return; + SkRegion region; for (size_t i = 0; i < m_ring->rings().size(); i++) { IntRect rect = m_ring->rings().at(i); diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index fc2eddd..779eb36 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -588,8 +588,10 @@ bool GraphicsLayerAndroid::repaint() RenderBox* box = layer->renderBox(); int outline = box->view()->maximalOutlineSize(); IntRect contentsRect(0, 0, - box->borderLeft() + box->borderRight() + layer->scrollWidth(), - box->borderTop() + box->borderBottom() + layer->scrollHeight()); + box->borderLeft() + box->borderRight() + layer->scrollWidth() + + layer->verticalScrollbarWidth(), + box->borderTop() + box->borderBottom() + layer->scrollHeight() + + layer->horizontalScrollbarHeight()); contentsRect.inflate(outline); // Update the foreground layer size. m_foregroundLayer->setSize(contentsRect.width(), contentsRect.height()); diff --git a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h index d22dbd8..80ea5d6 100644 --- a/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h +++ b/Source/WebCore/platform/graphics/android/PlatformGraphicsContext.h @@ -28,7 +28,6 @@ #include "IntRect.h" #include "RenderSkinAndroid.h" -#include "RenderSkinButton.h" #include "SkCanvas.h" #include "SkPicture.h" #include "SkTDArray.h" diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp index a706276..a4af713 100644 --- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -219,11 +219,15 @@ ShaderProgram::ShaderProgram() , m_currentScale(1.0f) , m_needsInit(true) { - init(); } void ShaderProgram::init() { + // To detect whether or not resources for ShaderProgram allocated + // successfully, we clean up pre-existing errors here and will check for + // new errors at the end of this function. + GLUtils::checkGlError("before init"); + GLint tex2DProgram = createProgram(gVertexShader, gFragmentShader); GLint pureColorProgram = createProgram(gPureColorVertexShader, gPureColorFragmentShader); GLint tex2DInvProgram = createProgram(gVertexShader, gFragmentShaderInverted); @@ -242,7 +246,6 @@ void ShaderProgram::init() m_needsInit = true; return; } - m_needsInit = false; GLint pureColorPosition = glGetAttribLocation(pureColorProgram, "vPosition"); GLint pureColorProjMtx = glGetUniformLocation(pureColorProgram, "projectionMatrix"); @@ -309,7 +312,12 @@ void ShaderProgram::init() matrix.translate3d(-0.5, -0.5, 0); GLUtils::toGLMatrix(m_transferProjMtx, matrix); - GLUtils::checkGlError("init"); + if (GLUtils::checkGlError("init")) + m_needsInit = true; + else + m_needsInit = false; + + return; } void ShaderProgram::resetBlending() diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index fbf7ae6..cbbbe5c 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -103,6 +103,8 @@ TilesManager::TilesManager() , m_invertedScreen(false) , m_invertedScreenSwitch(false) , m_useMinimalMemory(true) + , m_useDoubleBuffering(true) + , m_treeUpdates(0) , m_drawGLCount(1) , m_lastTimeLayersUsed(0) , m_hasLayerTextures(false) diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h index f798196..dd01fc5 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/TilesManager.h @@ -178,6 +178,16 @@ public: return m_useMinimalMemory; } + void setUseDoubleBuffering(bool useDoubleBuffering) + { + m_useDoubleBuffering = useDoubleBuffering; + } + bool useDoubleBuffering() { return m_useDoubleBuffering; } + + void incTreeUpdates() { m_treeUpdates++; } + unsigned int getTreeUpdates() { return m_treeUpdates; } + void clearTreeUpdates() { m_treeUpdates = 0; } + void incDrawGLCount() { m_drawGLCount++; @@ -227,6 +237,9 @@ private: bool m_useMinimalMemory; + bool m_useDoubleBuffering; + unsigned int m_treeUpdates; + sp<TexturesGenerator> m_pixmapsGenerationThread; android::Mutex m_texturesLock; diff --git a/Source/WebCore/platform/graphics/android/TreeManager.cpp b/Source/WebCore/platform/graphics/android/TreeManager.cpp index 35ddeb8..be161a0 100644 --- a/Source/WebCore/platform/graphics/android/TreeManager.cpp +++ b/Source/WebCore/platform/graphics/android/TreeManager.cpp @@ -159,10 +159,15 @@ void TreeManager::updateWithTree(Layer* newTree, bool brandNew) if (m_queuedTree || m_paintingTree) { // currently painting, so defer this new tree if (m_queuedTree) { - // have a queued tree, copy over invals so the regions are - // eventually repainted + // already have a queued tree, copy over invals so the regions are + // eventually repainted and let the old queued tree be discarded m_queuedTree->mergeInvalsInto(newTree); + if (!TilesManager::instance()->useDoubleBuffering()) { + // not double buffering, count discarded tree/webkit paint as an update + TilesManager::instance()->incTreeUpdates(); + } + XLOG("DISCARDING tree - %p, has children %d, has animations %d", newTree, newTree && newTree->countChildren(), newTree && newTree->countChildren() @@ -222,9 +227,10 @@ bool TreeManager::drawGL(double currentTime, IntRect& viewRect, if (laTree) laTree->computeTexturesAmount(texturesResultPtr); - if (/*!m_fastSwapMode && */ m_paintingTree->isReady()) { + if (!TilesManager::instance()->useDoubleBuffering() || m_paintingTree->isReady()) { XLOG("have painting tree %p ready, swapping!", m_paintingTree); didTreeSwap = true; + TilesManager::instance()->incTreeUpdates(); swap(); if (treesSwappedPtr) *treesSwappedPtr = true; diff --git a/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp b/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp index 47c0613..42aa385 100644 --- a/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp +++ b/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp @@ -33,7 +33,6 @@ #include <wtf/RefPtr.h> static const UChar vTextCnvTable[][2] = { - // TODO: uncomment mappings once we add glyphs for vertical forms. {0x0021, 0xfe15}, // exclamation mark {0x0028, 0xfe35}, // left paren {0x0029, 0xfe36}, // right paren @@ -55,8 +54,7 @@ static const UChar vTextCnvTable[][2] = { {0x2015, 0xfe31}, // horizontal bar {0x2025, 0xfe30}, // two dot leader {0x2026, 0xfe19}, // three dot leader - // TODO: change the mapping 0x3001 -> 0xFE11 once Android has the glyph for 0xFE11. - {0x3001, 0xfe10}, // Ideographic comma + {0x3001, 0xfe11}, // Ideographic comma {0x3002, 0xfe12}, // Ideographic full stop {0x3008, 0xfe3f}, // left angle bracket {0x3009, 0xfe40}, // right angle bracket @@ -83,8 +81,7 @@ static const UChar vTextCnvTable[][2] = { {0xff5c, 0xfe31}, // fullwidth vertical line {0xff5d, 0xfe38}, // full width right curly bracket {0xff5e, 0x007c}, // tilde to vertical line - // TODO: change the mapping 0xff64 -> 0xFE11 once Android has the glyph for 0xFE11. - {0xff64, 0xfe10}, // halfwidth ideo comma + {0xff64, 0xfe11}, // halfwidth ideo comma {0xff61, 0xfe12}, // halfwidth ideo full stop }; diff --git a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp index 58f47d0..a527e6a 100644 --- a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp @@ -180,6 +180,22 @@ void VideoLayerAndroid::showPreparingAnimation(const SkRect& rect, m_rotateDegree += ROTATESTEP; } +SkRect VideoLayerAndroid::calVideoRect(const SkRect& rect) +{ + SkRect videoRect = rect; + VideoLayerManager* manager = TilesManager::instance()->videoLayerManager(); + float aspectRatio = manager->getAspectRatio(uniqueId()); + float deltaY = rect.height() - rect.width() / aspectRatio; + if (deltaY >= 0) + videoRect.inset(0, deltaY / 2); + else { + float deltaX = rect.width() - rect.height() * aspectRatio; + if (deltaX >= 0) + videoRect.inset(deltaX / 2, 0); + } + return videoRect; +} + bool VideoLayerAndroid::drawGL() { // Lazily allocated the textures. @@ -193,17 +209,26 @@ bool VideoLayerAndroid::drawGL() m_createdTexture = true; } + ShaderProgram* shader = TilesManager::instance()->shader(); + SkRect rect = SkRect::MakeSize(getSize()); GLfloat surfaceMatrix[16]; - SkRect innerRect = SkRect(buttonRect); - if (innerRect.contains(rect)) - innerRect = rect; - - innerRect.offset((rect.width() - IMAGESIZE) / 2 , (rect.height() - IMAGESIZE) / 2); + // Calculate the video rect based on the aspect ratio and the element rect. + SkRect videoRect = calVideoRect(rect); + if (videoRect != rect) { + // Paint the whole video element with black color when video content + // can't cover the whole area. + shader->drawLayerQuad(m_drawTransform, rect, 0, 1, true, GL_TEXTURE_2D, + Color(0, 0, 0, 255)); + } - ShaderProgram* shader = TilesManager::instance()->shader(); - VideoLayerManager* manager = TilesManager::instance()->videoLayerManager(); + // Inner rect is for the progressing / play / pause animation. + SkRect innerRect = SkRect(buttonRect); + if (innerRect.contains(videoRect)) + innerRect = videoRect; + innerRect.offset(videoRect.fLeft + (videoRect.width() - IMAGESIZE) / 2, + videoRect.fTop + (videoRect.height() - IMAGESIZE) / 2); // When we are drawing the animation of the play/pause button in the // middle of the video, we need to ask for redraw. @@ -211,9 +236,10 @@ bool VideoLayerAndroid::drawGL() // Draw the poster image, the progressing image or the Video depending // on the player's state. + VideoLayerManager* manager = TilesManager::instance()->videoLayerManager(); if (m_playerState == PREPARING) { // Show the progressing animation, with two rotating circles - showPreparingAnimation(rect, innerRect); + showPreparingAnimation(videoRect, innerRect); needRedraw = true; } else if (m_playerState == PLAYING && m_surfaceTexture.get()) { // Show the real video. @@ -221,12 +247,12 @@ bool VideoLayerAndroid::drawGL() m_surfaceTexture->getTransformMatrix(surfaceMatrix); GLuint textureId = manager->getTextureId(uniqueId()); shader->drawVideoLayerQuad(m_drawTransform, surfaceMatrix, - rect, textureId); + videoRect, textureId); manager->updateMatrix(uniqueId(), surfaceMatrix); // Use the scale to control the fading the sizing during animation double scale = manager->drawIcon(uniqueId(), PlayIcon); - if (scale != 0) { + if (scale) { innerRect.inset(IMAGESIZE / 4 * scale, IMAGESIZE / 4 * scale); shader->drawLayerQuad(m_drawTransform, innerRect, m_playTextureId, scale, true); @@ -239,10 +265,10 @@ bool VideoLayerAndroid::drawGL() if (textureId && matrix) { // Show the screen shot for each video. shader->drawVideoLayerQuad(m_drawTransform, matrix, - rect, textureId); + videoRect, textureId); } else { // Show the static poster b/c there is no screen shot available. - shader->drawLayerQuad(m_drawTransform, rect, m_backgroundTextureId, + shader->drawLayerQuad(m_drawTransform, videoRect, m_backgroundTextureId, 1, true); shader->drawLayerQuad(m_drawTransform, innerRect, m_posterTextureId, 1, true); @@ -250,7 +276,7 @@ bool VideoLayerAndroid::drawGL() // Use the scale to control the fading and the sizing during animation. double scale = manager->drawIcon(uniqueId(), PauseIcon); - if (scale != 0) { + if (scale) { innerRect.inset(IMAGESIZE / 4 * scale, IMAGESIZE / 4 * scale); shader->drawLayerQuad(m_drawTransform, innerRect, m_pauseTextureId, scale, true); diff --git a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.h b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.h index cdb37f3..6bd9fa1 100644 --- a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.h +++ b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.h @@ -71,6 +71,7 @@ private: void init(); void showPreparingAnimation(const SkRect& rect, const SkRect innerRect); + SkRect calVideoRect(const SkRect& rect); // Surface texture for showing the video is actually allocated in Java side // and passed into this native code. sp<android::SurfaceTexture> m_surfaceTexture; diff --git a/Source/WebCore/platform/graphics/android/VideoLayerManager.cpp b/Source/WebCore/platform/graphics/android/VideoLayerManager.cpp index d0fc873..521b623 100644 --- a/Source/WebCore/platform/graphics/android/VideoLayerManager.cpp +++ b/Source/WebCore/platform/graphics/android/VideoLayerManager.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "VideoLayerManager.h" + #include <wtf/CurrentTime.h> #if USE(ACCELERATED_COMPOSITING) @@ -54,6 +55,10 @@ // screenshots would not be above 8M. #define MAX_VIDEOSIZE_SUM 2097152 +// We don't preload the video data, so we don't have the exact size yet. +// Assuming 16:9 by default, this will be corrected after video prepared. +#define DEFAULT_VIDEO_ASPECT_RATIO 1.78 + namespace WebCore { VideoLayerManager::VideoLayerManager() @@ -71,6 +76,16 @@ GLuint VideoLayerManager::getTextureId(const int layerId) return result; } +// Getting the aspect ratio for GL draw call, in the UI thread. +float VideoLayerManager::getAspectRatio(const int layerId) +{ + android::Mutex::Autolock lock(m_videoLayerInfoMapLock); + float result = 0; + if (m_videoLayerInfoMap.contains(layerId)) + result = m_videoLayerInfoMap.get(layerId)->aspectRatio; + return result; +} + // Getting matrix for GL draw call, in the UI thread. GLfloat* VideoLayerManager::getMatrix(const int layerId) { @@ -108,6 +123,7 @@ void VideoLayerManager::registerTexture(const int layerId, const GLuint textureI pInfo->textureId = textureId; memset(pInfo->surfaceMatrix, 0, sizeof(pInfo->surfaceMatrix)); pInfo->videoSize = 0; + pInfo->aspectRatio = DEFAULT_VIDEO_ASPECT_RATIO; m_currentTimeStamp++; pInfo->timeStamp = m_currentTimeStamp; pInfo->lastIconShownTime = 0; @@ -122,13 +138,16 @@ void VideoLayerManager::registerTexture(const int layerId, const GLuint textureI // Only when the video is prepared, we got the video size. So we should update // the size for the video accordingly. // This is called from webcore thread, from MediaPlayerPrivateAndroid. -void VideoLayerManager::updateVideoLayerSize(const int layerId, const int size ) +void VideoLayerManager::updateVideoLayerSize(const int layerId, const int size, + const float ratio) { android::Mutex::Autolock lock(m_videoLayerInfoMapLock); if (m_videoLayerInfoMap.contains(layerId)) { VideoLayerInfo* pInfo = m_videoLayerInfoMap.get(layerId); - if (pInfo) + if (pInfo) { pInfo->videoSize = size; + pInfo->aspectRatio = ratio; + } } // If the memory usage is out of bound, then just delete the oldest ones. @@ -255,7 +274,7 @@ double VideoLayerManager::drawIcon(const int layerId, IconType type) VideoLayerInfo* pInfo = m_videoLayerInfoMap.get(layerId); // If this is state switching moment, reset the time and state if ((type == PlayIcon && pInfo->iconState != PlayIconShown) - ||(type == PauseIcon && pInfo->iconState != PauseIconShown)) { + || (type == PauseIcon && pInfo->iconState != PauseIconShown)) { pInfo->lastIconShownTime = WTF::currentTime(); pInfo->iconState = (type == PlayIcon) ? PlayIconShown : PauseIconShown; } @@ -269,7 +288,7 @@ double VideoLayerManager::drawIcon(const int layerId, IconType type) } } - if (ratio > 1 || ratio < 0 ) + if (ratio > 1 || ratio < 0) ratio = 0; return ratio; } diff --git a/Source/WebCore/platform/graphics/android/VideoLayerManager.h b/Source/WebCore/platform/graphics/android/VideoLayerManager.h index a427269..d554362 100644 --- a/Source/WebCore/platform/graphics/android/VideoLayerManager.h +++ b/Source/WebCore/platform/graphics/android/VideoLayerManager.h @@ -50,6 +50,7 @@ enum IconType { struct VideoLayerInfo { GLuint textureId; // GL texture bound with the surface texture. int videoSize; // The size of the video. + float aspectRatio; // The aspect ratio of the video. int timeStamp; // Used to decide which VideoLayerInfo is the oldest one. GLfloat surfaceMatrix[16]; @@ -68,7 +69,7 @@ public: // Register the texture when we got setSurfaceTexture call. void registerTexture(const int layerId, const GLuint textureId); // Update the size when the video is prepared. - void updateVideoLayerSize(const int layerId, const int size); + void updateVideoLayerSize(const int layerId, const int size, const float ratio); // At draw time, update the matrix for every video frame update. void updateMatrix(const int layerId, const GLfloat* matrix); // Remove the layer info from the mapping. @@ -78,6 +79,8 @@ public: GLuint getTextureId(const int layerId); // Return the matrix for surface texture corresponding to the layerId GLfloat* getMatrix(const int layerId); + // Return the aspect ratio for the video corresponding to the layerId + float getAspectRatio(const int layerId); // Delete the GL textures void deleteUnusedTextures(); diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp index e88c65d..6b8725e 100644 --- a/Source/WebCore/platform/graphics/android/android_graphics.cpp +++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp @@ -25,7 +25,6 @@ #include "CachedPrefix.h" #include "android_graphics.h" -#include "CachedColor.h" #include "CachedRoot.h" #include "IntRect.h" #include "LayerAndroid.h" @@ -37,6 +36,24 @@ namespace android { +#define RING_OUTSET 3 +#define RING_RADIUS 1 +#define RING_INNER_WIDTH 16 +#define RING_OUTER_WIDTH 16 + +static const RGBA32 ringFill = 0x666699FF; +static const RGBA32 ringPressedInner = 0x006699FF; +static const RGBA32 ringPressedOuter = 0x336699FF; +static const RGBA32 ringSelectedInner = 0xAA6699FF; +static const RGBA32 ringSelectedOuter = 0x336699FF; + + +CursorRing::CursorRing(WebViewCore* core) + : m_viewImpl(core) + , m_layerId(-1) +{ +} + // The CSS values for the inner and outer widths may be specified as fractions #define WIDTH_SCALE 0.0625f // 1/16, to offset the scale in CSSStyleSelector @@ -48,7 +65,8 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) } #if USE(ACCELERATED_COMPOSITING) int layerId = m_node->isInLayer() ? m_frame->layer(m_node)->uniqueId() : -1; - if (layer->uniqueId() != layerId) + int drawingLayerId = layer ? layer->uniqueId() : -1; + if (drawingLayerId != layerId) return; #endif if (canvas->quickReject(m_bounds, SkCanvas::kAA_EdgeType)) { @@ -57,7 +75,6 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height()); return; } - const CachedColor& colors = m_frame->color(m_node); unsigned rectCount = m_rings.size(); SkRegion rgn; SkPath path; @@ -67,7 +84,7 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) SkIRect ir; r.round(&ir); - ir.inset(-colors.outset(), -colors.outset()); + ir.inset(-RING_OUTSET, -RING_OUTSET); rgn.op(ir, SkRegion::kUnion_Op); } rgn.getBoundaryPath(&path); @@ -75,30 +92,30 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) SkPaint paint; paint.setAntiAlias(true); paint.setPathEffect(new SkCornerPathEffect( - SkIntToScalar(colors.radius())))->unref(); + SkIntToScalar(RING_RADIUS)))->unref(); SkColor outer; SkColor inner; if (m_isPressed) { SkColor pressed; - pressed = colors.fillColor(); + pressed = ringFill; paint.setColor(pressed); canvas->drawPath(path, paint); - outer = colors.pressedOuterColor(); - inner = colors.pressedInnerColor(); + outer = ringPressedInner; + inner = ringPressedOuter; } else { - outer = colors.selectedOuterColor(); - inner = colors.selectedInnerColor(); + outer = ringSelectedOuter; + inner = ringSelectedInner; } paint.setStyle(SkPaint::kStroke_Style); - paint.setStrokeWidth(colors.outerWidth() * WIDTH_SCALE); + paint.setStrokeWidth(RING_OUTER_WIDTH * WIDTH_SCALE); paint.setColor(outer); canvas->drawPath(path, paint); - paint.setStrokeWidth(colors.innerWidth() * WIDTH_SCALE); + paint.setStrokeWidth(RING_INNER_WIDTH * WIDTH_SCALE); paint.setColor(inner); canvas->drawPath(path, paint); SkRect localBounds, globalBounds; localBounds = path.getBounds(); - float width = std::max(colors.innerWidth(), colors.outerWidth()); + float width = std::max(RING_INNER_WIDTH, RING_OUTER_WIDTH); width *= WIDTH_SCALE; localBounds.inset(-width, -width); const SkMatrix& matrix = canvas->getTotalMatrix(); @@ -116,12 +133,27 @@ void CursorRing::setIsButton(const CachedNode* node) bool CursorRing::setup() { - m_node->cursorRings(m_frame, &m_rings); + m_layerId = -1; + if (m_frame && m_root) { + const CachedLayer* cachedLayer = m_frame->layer(m_node); + if (cachedLayer) { + const WebCore::LayerAndroid* rootLayer = m_root->rootLayer(); + const LayerAndroid* aLayer = cachedLayer->layer(rootLayer); + if (aLayer) + m_layerId = aLayer->uniqueId(); + } + } + if (m_layerId == -1) + m_node->cursorRings(m_frame, &m_rings); + else + m_node->localCursorRings(m_frame, &m_rings); + if (!m_rings.size()) { DBG_NAV_LOG("!rings.size()"); m_viewImpl->m_hasCursorBounds = false; return false; } + setIsButton(m_node); m_bounds = m_node->bounds(m_frame); m_viewImpl->updateCursorBounds(m_root, m_frame, m_node); @@ -134,9 +166,8 @@ bool CursorRing::setup() m_rings.append(m_bounds); } m_absBounds = m_node->bounds(m_frame); - const CachedColor& colors = m_frame->color(m_node); - m_bounds.inflate(SkScalarCeil(colors.outerWidth())); - m_absBounds.inflate(SkScalarCeil(colors.outerWidth())); + m_bounds.inflate(SkScalarCeil(RING_OUTER_WIDTH)); + m_absBounds.inflate(SkScalarCeil(RING_OUTER_WIDTH)); if (!m_node->hasCursorRing() || (m_node->isPlugin() && m_node->isFocus())) return false; #if DEBUG_NAV_UI @@ -147,12 +178,6 @@ bool CursorRing::setup() m_isPressed ? "true" : "false", m_rings.size(), ring.x(), ring.y(), ring.width(), ring.height(), m_node->isPlugin() ? "true" : "false"); - DBG_NAV_LOGD("[%d] inner=%d outer=%d outset=%d radius=%d" - " fill=0x%08x pin=0x%08x pout=0x%08x sin=0x%08x sout=0x%08x", - m_node->colorIndex(), colors.innerWidth(), colors.outerWidth(), - colors.outset(), colors.radius(), colors.fillColor(), - colors.pressedInnerColor(), colors.pressedOuterColor(), - colors.selectedInnerColor(), colors.selectedInnerColor()); #endif return true; } diff --git a/Source/WebCore/platform/graphics/android/android_graphics.h b/Source/WebCore/platform/graphics/android/android_graphics.h index 60ac115..bd08a6e 100644 --- a/Source/WebCore/platform/graphics/android/android_graphics.h +++ b/Source/WebCore/platform/graphics/android/android_graphics.h @@ -52,12 +52,13 @@ class WebViewCore; class CursorRing : public DrawExtra { public: - CursorRing(WebViewCore* core) : m_viewImpl(core) {} + CursorRing(WebViewCore* core); virtual ~CursorRing() {} virtual void draw(SkCanvas* , LayerAndroid* , IntRect* ); void setIsButton(const CachedNode* ); bool setup(); WTF::Vector<IntRect>& rings() { return m_rings; } + int layerId() const { return m_layerId; } private: friend class WebView; friend class WebCore::GLExtras; @@ -71,6 +72,7 @@ private: const CachedNode* m_node; bool m_isButton; bool m_isPressed; + int m_layerId; }; } diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 837bce3..03f1e41 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -1378,7 +1378,21 @@ bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const return false; // The root layer always has a compositing layer, but it may not have backing. +#if PLATFORM(ANDROID) + // If we do not have a root platform layer, don't use the + // mustOverlapCompositedLayers() as a cue that this layer needs to be + // composited -- the layers tree has been detached. + // Otherwise we can end up in a cycle where updateBacking() switches composited + // mode on because a layer has mustOverlapCompositedLayers() (by calling + // enableCompositingMode()), while computeCompositingRequirements() will + // (correctly) say that we do not need to be in composited mode and turns it + // off, rince and repeat... + return requiresCompositingLayer(layer) + || (m_rootPlatformLayer && layer->mustOverlapCompositedLayers()) + || (inCompositingMode() && layer->isRootLayer()); +#else return requiresCompositingLayer(layer) || layer->mustOverlapCompositedLayers() || (inCompositingMode() && layer->isRootLayer()); +#endif } #if PLATFORM(ANDROID) diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index fad5a7b..ea01064 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -786,19 +786,6 @@ public: ESpeak speak() { return static_cast<ESpeak>(rareInheritedData->speak); } -#ifdef ANDROID_CSS_RING - // called when building nav cache to determine if the ring data is unchanged - const void* ringData() const { return reinterpret_cast<const void*>(rareInheritedData.get()); } - Color ringFillColor() const { return rareInheritedData->ringFillColor; } - Length ringInnerWidth() const { return rareInheritedData->ringInnerWidth; } - Length ringOuterWidth() const { return rareInheritedData->ringOuterWidth; } - Length ringOutset() const { return rareInheritedData->ringOutset; } - Color ringPressedInnerColor() const { return rareInheritedData->ringPressedInnerColor; } - Color ringPressedOuterColor() const { return rareInheritedData->ringPressedOuterColor; } - Length ringRadius() const { return rareInheritedData->ringRadius; } - Color ringSelectedInnerColor() const { return rareInheritedData->ringSelectedInnerColor; } - Color ringSelectedOuterColor() const { return rareInheritedData->ringSelectedOuterColor; } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } #endif @@ -1142,21 +1129,6 @@ public: void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); } void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); } -#ifdef ANDROID_CSS_RING - void setRingFillColor(const Color& v) { SET_VAR(rareInheritedData, ringFillColor, v); } - void setRingInnerWidth(Length v) { SET_VAR(rareInheritedData, ringInnerWidth, v); } - void setRingOuterWidth(Length v) { SET_VAR(rareInheritedData, ringOuterWidth, v); } - void setRingOutset(Length v) { SET_VAR(rareInheritedData, ringOutset, v); } - void setRingPressedInnerColor(const Color& v) { - SET_VAR(rareInheritedData, ringPressedInnerColor, v); } - void setRingPressedOuterColor(const Color& v) { - SET_VAR(rareInheritedData, ringPressedOuterColor, v); } - void setRingRadius(Length v) { SET_VAR(rareInheritedData, ringRadius, v); } - void setRingSelectedInnerColor(const Color& v) { - SET_VAR(rareInheritedData, ringSelectedInnerColor, v); } - void setRingSelectedOuterColor(const Color& v) { - SET_VAR(rareInheritedData, ringSelectedOuterColor, v); } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR void setTapHighlightColor(const Color& v) { SET_VAR(rareInheritedData, tapHighlightColor, v); } #endif @@ -1359,17 +1331,6 @@ public: static const Vector<StyleDashboardRegion>& noneDashboardRegions(); #endif -#ifdef ANDROID_CSS_RING - static Color initialRingFillColor() { return Color::ringFill; } - static Length initialRingInnerWidth() { return Length(16, Fixed); } // 1.0 - static Length initialRingOuterWidth() { return Length(40, Fixed); } // 2.5 - static Length initialRingOutset() { return Length(3, Fixed); } - static Color initialRingSelectedInnerColor() { return Color::ringSelectedInner; } - static Color initialRingSelectedOuterColor() { return Color::ringSelectedOuter; } - static Color initialRingPressedInnerColor() { return Color::ringPressedInner; } - static Color initialRingPressedOuterColor() { return Color::ringPressedOuter; } - static Length initialRingRadius() { return Length(1, Fixed); } -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR static Color initialTapHighlightColor() { return Color::tap; } #endif diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp index 2253d1c..a7acc4a 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -32,17 +32,6 @@ namespace WebCore { StyleRareInheritedData::StyleRareInheritedData() : textStrokeWidth(RenderStyle::initialTextStrokeWidth()) -#ifdef ANDROID_CSS_RING - , ringFillColor(RenderStyle::initialRingFillColor()) - , ringInnerWidth(RenderStyle::initialRingInnerWidth()) - , ringOuterWidth(RenderStyle::initialRingOuterWidth()) - , ringOutset(RenderStyle::initialRingOutset()) - , ringPressedInnerColor(RenderStyle::initialRingPressedInnerColor()) - , ringPressedOuterColor(RenderStyle::initialRingPressedOuterColor()) - , ringRadius(RenderStyle::initialRingRadius()) - , ringSelectedInnerColor(RenderStyle::initialRingSelectedInnerColor()) - , ringSelectedOuterColor(RenderStyle::initialRingSelectedOuterColor()) -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , tapHighlightColor(RenderStyle::initialTapHighlightColor()) #endif @@ -77,18 +66,6 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) , textStrokeColor(o.textStrokeColor) , textStrokeWidth(o.textStrokeWidth) , textFillColor(o.textFillColor) - , textEmphasisColor(o.textEmphasisColor) -#ifdef ANDROID_CSS_RING - , ringFillColor(o.ringFillColor) - , ringInnerWidth(o.ringInnerWidth) - , ringOuterWidth(o.ringOuterWidth) - , ringOutset(o.ringOutset) - , ringPressedInnerColor(o.ringPressedInnerColor) - , ringPressedOuterColor(o.ringPressedOuterColor) - , ringRadius(o.ringRadius) - , ringSelectedInnerColor(o.ringSelectedInnerColor) - , ringSelectedOuterColor(o.ringSelectedOuterColor) -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR , tapHighlightColor(o.tapHighlightColor) #endif @@ -157,17 +134,6 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const && nbspMode == o.nbspMode && khtmlLineBreak == o.khtmlLineBreak && textSizeAdjust == o.textSizeAdjust -#ifdef ANDROID_CSS_RING - && ringFillColor == o.ringFillColor - && ringInnerWidth == o.ringInnerWidth - && ringOuterWidth == o.ringOuterWidth - && ringOutset == o.ringOutset - && ringPressedInnerColor == o.ringPressedInnerColor - && ringPressedOuterColor == o.ringPressedOuterColor - && ringRadius == o.ringRadius - && ringSelectedInnerColor == o.ringSelectedInnerColor - && ringSelectedOuterColor == o.ringSelectedOuterColor -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR && tapHighlightColor == o.tapHighlightColor #endif diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h index 39cfe3c..16fcc5f 100644 --- a/Source/WebCore/rendering/style/StyleRareInheritedData.h +++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h @@ -58,17 +58,6 @@ public: Color textFillColor; Color textEmphasisColor; -#ifdef ANDROID_CSS_RING - Color ringFillColor; - Length ringInnerWidth; - Length ringOuterWidth; - Length ringOutset; - Color ringPressedInnerColor; - Color ringPressedOuterColor; - Length ringRadius; - Color ringSelectedInnerColor; - Color ringSelectedOuterColor; -#endif #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR Color tapHighlightColor; #endif |