Title: [88468] trunk
Revision
88468
Author
[email protected]
Date
2011-06-09 11:47:27 -0700 (Thu, 09 Jun 2011)

Log Message

2011-06-02  Jer Noble  <[email protected]>

        Reviewed by Maciej Stachowiak.

        REGRESSION: Page layout messed up after exiting full screen after video ends at jerryseinfeld.com
        https://bugs.webkit.org/show_bug.cgi?id=61911
        <rdar://problem/9523017>

        * fullscreen/full-screen-video-offset-expected.txt: Added.
        * fullscreen/full-screen-video-offset.html: Added.
2011-06-02  Jer Noble  <[email protected]>

        Reviewed by Maciej Stachowiak.

        REGRESSION: Page layout messed up after exiting full screen after video ends at jerryseinfeld.com
        https://bugs.webkit.org/show_bug.cgi?id=61911
        <rdar://problem/9523017>

        Test: fullscreen/full-screen-video-offset.html

        When the video element is taken full-screen in the new element full-screen API, return the
        offset width and height of the placeholder renderer which is filling in for the full-screen
        element.  To do so, override offsetWidth, Height, Left, and Top from Element.  These are
        non-virtual functions, so make them virtual.

        * dom/Element.cpp:
        (WebCore::Element::adjustForLocalZoom): Made into a class-static function.
        * dom/Element.h: Made offset functions virtual.
        * html/HTMLMediaElement.cpp:
        (WebCore::elementPlaceholder): Added; utility function.
        (WebCore::HTMLMediaElement::offsetLeft): Added; virtual override of the
            Element function. Will be called directly via _javascript_.
        (WebCore::HTMLMediaElement::offsetTop): Ditto.
        (WebCore::HTMLMediaElement::offsetWidth): Ditto.
        (WebCore::HTMLMediaElement::offsetHeight): Ditto.
        * html/HTMLMediaElement.h:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88467 => 88468)


--- trunk/LayoutTests/ChangeLog	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/LayoutTests/ChangeLog	2011-06-09 18:47:27 UTC (rev 88468)
@@ -1,3 +1,14 @@
+2011-06-02  Jer Noble  <[email protected]>
+
+        Reviewed by Maciej Stachowiak.
+
+        REGRESSION: Page layout messed up after exiting full screen after video ends at jerryseinfeld.com
+        https://bugs.webkit.org/show_bug.cgi?id=61911
+        <rdar://problem/9523017>
+
+        * fullscreen/full-screen-video-offset-expected.txt: Added.
+        * fullscreen/full-screen-video-offset.html: Added.
+
 2011-06-09  Chang Shu  <[email protected]>
 
         Unreviewed.

Added: trunk/LayoutTests/fullscreen/full-screen-video-offset-expected.txt (0 => 88468)


--- trunk/LayoutTests/fullscreen/full-screen-video-offset-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-video-offset-expected.txt	2011-06-09 18:47:27 UTC (rev 88468)
@@ -0,0 +1,9 @@
+This layout test checks that the offset size and position of a video element does not change when the it enters full-screen mode. Press go full-screen to begin.
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLVideoElement]') OK
+EXPECTED (video.offsetLeft == '8') OK
+EXPECTED (video.offsetTop == '48') OK
+EXPECTED (video.offsetWidth == '300') OK
+EXPECTED (video.offsetHeight == '150') OK
+END OF TEST
+

Added: trunk/LayoutTests/fullscreen/full-screen-video-offset.html (0 => 88468)


--- trunk/LayoutTests/fullscreen/full-screen-video-offset.html	                        (rev 0)
+++ trunk/LayoutTests/fullscreen/full-screen-video-offset.html	2011-06-09 18:47:27 UTC (rev 88468)
@@ -0,0 +1,30 @@
+<body _onload_="init()">
+    <div>This layout test checks that the offset size and position of a video element does not change when the it enters full-screen mode.  Press <button _onclick_="video.webkitRequestFullScreen()">go full-screen</a> to begin.</div>
+    <video id="video" controls></video>
+    <script src=""
+    <script>
+        var video = document.getElementById('video');
+        function init() {
+
+            // Bail out early if the full screen API is not enabled or is missing:
+            if (Element.prototype.webkitRequestFullScreen == undefined) {
+                logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
+                endTest();
+            } else {
+                var videoState = {'offsetLeft': video.offsetLeft, 'offsetTop': video.offsetTop, 'offsetWidth': video.offsetWidth, 'offsetHeight': video.offsetHeight };
+
+                var fullscreenChanged = function(event)
+                {
+                    testExpected("document.webkitCurrentFullScreenElement", video);
+                    testExpected("video.offsetLeft", videoState.offsetLeft);
+                    testExpected("video.offsetTop", videoState.offsetTop);
+                    testExpected("video.offsetWidth", videoState.offsetWidth);
+                    testExpected("video.offsetHeight", videoState.offsetHeight);
+                    endTest();
+                };
+                waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);    
+                runWithKeyDown(function(){video.webkitRequestFullScreen()});
+            }
+        }
+    </script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (88467 => 88468)


--- trunk/Source/WebCore/ChangeLog	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/Source/WebCore/ChangeLog	2011-06-09 18:47:27 UTC (rev 88468)
@@ -1,3 +1,30 @@
+2011-06-02  Jer Noble  <[email protected]>
+
+        Reviewed by Maciej Stachowiak.
+
+        REGRESSION: Page layout messed up after exiting full screen after video ends at jerryseinfeld.com
+        https://bugs.webkit.org/show_bug.cgi?id=61911
+        <rdar://problem/9523017>
+
+        Test: fullscreen/full-screen-video-offset.html
+
+        When the video element is taken full-screen in the new element full-screen API, return the
+        offset width and height of the placeholder renderer which is filling in for the full-screen
+        element.  To do so, override offsetWidth, Height, Left, and Top from Element.  These are
+        non-virtual functions, so make them virtual.
+
+        * dom/Element.cpp:
+        (WebCore::Element::adjustForLocalZoom): Made into a class-static function.
+        * dom/Element.h: Made offset functions virtual.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::elementPlaceholder): Added; utility function.
+        (WebCore::HTMLMediaElement::offsetLeft): Added; virtual override of the 
+            Element function. Will be called directly via _javascript_.
+        (WebCore::HTMLMediaElement::offsetTop): Ditto.
+        (WebCore::HTMLMediaElement::offsetWidth): Ditto.
+        (WebCore::HTMLMediaElement::offsetHeight): Ditto.
+        * html/HTMLMediaElement.h:
+
 2011-06-09  Dave Tapuska  <[email protected]>
 
         Reviewed by Daniel Bates.

Modified: trunk/Source/WebCore/dom/Element.cpp (88467 => 88468)


--- trunk/Source/WebCore/dom/Element.cpp	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/Source/WebCore/dom/Element.cpp	2011-06-09 18:47:27 UTC (rev 88468)
@@ -352,7 +352,7 @@
     return zoomFactor;
 }
 
-static int adjustForLocalZoom(int value, RenderObject* renderer)
+int Element::adjustForLocalZoom(int value, RenderObject* renderer)
 {
     float zoomFactor = localZoomForRenderer(renderer);
     if (zoomFactor == 1)

Modified: trunk/Source/WebCore/dom/Element.h (88467 => 88468)


--- trunk/Source/WebCore/dom/Element.h	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/Source/WebCore/dom/Element.h	2011-06-09 18:47:27 UTC (rev 88468)
@@ -151,10 +151,10 @@
     void scrollByLines(int lines);
     void scrollByPages(int pages);
 
-    int offsetLeft();
-    int offsetTop();
-    int offsetWidth();
-    int offsetHeight();
+    virtual int offsetLeft();
+    virtual int offsetTop();
+    virtual int offsetWidth();
+    virtual int offsetHeight();
     Element* offsetParent();
     int clientLeft();
     int clientTop();
@@ -384,6 +384,7 @@
     
     void idAttributeChanged(Attribute*);
 
+    static int adjustForLocalZoom(int value, RenderObject* renderer);
 private:
     void scrollByUnits(int units, ScrollGranularity);
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (88467 => 88468)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-06-09 18:47:27 UTC (rev 88468)
@@ -58,6 +58,7 @@
 #include "MouseEvent.h"
 #include "MIMETypeRegistry.h"
 #include "Page.h"
+#include "RenderFullScreen.h"
 #include "RenderVideo.h"
 #include "RenderView.h"
 #include "ScriptEventListener.h"
@@ -2716,7 +2717,47 @@
     return 0;
 }
 
+static RenderBlock* elementPlaceholder(Element* element)
+{
+    RenderObject* renderer = element->renderer();
+    RenderObject* parent = renderer ? renderer->parent() : 0;
+    RenderFullScreen* fullScreen = parent && parent->isRenderFullScreen() ? toRenderFullScreen(parent) : 0;
 
+    return fullScreen ? fullScreen->placeholder() : 0;
 }
 
+int HTMLMediaElement::offsetLeft()
+{
+    int left = Element::offsetLeft();
+    if (RenderBlock* block = elementPlaceholder(this))
+        left = Element::adjustForLocalZoom(block->offsetLeft(), block);
+    return left;
+}
+
+int HTMLMediaElement::offsetTop()
+{
+    int top = Element::offsetTop();
+    if (RenderBlock* block = elementPlaceholder(this))
+        top = Element::adjustForLocalZoom(block->offsetTop(), block);
+    return top;
+}
+
+int HTMLMediaElement::offsetWidth()
+{
+    int width = Element::offsetWidth();
+    if (RenderBlock* block = elementPlaceholder(this))
+        width = Element::adjustForLocalZoom(block->offsetWidth(), block);
+    return width;
+}
+
+int HTMLMediaElement::offsetHeight()
+{
+    int height = Element::offsetHeight();
+    if (RenderBlock* block = elementPlaceholder(this))
+        height = Element::adjustForLocalZoom(block->offsetHeight(), block);
+    return height;
+}
+
+}
+
 #endif

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (88467 => 88468)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2011-06-09 18:26:15 UTC (rev 88467)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2011-06-09 18:47:27 UTC (rev 88468)
@@ -203,6 +203,12 @@
 
     bool isPlaying() const { return m_playing; }
 
+    // Override Element implementations
+    virtual int offsetLeft();
+    virtual int offsetTop();
+    virtual int offsetWidth();
+    virtual int offsetHeight();
+
 protected:
     HTMLMediaElement(const QualifiedName&, Document*);
     virtual ~HTMLMediaElement();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to