WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
27859
[chromium] Implement media slider for chromium
https://bugs.webkit.org/show_bug.cgi?id=27859
Summary
[chromium] Implement media slider for chromium
Hin-Chung Lam
Reported
2009-07-30 15:25:01 PDT
Need to proper implement the media slider for chromium port.
Attachments
sample image
(84.26 KB, image/png)
2009-07-30 15:25 PDT
,
Hin-Chung Lam
no flags
Details
patch
(11.61 KB, patch)
2009-07-30 15:43 PDT
,
Hin-Chung Lam
no flags
Details
Formatted Diff
Diff
sample image
(83.49 KB, image/png)
2009-07-31 13:19 PDT
,
Hin-Chung Lam
no flags
Details
patch
(12.24 KB, patch)
2009-07-31 13:20 PDT
,
Hin-Chung Lam
levin
: review-
Details
Formatted Diff
Diff
patch
(13.92 KB, patch)
2009-08-03 16:30 PDT
,
Hin-Chung Lam
no flags
Details
Formatted Diff
Diff
patch
(14.07 KB, patch)
2009-08-03 16:59 PDT
,
Hin-Chung Lam
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Hin-Chung Lam
Comment 1
2009-07-30 15:25:30 PDT
Created
attachment 33844
[details]
sample image The media slider bar should look like this.
Hin-Chung Lam
Comment 2
2009-07-30 15:43:23 PDT
Created
attachment 33846
[details]
patch
Hin-Chung Lam
Comment 3
2009-07-30 15:46:52 PDT
As you can see in the sample image the progress bar is in solid color, would it look better if it has a gradient?
Hin-Chung Lam
Comment 4
2009-07-31 13:19:19 PDT
Created
attachment 33896
[details]
sample image
Hin-Chung Lam
Comment 5
2009-07-31 13:20:11 PDT
Created
attachment 33897
[details]
patch
Hin-Chung Lam
Comment 6
2009-07-31 13:20:40 PDT
I have updated the code and sample image, please take a look.
Hin-Chung Lam
Comment 7
2009-07-31 13:52:32 PDT
ok, the latest implementation is good for review now.
David Levin
Comment 8
2009-08-03 13:56:03 PDT
Comment on
attachment 33897
[details]
patch Here's quick review. Some potential bugs, but mostly style issues.
> Index: WebCore/rendering/RenderThemeChromiumSkia.cpp
> +bool RenderThemeChromiumSkia::paintMediaControlsBackground(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
o -> object (Use whole words, same comment throughout)
> +{ > +#if ENABLE(VIDEO)
>
> + // Draws the left border, it is always 1px wide. > + paint.setColor(o->style()->borderLeftColor().rgb()); > + canvas->drawLine(rect.x() + 1, > + rect.y(), > + rect.x() + 1, > + rect.y() + rect.height(), > + paint); > + > + // Draws the right border, it is always 1px wide. > + paint.setColor(o->style()->borderRightColor().rgb()); > + canvas->drawLine(rect.x() + rect.width() - 1, > + rect.y(), > + rect.x() + rect.width() - 1, > + rect.y() + rect.height(), > + paint);
Does the rect have to be at least one pixel wide? If not, it looks like this could do weird things.
> + return true; > +#else
I think this may get unused variable warnings here. So you should probably use the UNUSED_PARAM macro (from wtf, same comment throughout.
> + return false; > +#endif > +} > + > +bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) > +{
> + > + // Draw the buffered ranges. > + // FIXME: Draw multiple ranges if there are multiple buffered ranges. > + SkRect bufferedRect; > + bufferedRect.set(backgroundRect.fLeft + 2, > + backgroundRect.fTop + 2, > + backgroundRect.fRight - 2, > + backgroundRect.fBottom - 2);
Is backgroundRect at least four pixels wide/heigh?
> + int width = static_cast<int>(bufferedRect.width() * > + mediaElement->percentLoaded()); > + bufferedRect.fRight = bufferedRect.fLeft + width; > + > + SkPoint points[2] = { {0, bufferedRect.fTop}, {0, bufferedRect.fBottom} };
I think there is usually a space inside the { (but this is inconsistent with itself).
> + SkColor startColor = o->style()->color().rgb(); > + SkColor endColor = SkColorSetRGB(SkColorGetR(startColor) / 2, > + SkColorGetG(startColor) / 2, > + SkColorGetB(startColor) / 2); > + SkColor colors[2] = { startColor, endColor};
Space before }.
> + SkShader* gradient = SkGradientShader::CreateLinear( > + points, colors, NULL, 2, SkShader::kMirror_TileMode, NULL);
Use 0 instead of NULL. Why is there a "2" in here? (Is it the arraysize of colors? If so, there are macro for this.) Lastly, this wrapping looks like something done to meet 80 columns (which isn't necessary in WebKit code). I would just unwrap this line.
> + > + paint.reset(); > + paint.setShader(gradient); > + paint.setAntiAlias(true); > + canvas->drawRoundRect(bufferedRect, borderRadius.width(), > + borderRadius.height(), paint);
There is no need to wrap at 80 columns in webkit code, so do whatever looks best.
> + gradient->unref();
Are there any smart points for these skia types? (like RefCounted?)
> bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& rect) > Index: WebCore/rendering/RenderThemeChromiumSkia.h > ===================================================================> > + virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); > + virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); > + virtual void adjustSliderThumbSize(RenderObject* o) const;
Don't include param names when they don't add information. "o"
> Index: WebCore/rendering/RenderThemeChromiumWin.cpp > ===================================================================
> o->style()->setHeight(Length(sliderThumbAlongAxis, Fixed)); > + } else { > + RenderThemeChromiumSkia::adjustSliderThumbSize(o); > }
Don't use {} for single line statements.
Hin-Chung Lam
Comment 9
2009-08-03 16:30:30 PDT
Created
attachment 34016
[details]
patch
Hin-Chung Lam
Comment 10
2009-08-03 16:35:09 PDT
I'd leave the unref() as is because SkAutoUnref is not a template type, if I use this in this code I need to have additional casting. As for number of points, I just leave it as is.
Hin-Chung Lam
Comment 11
2009-08-03 16:59:30 PDT
Created
attachment 34023
[details]
patch
David Levin
Comment 12
2009-08-03 17:04:10 PDT
Comment on
attachment 34023
[details]
patch r+ since this passed a review within the chromium video folks and passed a sanity check by me.
Adam Barth
Comment 13
2009-08-03 17:31:15 PDT
Will land.
Adam Barth
Comment 14
2009-08-03 17:44:00 PDT
Comment on
attachment 34023
[details]
patch Clearing review flag on attachment: 34023 Committing to
http://svn.webkit.org/repository/webkit/trunk
... M WebCore/ChangeLog M WebCore/css/mediaControlsChromium.css M WebCore/rendering/RenderThemeChromiumSkia.cpp M WebCore/rendering/RenderThemeChromiumSkia.h M WebCore/rendering/RenderThemeChromiumWin.cpp Committed
r46740
M WebCore/ChangeLog M WebCore/rendering/RenderThemeChromiumSkia.cpp M WebCore/rendering/RenderThemeChromiumSkia.h M WebCore/rendering/RenderThemeChromiumWin.cpp M WebCore/css/mediaControlsChromium.css
r46740
= 3650cb3c52838303e8d91c3eaebc49b4be0da261 (trunk) No changes between current HEAD and refs/remotes/trunk Resetting to the latest refs/remotes/trunk
http://trac.webkit.org/changeset/46740
Adam Barth
Comment 15
2009-08-03 17:44:04 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug