summaryrefslogtreecommitdiffstats
path: root/WebKit/android/RenderSkinMediaButton.cpp
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2011-03-16 16:47:28 -0400
committerLeon Scroggins <scroggo@google.com>2011-03-16 16:47:28 -0400
commit25c567bcadfca2ae877c3113e581c1fe1645e9fa (patch)
tree27a66be490d06b0333c60fb7d7d709fb5745c621 /WebKit/android/RenderSkinMediaButton.cpp
parent0bbec56c50049ac90827b0fa48ffd2e420c3ab74 (diff)
parent9fa3237f0580871f004d6d0515247a84e1100bed (diff)
downloadexternal_webkit-25c567bcadfca2ae877c3113e581c1fe1645e9fa.zip
external_webkit-25c567bcadfca2ae877c3113e581c1fe1645e9fa.tar.gz
external_webkit-25c567bcadfca2ae877c3113e581c1fe1645e9fa.tar.bz2
resolved conflicts for merge of 9fa3237f to master
Change-Id: I04c05a531d31cd8f44104a31f107eba786aaa9b4
Diffstat (limited to 'WebKit/android/RenderSkinMediaButton.cpp')
-rw-r--r--WebKit/android/RenderSkinMediaButton.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/WebKit/android/RenderSkinMediaButton.cpp b/WebKit/android/RenderSkinMediaButton.cpp
index 8d426a3..9969763 100644
--- a/WebKit/android/RenderSkinMediaButton.cpp
+++ b/WebKit/android/RenderSkinMediaButton.cpp
@@ -30,7 +30,9 @@
#include "Document.h"
#include "IntRect.h"
#include "Node.h"
+#include "RenderObject.h"
#include "RenderSkinMediaButton.h"
+#include "RenderSlider.h"
#include "SkCanvas.h"
#include "SkNinePatch.h"
#include "SkRect.h"
@@ -45,7 +47,7 @@ struct PatchData {
static const PatchData gFiles[] =
{
- { "btn_media_player.9.png", 0, 0 }, // DEFAULT BGD BUTTON
+ { "scrubber_primary_holo.9.png", 0, 0 }, // SLIDER_TRACK, left of the SLIDER_THUMB
{ "ic_media_pause.png", 0, 0}, // PAUSE
{ "ic_media_play.png", 0, 0 }, // PLAY
{ "ic_media_pause.png", 0, 0 }, // MUTE
@@ -82,7 +84,8 @@ void RenderSkinMediaButton::Init(android::AssetManager* am, String drawableDirec
}
}
-void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType, bool translucent)
+void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonType,
+ bool translucent, RenderObject* o)
{
// If we failed to decode, do nothing. This way the browser still works,
// and webkit will still draw the label and layout space for us.
@@ -163,7 +166,34 @@ void RenderSkinMediaButton::Draw(SkCanvas* canvas, const IntRect& r, int buttonT
SkIRect margin;
margin.set(marginValue, marginValue, marginValue, marginValue);
- SkNinePatch::DrawNine(canvas, bounds, gButton[0], margin);
+ if (buttonType == SLIDER_TRACK) {
+ // Cut the height in half (with some extra slop determined by trial
+ // and error to get the placement just right.
+ SkScalar quarterHeight = SkScalarHalf(SkScalarHalf(bounds.height()));
+ bounds.fTop += quarterHeight + SkScalarHalf(3);
+ bounds.fBottom += -quarterHeight + SK_ScalarHalf;
+ if (o && o->isSlider()) {
+ RenderSlider* slider = toRenderSlider(o);
+ IntRect thumb = slider->thumbRect();
+ // Inset the track by half the width of the thumb, so the track
+ // does not appear to go beyond the space where the thumb can
+ // be.
+ SkScalar thumbHalfWidth = SkIntToScalar(thumb.width()/2);
+ bounds.fLeft += thumbHalfWidth;
+ bounds.fRight -= thumbHalfWidth;
+ if (thumb.x() > 0) {
+ // The video is past the starting point. Show the area to
+ // left of the thumb as having been played.
+ SkScalar alreadyPlayed = SkIntToScalar(thumb.center().x() + r.x());
+ SkRect playedRect(bounds);
+ playedRect.fRight = alreadyPlayed;
+ SkNinePatch::DrawNine(canvas, playedRect, gButton[0], margin);
+ bounds.fLeft = alreadyPlayed;
+ }
+
+ }
+ }
+ SkNinePatch::DrawNine(canvas, bounds, gButton[ninePatchIndex], margin);
}
if (drawsImage) {