[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jer.noble at apple.com
jer.noble at apple.com
Wed Dec 22 13:19:05 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3ab0eae8378ba5b8c5c6e9f1c6880eb4567a5ba6
Author: jer.noble at apple.com <jer.noble at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 10 23:56:16 2010 +0000
2010-09-09 Jer Noble <jer.noble at apple.com>
Reviewed by Eric Carlson.
Adopt shared control drawing for <video> controls on Windows
https://bugs.webkit.org/show_bug.cgi?id=45490
* win/lib/WebKitSystemInterface.lib:
* win/lib/WebKitSystemInterface_debug.lib:
2010-09-09 Jer Noble <jer.noble at apple.com>
Reviewed by Eric Carlson.
Adopt shared control drawing for <video> controls on Windows
https://bugs.webkit.org/show_bug.cgi?id=45490
* DerivedSources.make: Remove the OS check around mediaControlsQuickTime.css.
* rendering/RenderMediaControls.cpp:
(WebCore::determineState): Use WKMediaControllerThemeState flags instead of SafariTheme ones.
(WebCore::getUnzoomedRectAndAdjustCurrentContext): Added. Copied verbatim from RenderMediaMac.mm.
(WebCore::RenderMediaControls::adjustMediaSliderThumbSize): Use wkMeasureMediaUIPart to adjust the thumb size.
(WebCore::RenderMediaControls::paintMediaControlsPart): Use wkDrawMediaUIPart instead of paintThemePart.
(WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): Added. Copied verbatim from RenderMediaMac.mm.
* rendering/RenderMediaControls.h:
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::adjustSliderThumbSize): Adjust both sliders and volume sliders.
(WebCore::RenderThemeWin::extraMediaControlsStyleSheet): Added. Returns the mediaControlsQuickTime sheet.
(WebCore::RenderThemeWin::paintMediaRewindButton): Added. Pass through to RenderMediaControls.
(WebCore::RenderThemeWin::paintMediaControlsBackground): Added. Pass through to RenderMediaControls.
(WebCore::RenderThemeWin::paintMediaVolumeSliderContainer): Added. Pass through to RenderMediaControls.
(WebCore::RenderThemeWin::paintMediaVolumeSliderTrack): Added. Pass through to RenderMediaControls.
(WebCore::RenderThemeWin::paintMediaVolumeSliderThumb): Added. Pass through to RenderMediaControls.
(WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton): Added. Pass through to RenderMediaControls.
* rendering/RenderThemeWin.h:
2010-09-109 Peter Kasting <pkasting at google.com>
Reviewed by Darin Adler.
Cleanup and simplification in advance of making middle clicks not send a
click event.
https://bugs.webkit.org/show_bug.cgi?id=22382
* editing/DeleteButton.cpp:
(WebCore::DeleteButton::defaultEventHandler): Removed unneeded code to
check if the event is a MouseEvent. Any click event will do.
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition): Added. Factors out the
modifications to the URL to add the mouse position to make the default
event handler function easier to read.
(WebCore::HTMLAnchorElement::defaultEventHandler): Reorganized to make
the enter key logic separate from the link clicking logic and simplify
the function. This makes minor functional changes like not calling
FrameLoader::urlSelected() for fake "keydown" events constructed from
JavaScript.
(WebCore::HTMLAnchorElement::isLiveLink): Refactored to use new shared
implementation in treatLinkAsLiveForEventType().
(WebCore::eventType): Factors out event type calculation (for
treatLinkAsLiveForEventType()) from the default event handler to make it
easier to read.
(WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
Implementation of the portions of isLiveLink() that are common with the
checks defaultEventHandler() wants to do.
(WebCore::isEnterKeyKeydownEvent): Added. Shared by the default
event handlers for all three anchor elements.
(WebCore::isMiddleMouseButtonEvent): Added. Shared by the isLinkClick
function below and some code in SVG. Later we can make this private to
this source file once we remove the unneeded SVG code.
(WebCore::isLinkClick): Added. Shared by the default event handlers for
all three anchor elements.
(WebCore::handleLinkClick): Ditto.
* html/HTMLAnchorElement.h: Added the new functions.
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler): Removed lots of unneeded
logic and streamlined the code to more closely match the
HTMLAnchorElement code and share functions with it.
* wml/WMLAElement.cpp:
(WebCore::WMLAElement::defaultEventHandler): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67251 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt b/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt
index 77de6be..18e72b5 100644
--- a/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt
+++ b/LayoutTests/platform/win/media/audio-controls-rendering-expected.txt
@@ -21,7 +21,7 @@ layer at (8,42) size 200x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 136x16
RenderSlider {INPUT} at (0,0) size 136x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (152,0) size 16x16
RenderButton {INPUT} at (168,0) size 16x16
RenderButton {INPUT} at (184,0) size 16x16
@@ -32,7 +32,7 @@ layer at (8,76) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
@@ -45,7 +45,7 @@ layer at (8,194) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/controls-after-reload-expected.txt b/LayoutTests/platform/win/media/controls-after-reload-expected.txt
index 59db57a..bf845b6 100644
--- a/LayoutTests/platform/win/media/controls-after-reload-expected.txt
+++ b/LayoutTests/platform/win/media/controls-after-reload-expected.txt
@@ -17,7 +17,7 @@ layer at (8,266) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/controls-strict-expected.txt b/LayoutTests/platform/win/media/controls-strict-expected.txt
index 3bbf77d..082c430 100644
--- a/LayoutTests/platform/win/media/controls-strict-expected.txt
+++ b/LayoutTests/platform/win/media/controls-strict-expected.txt
@@ -17,7 +17,7 @@ layer at (8,274) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/controls-styling-expected.txt b/LayoutTests/platform/win/media/controls-styling-expected.txt
index f53f32e..599f7f8 100644
--- a/LayoutTests/platform/win/media/controls-styling-expected.txt
+++ b/LayoutTests/platform/win/media/controls-styling-expected.txt
@@ -21,7 +21,7 @@ layer at (18,266) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
@@ -32,7 +32,7 @@ layer at (8,506) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/video-controls-rendering-expected.txt b/LayoutTests/platform/win/media/video-controls-rendering-expected.txt
index fff11e1..9deee0f 100644
--- a/LayoutTests/platform/win/media/video-controls-rendering-expected.txt
+++ b/LayoutTests/platform/win/media/video-controls-rendering-expected.txt
@@ -22,7 +22,7 @@ layer at (8,266) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
@@ -33,7 +33,7 @@ layer at (8,506) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
@@ -46,7 +46,7 @@ layer at (8,746) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/video-display-toggle-expected.txt b/LayoutTests/platform/win/media/video-display-toggle-expected.txt
index 285d545..051f8d3 100644
--- a/LayoutTests/platform/win/media/video-display-toggle-expected.txt
+++ b/LayoutTests/platform/win/media/video-display-toggle-expected.txt
@@ -16,7 +16,7 @@ layer at (8,250) size 320x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 256x16
RenderSlider {INPUT} at (0,0) size 256x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (272,0) size 16x16
RenderButton {INPUT} at (288,0) size 16x16
RenderButton {INPUT} at (304,0) size 16x16
diff --git a/LayoutTests/platform/win/media/video-no-audio-expected.txt b/LayoutTests/platform/win/media/video-no-audio-expected.txt
index 922f9f2..f01dd1a 100644
--- a/LayoutTests/platform/win/media/video-no-audio-expected.txt
+++ b/LayoutTests/platform/win/media/video-no-audio-expected.txt
@@ -17,6 +17,6 @@ layer at (8,314) size 352x16
RenderButton {INPUT} at (0,0) size 16x16
RenderFlexibleBox {DIV} at (16,0) size 304x16
RenderSlider {INPUT} at (0,0) size 304x16
- RenderBlock {DIV} at (2,1) size 13x14
+ RenderBlock {DIV} at (2,4) size 10x8
RenderButton {INPUT} at (320,0) size 16x16
RenderButton {INPUT} at (336,0) size 16x16
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1452c9d..00ead9b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2010-09-09 Jer Noble <jer.noble at apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Adopt shared control drawing for <video> controls on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=45490
+
+ * DerivedSources.make: Remove the OS check around mediaControlsQuickTime.css.
+ * rendering/RenderMediaControls.cpp:
+ (WebCore::determineState): Use WKMediaControllerThemeState flags instead of SafariTheme ones.
+ (WebCore::getUnzoomedRectAndAdjustCurrentContext): Added. Copied verbatim from RenderMediaMac.mm.
+ (WebCore::RenderMediaControls::adjustMediaSliderThumbSize): Use wkMeasureMediaUIPart to adjust the thumb size.
+ (WebCore::RenderMediaControls::paintMediaControlsPart): Use wkDrawMediaUIPart instead of paintThemePart.
+ (WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): Added. Copied verbatim from RenderMediaMac.mm.
+ * rendering/RenderMediaControls.h:
+ * rendering/RenderThemeWin.cpp:
+ (WebCore::RenderThemeWin::adjustSliderThumbSize): Adjust both sliders and volume sliders.
+ (WebCore::RenderThemeWin::extraMediaControlsStyleSheet): Added. Returns the mediaControlsQuickTime sheet.
+ (WebCore::RenderThemeWin::paintMediaRewindButton): Added. Pass through to RenderMediaControls.
+ (WebCore::RenderThemeWin::paintMediaControlsBackground): Added. Pass through to RenderMediaControls.
+ (WebCore::RenderThemeWin::paintMediaVolumeSliderContainer): Added. Pass through to RenderMediaControls.
+ (WebCore::RenderThemeWin::paintMediaVolumeSliderTrack): Added. Pass through to RenderMediaControls.
+ (WebCore::RenderThemeWin::paintMediaVolumeSliderThumb): Added. Pass through to RenderMediaControls.
+ (WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton): Added. Pass through to RenderMediaControls.
+ * rendering/RenderThemeWin.h:
+
2010-09-109 Peter Kasting <pkasting at google.com>
Reviewed by Darin Adler.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index c37efb3..ea301b8 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -676,10 +676,8 @@ endif
ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO)
USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControls.css
-ifeq ($(OS),MACOS)
USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/mediaControlsQuickTime.css
endif
-endif
ifeq ($(findstring ENABLE_FULLSCREEN_API,$(FEATURE_DEFINES)), ENABLE_FULLSCREEN_API)
USER_AGENT_STYLE_SHEETS := $(USER_AGENT_STYLE_SHEETS) $(WebCore)/css/fullscreen.css
diff --git a/WebCore/rendering/RenderMediaControls.cpp b/WebCore/rendering/RenderMediaControls.cpp
index f75da70..9c4757c 100644
--- a/WebCore/rendering/RenderMediaControls.cpp
+++ b/WebCore/rendering/RenderMediaControls.cpp
@@ -29,44 +29,51 @@
#include "GraphicsContext.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
-#include "RenderThemeSafari.h"
-#include "SoftLinking.h"
+#include "RenderTheme.h"
#include <CoreGraphics/CoreGraphics.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+
+#if PLATFORM(WIN)
+// The Windows version of WKSI defines these functions as capitalized, while the Mac version defines them as lower case.
+#define wkMediaControllerThemeAvailable(themeStyle) WKMediaControllerThemeAvailable(themeStyle)
+#define wkHitTestMediaUIPart(part, themeStyle, bounds, point) WKHitTestMediaUIPart(part, themeStyle, bounds, point)
+#define wkMeasureMediaUIPart(part, themeStyle, bounds, naturalSize) WKMeasureMediaUIPart(part, themeStyle, bounds, naturalSize)
+#define wkDrawMediaUIPart(part, themeStyle, context, rect, state) WKDrawMediaUIPart(part, themeStyle, context, rect, state)
+#define wkDrawMediaSliderTrack(themeStyle, context, rect, timeLoaded, currentTime, duration, state) WKDrawMediaSliderTrack(themeStyle, context, rect, timeLoaded, currentTime, duration, state)
+#endif
using namespace std;
namespace WebCore {
-#ifdef DEBUG_ALL
-SOFT_LINK_DEBUG_LIBRARY(SafariTheme)
-#else
-SOFT_LINK_LIBRARY(SafariTheme)
-#endif
-
-SOFT_LINK(SafariTheme, paintThemePart, void, __stdcall, (ThemePart part, CGContextRef context, const CGRect& rect, NSControlSize size, ThemeControlState state), (part, context, rect, size, state))
-SOFT_LINK(SafariTheme, STPaintProgressIndicator, void, APIENTRY, (ProgressIndicatorType type, CGContextRef context, const CGRect& rect, NSControlSize size, ThemeControlState state, float value), (type, context, rect, size, state, value))
-
#if ENABLE(VIDEO)
-static ThemeControlState determineState(RenderObject* o)
+static WKMediaControllerThemeState determineState(RenderObject* o)
{
- ThemeControlState result = 0;
+ int result = 0;
RenderTheme* theme = o->theme();
- if (theme->isActive(o))
- result |= SafariTheme::ActiveState;
- if (theme->isEnabled(o) && !theme->isReadOnlyControl(o))
- result |= SafariTheme::EnabledState;
+ if (!theme->isEnabled(o) || theme->isReadOnlyControl(o))
+ result |= WKMediaControllerFlagDisabled;
if (theme->isPressed(o))
- result |= SafariTheme::PressedState;
- if (theme->isChecked(o))
- result |= SafariTheme::CheckedState;
- if (theme->isIndeterminate(o))
- result |= SafariTheme::IndeterminateCheckedState;
+ result |= WKMediaControllerFlagPressed;
if (theme->isFocused(o))
- result |= SafariTheme::FocusedState;
- if (theme->isDefault(o))
- result |= SafariTheme::DefaultState;
- return result;
+ result |= WKMediaControllerFlagFocused;
+ return static_cast<WKMediaControllerThemeState>(result);
+}
+
+// Utility to scale when the UI part are not scaled by wkDrawMediaUIPart
+static FloatRect getUnzoomedRectAndAdjustCurrentContext(RenderObject* o, const PaintInfo& paintInfo, const IntRect &originalRect)
+{
+ float zoomLevel = o->style()->effectiveZoom();
+ FloatRect unzoomedRect(originalRect);
+ if (zoomLevel != 1.0f) {
+ unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
+ unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
+ paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
+ paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel));
+ paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
+ }
+ return unzoomedRect;
}
static const int mediaSliderThumbWidth = 13;
@@ -74,73 +81,78 @@ static const int mediaSliderThumbHeight = 14;
void RenderMediaControls::adjustMediaSliderThumbSize(RenderObject* o)
{
- if (o->style()->appearance() != MediaSliderThumbPart)
+ ControlPart part = o->style()->appearance();
+
+ if (part != MediaSliderThumbPart && part != MediaVolumeSliderThumbPart)
return;
+ CGSize size;
+ wkMeasureMediaUIPart(part == MediaSliderThumbPart ? MediaSliderThumb : MediaVolumeSliderThumb, WKMediaControllerThemeQuickTime, 0, &size);
+
float zoomLevel = o->style()->effectiveZoom();
- o->style()->setWidth(Length(static_cast<int>(mediaSliderThumbWidth * zoomLevel), Fixed));
- o->style()->setHeight(Length(static_cast<int>(mediaSliderThumbHeight * zoomLevel), Fixed));
+ o->style()->setWidth(Length(static_cast<int>(size.width * zoomLevel), Fixed));
+ o->style()->setHeight(Length(static_cast<int>(size.height * zoomLevel), Fixed));
}
bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
- ASSERT(SafariThemeLibrary());
-
+ static const int themeStyle = WKMediaControllerThemeQuickTime;
+ paintInfo.context->save();
switch (part) {
case MediaFullscreenButton:
- paintThemePart(SafariTheme::MediaFullscreenButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(WKMediaUIPartFullscreenButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaShowClosedCaptionsButton:
case MediaHideClosedCaptionsButton:
-#if SAFARI_THEME_VERSION >= 4
if (MediaControlToggleClosedCaptionsButtonElement* btn = static_cast<MediaControlToggleClosedCaptionsButtonElement*>(o->node())) {
bool captionsVisible = btn->displayType() == MediaHideClosedCaptionsButton;
- paintThemePart(captionsVisible ? SafariTheme::MediaHideClosedCaptionsButtonPart : SafariTheme::MediaShowClosedCaptionsButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(captionsVisible ? WKMediaUIPartHideClosedCaptionsButton : WKMediaUIPartShowClosedCaptionsButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
}
-#endif
break;
case MediaMuteButton:
case MediaUnMuteButton:
if (MediaControlMuteButtonElement* btn = static_cast<MediaControlMuteButtonElement*>(o->node())) {
bool audioEnabled = btn->displayType() == MediaMuteButton;
- paintThemePart(audioEnabled ? SafariTheme::MediaMuteButtonPart : SafariTheme::MediaUnMuteButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(audioEnabled ? WKMediaUIPartMuteButton : WKMediaUIPartUnMuteButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
}
break;
case MediaPauseButton:
case MediaPlayButton:
if (MediaControlPlayButtonElement* btn = static_cast<MediaControlPlayButtonElement*>(o->node())) {
bool canPlay = btn->displayType() == MediaPlayButton;
- paintThemePart(canPlay ? SafariTheme::MediaPlayButtonPart : SafariTheme::MediaPauseButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(canPlay ? WKMediaUIPartPlayButton : WKMediaUIPartPauseButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
}
break;
+ case MediaRewindButton:
+ wkDrawMediaUIPart(WKMediaUIPartRewindButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
+ break;
case MediaSeekBackButton:
- paintThemePart(SafariTheme::MediaSeekBackButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(WKMediaUIPartSeekBackButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaSeekForwardButton:
- paintThemePart(SafariTheme::MediaSeekForwardButtonPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(WKMediaUIPartSeekForwardButton, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaSlider: {
- if (HTMLMediaElement* mediaElement = toParentMediaElement(o))
- STPaintProgressIndicator(SafariTheme::MediaType, paintInfo.context->platformContext(), r, NSRegularControlSize, 0, mediaElement->percentLoaded());
+ if (HTMLMediaElement* mediaElement = toParentMediaElement(o)) {
+ FloatRect unzoomedRect = getUnzoomedRectAndAdjustCurrentContext(o, paintInfo, r);
+ wkDrawMediaSliderTrack(themeStyle, paintInfo.context->platformContext(), unzoomedRect, mediaElement->percentLoaded() * mediaElement->duration(), mediaElement->currentTime(), mediaElement->duration(), determineState(o));
+ }
break;
}
case MediaSliderThumb:
- paintThemePart(SafariTheme::MediaSliderThumbPart, paintInfo.context->platformContext(), r, NSRegularControlSize, determineState(o));
+ wkDrawMediaUIPart(WKMediaUIPartTimelineSliderThumb, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaVolumeSliderContainer:
- // FIXME: Implement volume slider.
- ASSERT_NOT_REACHED();
+ wkDrawMediaUIPart(WKMediaUIPartVolumeSliderContainer, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaVolumeSlider:
- // FIXME: Implement volume slider.
- ASSERT_NOT_REACHED();
+ wkDrawMediaUIPart(WKMediaUIPartVolumeSlider, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaVolumeSliderThumb:
- // FIXME: Implement volume slider.
- ASSERT_NOT_REACHED();
+ wkDrawMediaUIPart(WKMediaUIPartVolumeSliderThumb, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaTimelineContainer:
- ASSERT_NOT_REACHED();
+ wkDrawMediaUIPart(WKMediaUIPartBackground, themeStyle, paintInfo.context->platformContext(), r, determineState(o));
break;
case MediaCurrentTimeDisplay:
ASSERT_NOT_REACHED();
@@ -152,9 +164,24 @@ bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R
ASSERT_NOT_REACHED();
break;
}
+ paintInfo.context->restore();
+
return false;
}
+IntPoint RenderMediaControls::volumeSliderOffsetFromMuteButton(Node* muteButton, const IntSize& size)
+{
+ static const int xOffset = -4;
+ static const int yOffset = 5;
+
+ float zoomLevel = muteButton->renderer()->style()->effectiveZoom();
+ int y = yOffset * zoomLevel + muteButton->renderBox()->offsetHeight() - size.height();
+ FloatPoint absPoint = muteButton->renderer()->localToAbsolute(FloatPoint(muteButton->renderBox()->offsetLeft(), y), true, true);
+ if (absPoint.y() < 0)
+ y = muteButton->renderBox()->height();
+ return IntPoint(xOffset * zoomLevel, y);
+
+}
#endif // #if ENABLE(VIDEO)
} // namespace WebCore
diff --git a/WebCore/rendering/RenderMediaControls.h b/WebCore/rendering/RenderMediaControls.h
index 9683dd7..f05c549 100644
--- a/WebCore/rendering/RenderMediaControls.h
+++ b/WebCore/rendering/RenderMediaControls.h
@@ -36,6 +36,7 @@ class RenderMediaControls {
public:
static bool paintMediaControlsPart(MediaControlElementType, RenderObject*, const PaintInfo&, const IntRect&);
static void adjustMediaSliderThumbSize(RenderObject*);
+ static IntPoint volumeSliderOffsetFromMuteButton(Node*, const IntSize&);
};
} // namespace WebCore
diff --git a/WebCore/rendering/RenderThemeWin.cpp b/WebCore/rendering/RenderThemeWin.cpp
index 8a33173..b4fb8eb 100644
--- a/WebCore/rendering/RenderThemeWin.cpp
+++ b/WebCore/rendering/RenderThemeWin.cpp
@@ -749,15 +749,16 @@ const int sliderThumbHeight = 15;
void RenderThemeWin::adjustSliderThumbSize(RenderObject* o) const
{
- if (o->style()->appearance() == SliderThumbVerticalPart) {
+ ControlPart part = o->style()->appearance();
+ if (part == SliderThumbVerticalPart) {
o->style()->setWidth(Length(sliderThumbHeight, Fixed));
o->style()->setHeight(Length(sliderThumbWidth, Fixed));
- } else if (o->style()->appearance() == SliderThumbHorizontalPart) {
+ } else if (part == SliderThumbHorizontalPart) {
o->style()->setWidth(Length(sliderThumbWidth, Fixed));
o->style()->setHeight(Length(sliderThumbHeight, Fixed));
}
#if ENABLE(VIDEO)
- else if (o->style()->appearance() == MediaSliderThumbPart)
+ else if (part == MediaSliderThumbPart || part == MediaVolumeSliderThumbPart)
RenderMediaControls::adjustMediaSliderThumbSize(o);
#endif
}
@@ -937,6 +938,11 @@ Color RenderThemeWin::systemColor(int cssValueId) const
#if ENABLE(VIDEO)
+String RenderThemeWin::extraMediaControlsStyleSheet()
+{
+ return String(mediaControlsQuickTimeUserAgentStyleSheet, sizeof(mediaControlsQuickTimeUserAgentStyleSheet));
+}
+
bool RenderThemeWin::shouldRenderMediaControlPart(ControlPart part, Element* element)
{
if (part == MediaToggleClosedCaptionsButtonPart) {
@@ -968,6 +974,11 @@ bool RenderThemeWin::paintMediaPlayButton(RenderObject* o, const PaintInfo& pain
return RenderMediaControls::paintMediaControlsPart(MediaPlayButton, o, paintInfo, r);
}
+bool RenderThemeWin::paintMediaRewindButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderMediaControls::paintMediaControlsPart(MediaRewindButton, o, paintInfo, r);
+}
+
bool RenderThemeWin::paintMediaSeekBackButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
return RenderMediaControls::paintMediaControlsPart(MediaSeekBackButton, o, paintInfo, r);
@@ -993,6 +1004,32 @@ bool RenderThemeWin::paintMediaToggleClosedCaptionsButton(RenderObject* o, const
return RenderMediaControls::paintMediaControlsPart(MediaShowClosedCaptionsButton, o, paintInfo, r);
}
+bool RenderThemeWin::paintMediaControlsBackground(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderMediaControls::paintMediaControlsPart(MediaTimelineContainer, o, paintInfo, r);
+}
+
+bool RenderThemeWin::paintMediaVolumeSliderContainer(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderContainer, o, paintInfo, r);
+}
+
+bool RenderThemeWin::paintMediaVolumeSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderMediaControls::paintMediaControlsPart(MediaVolumeSlider, o, paintInfo, r);
+}
+
+bool RenderThemeWin::paintMediaVolumeSliderThumb(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, o, paintInfo, r);
+}
+
+IntPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(Node* muteButton, const IntSize& size) const
+{
+ return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButton, size);
+}
+
+
#endif
}
diff --git a/WebCore/rendering/RenderThemeWin.h b/WebCore/rendering/RenderThemeWin.h
index 0147900..1efb117 100644
--- a/WebCore/rendering/RenderThemeWin.h
+++ b/WebCore/rendering/RenderThemeWin.h
@@ -120,15 +120,22 @@ public:
virtual bool supportsFocusRing(const RenderStyle*) const;
#if ENABLE(VIDEO)
+ virtual String extraMediaControlsStyleSheet();
virtual bool shouldRenderMediaControlPart(ControlPart, Element*);
+ virtual bool paintMediaControlsBackground(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaFullscreenButton(RenderObject*, const PaintInfo&, const IntRect&);
- virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaMuteButton(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual bool paintMediaPlayButton(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual bool paintMediaRewindButton(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaSeekBackButton(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaSeekForwardButton(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
virtual bool paintMediaToggleClosedCaptionsButton(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual IntPoint volumeSliderOffsetFromMuteButton(Node*, const IntSize&) const;
#endif
private:
diff --git a/WebKitLibraries/ChangeLog b/WebKitLibraries/ChangeLog
index e1e53e6..5a0cf49 100644
--- a/WebKitLibraries/ChangeLog
+++ b/WebKitLibraries/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-09 Jer Noble <jer.noble at apple.com>
+
+ Reviewed by Eric Carlson.
+
+ Adopt shared control drawing for <video> controls on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=45490
+
+ * win/lib/WebKitSystemInterface.lib:
+ * win/lib/WebKitSystemInterface_debug.lib:
+
2010-09-10 Anders Carlsson <andersca at apple.com>
WebKitSystemInterface part of:
diff --git a/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h b/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
index 445b292..80830a7 100644
--- a/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
+++ b/WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
@@ -28,6 +28,7 @@
struct CGAffineTransform;
struct CGPoint;
+struct CGRect;
struct CGSize;
typedef const struct __CFData* CFDataRef;
@@ -89,4 +90,46 @@ CFURLCredentialRef wkCopyCredentialFromCFPersistentStorage(CFURLProtectionSpaceR
CFStringRef wkCFNetworkErrorGetLocalizedDescription(CFIndex errorCode);
+typedef enum {
+ WKMediaUIPartFullscreenButton = 0,
+ WKMediaUIPartMuteButton,
+ WKMediaUIPartPlayButton,
+ WKMediaUIPartSeekBackButton,
+ WKMediaUIPartSeekForwardButton,
+ WKMediaUIPartTimelineSlider,
+ WKMediaUIPartTimelineSliderThumb,
+ WKMediaUIPartRewindButton,
+ WKMediaUIPartSeekToRealtimeButton,
+ WKMediaUIPartShowClosedCaptionsButton,
+ WKMediaUIPartHideClosedCaptionsButton,
+ WKMediaUIPartUnMuteButton,
+ WKMediaUIPartPauseButton,
+ WKMediaUIPartBackground,
+ WKMediaUIPartCurrentTimeDisplay,
+ WKMediaUIPartTimeRemainingDisplay,
+ WKMediaUIPartStatusDisplay,
+ WKMediaUIPartControlsPanel,
+ WKMediaUIPartVolumeSliderContainer,
+ WKMediaUIPartVolumeSlider,
+ WKMediaUIPartVolumeSliderThumb
+} WKMediaUIPart;
+
+typedef enum {
+ WKMediaControllerThemeClassic = 1,
+ WKMediaControllerThemeQuickTime = 2
+} WKMediaControllerThemeStyle;
+
+typedef enum {
+ WKMediaControllerFlagDisabled = 1 << 0,
+ WKMediaControllerFlagPressed = 1 << 1,
+ WKMediaControllerFlagDrawEndCaps = 1 << 3,
+ WKMediaControllerFlagFocused = 1 << 4
+} WKMediaControllerThemeState;
+
+bool WKMediaControllerThemeAvailable(int themeStyle);
+bool WKHitTestMediaUIPart(int part, int themeStyle, CGRect bounds, CGPoint point);
+void WKMeasureMediaUIPart(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
+void WKDrawMediaUIPart(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
+void WKDrawMediaSliderTrack(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, float duration, unsigned state);
+
#endif // WebKitSystemInterface_h
diff --git a/WebKitLibraries/win/lib/WebKitSystemInterface.lib b/WebKitLibraries/win/lib/WebKitSystemInterface.lib
index 4fcc36b..40513e6 100644
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ
diff --git a/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib b/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib
index 6d836db..124c241 100644
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface_debug.lib differ
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list