RenderTheme::volumeSliderOffsetFromMuteButton should take const& RenderBox.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 21:44:56 +0000 (21:44 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 21:44:56 +0000 (21:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147731

Reviewed by Simon Fraser.

No change in functionality.

* rendering/RenderMediaControlElements.cpp:
(WebCore::RenderMediaVolumeSliderContainer::layout):
* rendering/RenderMediaControls.cpp:
(WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): Deleted.
* rendering/RenderMediaControls.h:
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::volumeSliderOffsetFromMuteButton):
* rendering/RenderTheme.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188166 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderMediaControlElements.cpp
Source/WebCore/rendering/RenderMediaControls.cpp
Source/WebCore/rendering/RenderMediaControls.h
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h

index 3c98f67..5cbc6bf 100644 (file)
@@ -1,5 +1,23 @@
 2015-08-07  Zalan Bujtas  <zalan@apple.com>
 
+        RenderTheme::volumeSliderOffsetFromMuteButton should take const& RenderBox.
+        https://bugs.webkit.org/show_bug.cgi?id=147731
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * rendering/RenderMediaControlElements.cpp:
+        (WebCore::RenderMediaVolumeSliderContainer::layout):
+        * rendering/RenderMediaControls.cpp:
+        (WebCore::RenderMediaControls::volumeSliderOffsetFromMuteButton): Deleted.
+        * rendering/RenderMediaControls.h:
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::volumeSliderOffsetFromMuteButton):
+        * rendering/RenderTheme.h:
+
+2015-08-07  Zalan Bujtas  <zalan@apple.com>
+
         Replace RenderObject::isRooted() logic with isDescendantOf().
         https://bugs.webkit.org/show_bug.cgi?id=147788
 
index b2e1b1c..c823a54 100644 (file)
@@ -54,7 +54,7 @@ void RenderMediaVolumeSliderContainer::layout()
 
     // If the slider would be rendered outside the page, it should be moved below the controls.
     if (UNLIKELY(absoluteOffsetTop < 0))
-        setY(buttonBox.offsetTop() + theme().volumeSliderOffsetFromMuteButton(&buttonBox, pixelSnappedSize()).y());
+        setY(buttonBox.offsetTop() + theme().volumeSliderOffsetFromMuteButton(buttonBox, pixelSnappedSize()).y());
 }
 
 // ----------------------------
index 499e42d..2171388 100644 (file)
@@ -220,19 +220,6 @@ bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, c
 
 #endif
 
-IntPoint RenderMediaControls::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size)
-{
-    static const int xOffset = -4;
-    static const int yOffset = 5;
-
-    float zoomLevel = muteButtonBox->style().effectiveZoom();
-    int y = yOffset * zoomLevel + muteButtonBox->pixelSnappedOffsetHeight() - size.height();
-    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), IsFixed | UseTransforms);
-    if (absPoint.y() < 0)
-        y = muteButtonBox->pixelSnappedSize().height();
-    return IntPoint(xOffset * zoomLevel, y);
-}
-
 }
 
 #endif
index 9809c01..a2b7c99 100644 (file)
@@ -48,7 +48,6 @@ public:
     static bool paintMediaControlsPart(MediaControlElementType, const RenderObject&, const PaintInfo&, const IntRect&);
     static void adjustMediaSliderThumbSize(RenderStyle&);
 #endif
-    static IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&);
 };
 
 } // namespace WebCore
index 4651025..4e5a741 100644 (file)
@@ -552,12 +552,12 @@ String RenderTheme::formatMediaControlsRemainingTime(float currentTime, float du
     return formatMediaControlsTime(currentTime - duration);
 }
 
-IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const
+IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(const RenderBox& muteButtonBox, const IntSize& size) const
 {
     int y = -size.height();
-    FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), IsFixed | UseTransforms);
+    FloatPoint absPoint = muteButtonBox.localToAbsolute(FloatPoint(muteButtonBox.pixelSnappedOffsetLeft(), y), IsFixed | UseTransforms);
     if (absPoint.y() < 0)
-        y = muteButtonBox->height();
+        y = muteButtonBox.height();
     return IntPoint(0, y);
 }
 
index bb1b5b5..83871dd 100644 (file)
@@ -209,7 +209,7 @@ public:
     virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const;
     
     // Returns the media volume slider container's offset from the mute button.
-    virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const;
+    virtual IntPoint volumeSliderOffsetFromMuteButton(const RenderBox&, const IntSize&) const;
 #endif
 
 #if ENABLE(METER_ELEMENT)