summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/Color.h7
-rw-r--r--WebCore/platform/graphics/android/android_graphics.cpp63
-rw-r--r--WebCore/platform/graphics/android/android_graphics.h3
3 files changed, 35 insertions, 38 deletions
diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h
index ae728c2..9335bc4 100644
--- a/WebCore/platform/graphics/Color.h
+++ b/WebCore/platform/graphics/Color.h
@@ -150,13 +150,6 @@ public:
static const RGBA32 lightGray = 0xFFC0C0C0;
static const RGBA32 transparent = 0x00000000;
-#ifdef ANDROID_CSS_RING
- static const RGBA32 ringFill = 0x80FFC64B;
- static const RGBA32 ringPressedInner = 0xFFFEBD3A;
- static const RGBA32 ringPressedOuter = 0xFFAD5C0A;
- static const RGBA32 ringSelectedInner = 0xFFFE9230;
- static const RGBA32 ringSelectedOuter = 0xFFB33F08;
-#endif
#ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
static const RGBA32 tap = 0x4D1A1A1A;
#endif
diff --git a/WebCore/platform/graphics/android/android_graphics.cpp b/WebCore/platform/graphics/android/android_graphics.cpp
index a780dc4..fafd3df 100644
--- a/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/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,8 +36,30 @@
namespace android {
-// 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
+///////////////////////////////////////////////////////////////////////////////
+
+const static SkColor cursorOuterColors[] = {
+ SkColorSetARGB(0xff, 0xB3, 0x3F, 0x08), // normal ring select
+ SkColorSetARGB(0xff, 0x46, 0xb0, 0x00), // fake ring select, for phone, email, text
+ SkColorSetARGB(0xff, 0xAD, 0x5C, 0x0A), // normal ring pressed
+ SkColorSetARGB(0xff, 0x36, 0xc0, 0x00) // fake ring pressed
+};
+
+const static SkColor cursorInnerColors[] = {
+ SkColorSetARGB(0xff, 0xFE, 0x92, 0x30), // normal ring select
+ SkColorSetARGB(0xff, 0x8c, 0xd9, 0x00), // fake ring select, for phone, email, text
+ SkColorSetARGB(0xff, 0xFE, 0xBD, 0x3A), // normal ring pressed
+ SkColorSetARGB(0xff, 0x7c, 0xe9, 0x00) // fake ring pressed
+};
+
+const static SkColor cursorPressedColors[] = {
+ SkColorSetARGB(0x80, 0xFF, 0xC6, 0x4B), // normal ring pressed
+ SkColorSetARGB(0x80, 0x7c, 0xe9, 0x00) // fake ring pressed
+};
+
+#define CURSOR_RING_ROUNDEDNESS SkIntToScalar(5) // used to draw corners
+#define CURSOR_RING_INNER_DIAMETER SkFixedToScalar(SkIntToFixed(3)>>1) // 3/2 == 1.5
+#define CURSOR_RING_OUTER_OUTSET 2 // used to inflate rects added to region
void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
{
@@ -54,7 +75,6 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
m_followedLink = false;
return;
}
- const CachedColor& colors = m_frame->color(m_node);
unsigned rectCount = m_rings.size();
SkRegion rgn;
SkPath path;
@@ -64,36 +84,24 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
SkIRect ir;
r.round(&ir);
- ir.inset(-colors.outset(), -colors.outset());
+ ir.inset(-CURSOR_RING_OUTER_OUTSET, -CURSOR_RING_OUTER_OUTSET);
rgn.op(ir, SkRegion::kUnion_Op);
}
rgn.getBoundaryPath(&path);
SkPaint paint;
paint.setAntiAlias(true);
- paint.setPathEffect(new SkCornerPathEffect(
- SkIntToScalar(colors.radius())))->unref();
- SkColor outer;
- SkColor inner;
+ paint.setPathEffect(new SkCornerPathEffect(CURSOR_RING_ROUNDEDNESS))->unref();
if (m_flavor >= NORMAL_ANIMATING) { // pressed
- SkColor pressed;
- pressed = colors.fillColor();
- paint.setColor(pressed);
+ paint.setColor(cursorPressedColors[m_flavor - NORMAL_ANIMATING]);
canvas->drawPath(path, paint);
}
- if (m_flavor >= NORMAL_ANIMATING) {
- outer = colors.pressedOuterColor();
- inner = colors.pressedInnerColor();
- } else {
- outer = colors.selectedOuterColor();
- inner = colors.selectedInnerColor();
- }
paint.setStyle(SkPaint::kStroke_Style);
- paint.setStrokeWidth(colors.outerWidth() * WIDTH_SCALE);
- paint.setColor(outer);
+ paint.setStrokeWidth(CURSOR_RING_OUTER_DIAMETER);
+ paint.setColor(cursorOuterColors[m_flavor]);
canvas->drawPath(path, paint);
- paint.setStrokeWidth(colors.innerWidth() * WIDTH_SCALE);
- paint.setColor(inner);
+ paint.setStrokeWidth(CURSOR_RING_INNER_DIAMETER);
+ paint.setColor(cursorInnerColors[m_flavor]);
canvas->drawPath(path, paint);
}
@@ -132,8 +140,7 @@ bool CursorRing::setup()
m_rings.clear();
m_rings.append(m_bounds);
}
- const CachedColor& colors = m_frame->color(m_node);
- m_bounds.inflate(SkScalarCeil(colors.outerWidth()));
+ m_bounds.inflate(SkScalarCeil(CURSOR_RING_OUTER_DIAMETER));
if (!m_node->hasCursorRing() || (m_node->isPlugin() && m_node->isFocus()))
return false;
m_flavor = NORMAL_FLAVOR;
@@ -152,12 +159,6 @@ bool CursorRing::setup()
m_flavor == FAKE_ANIMATING ? "FAKE_ANIMATING" : "NORMAL_FLAVOR",
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%0x08x pout=0x%0x08x 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/WebCore/platform/graphics/android/android_graphics.h b/WebCore/platform/graphics/android/android_graphics.h
index b42231d..dbf1978 100644
--- a/WebCore/platform/graphics/android/android_graphics.h
+++ b/WebCore/platform/graphics/android/android_graphics.h
@@ -49,6 +49,9 @@ class WebViewCore;
// used to inflate node cache entry
#define CURSOR_RING_HIT_TEST_RADIUS 5
+// used to inval rectangle enclosing pressed state of ring
+#define CURSOR_RING_OUTER_DIAMETER SkFixedToScalar(SkIntToFixed(13)>>2) // 13/4 == 3.25
+
class CursorRing : public DrawExtra {
public:
enum Flavor {