Title: [88285] branches/safari-534-branch

Diff

Modified: branches/safari-534-branch/LayoutTests/ChangeLog (88284 => 88285)


--- branches/safari-534-branch/LayoutTests/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/LayoutTests/ChangeLog	2011-06-07 23:56:06 UTC (rev 88285)
@@ -1,5 +1,20 @@
 2011-06-07  Lucas Forschler  <[email protected]>
 
+    Merged 88034.
+
+    2011-06-01  Jer Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        Flash of broken page when exiting full screen at jerryseinfeld.com
+        https://bugs.webkit.org/show_bug.cgi?id=61897
+        <rdar://problem/9522985>
+
+        * fullscreen/full-screen-placeholder-expected.txt: Added.
+        * fullscreen/full-screen-placeholder.html: Added.
+
+2011-06-07  Lucas Forschler  <[email protected]>
+
     Merged 87959.
 
     2011-06-02  Brady Eidson  <[email protected]>

Copied: branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder-expected.txt (from rev 88034, trunk/LayoutTests/fullscreen/full-screen-placeholder-expected.txt) (0 => 88285)


--- branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder-expected.txt	                        (rev 0)
+++ branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder-expected.txt	2011-06-07 23:56:06 UTC (rev 88285)
@@ -0,0 +1,17 @@
+This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode. Press go full-screen to begin.
+One
+Two
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == '[object HTMLDivElement]') OK
+EXPECTED (one.offsetLeft == '68') OK
+EXPECTED (one.offsetTop == '48') OK
+EXPECTED (two.offsetLeft == '8') OK
+EXPECTED (two.offsetTop == '108') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitCurrentFullScreenElement == 'null') OK
+EXPECTED (one.offsetLeft == '68') OK
+EXPECTED (one.offsetTop == '48') OK
+EXPECTED (two.offsetLeft == '8') OK
+EXPECTED (two.offsetTop == '108') OK
+END OF TEST
+

Copied: branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder.html (from rev 88034, trunk/LayoutTests/fullscreen/full-screen-placeholder.html) (0 => 88285)


--- branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder.html	                        (rev 0)
+++ branches/safari-534-branch/LayoutTests/fullscreen/full-screen-placeholder.html	2011-06-07 23:56:06 UTC (rev 88285)
@@ -0,0 +1,73 @@
+<script src=""
+<style>
+#float { 
+    margin: 10px 0 0 10px;
+    height: 50px;
+    width: 50px;
+    float: left;
+    background-color: red;
+}
+#clear {
+    clear:left;
+}
+#one { 
+    background-color: lightblue; 
+    float: left;
+}
+#two { 
+    background-color: lightgreen;
+}
+</style>
+<body>
+<div>This layout test checks that the offset positions of the blue and green divs does not change when the red div enters full-screen mode.  Press <button _onclick_="document.getElementById('float').webkitRequestFullScreen()">go full-screen</a> to begin.</div>
+<div id="float"></div>
+<div id="one">One</div>
+<div id="clear" />
+<span id="two">Two</span>
+<script>
+    var _one_ = document.getElementById('one');
+    var two = document.getElementById('two');
+
+    // 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 _oneState_ = {'offsetLeft': one.offsetLeft, 'offsetTop': one.offsetTop };
+        var twoState = {'offsetLeft': two.offsetLeft, 'offsetTop': two.offsetTop };
+
+
+        var callback;
+        var fullscreenChanged = function(event)
+        {
+            if (callback)
+                callback(event)
+        };
+        waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
+    
+        var div = document.getElementById('float');
+
+        var divEnteredFullScreen = function() {
+            testExpected("document.webkitCurrentFullScreenElement", div);
+            testExpected("one.offsetLeft", oneState.offsetLeft);
+            testExpected("one.offsetTop", oneState.offsetTop);
+            testExpected("two.offsetLeft", twoState.offsetLeft);
+            testExpected("two.offsetTop", twoState.offsetTop);
+            callback = cancelledFullScreen;
+            runWithKeyDown(function(){document.webkitCancelFullScreen()});
+        };
+    
+        var cancelledFullScreen = function() {
+            testExpected("document.webkitCurrentFullScreenElement", null);
+            testExpected("one.offsetLeft", oneState.offsetLeft);
+            testExpected("one.offsetTop", oneState.offsetTop);
+            testExpected("two.offsetLeft", twoState.offsetLeft);
+            testExpected("two.offsetTop", twoState.offsetTop);
+            callback = null;
+            endTest();
+        };
+
+        callback = divEnteredFullScreen;
+        runWithKeyDown(function(){div.webkitRequestFullScreen()});
+    }
+</script>

Modified: branches/safari-534-branch/Source/WebCore/ChangeLog (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/ChangeLog	2011-06-07 23:56:06 UTC (rev 88285)
@@ -1,5 +1,41 @@
 2011-06-07  Lucas Forschler  <[email protected]>
 
+    Merged 88034.
+    Note: The original change applied to trunk was refactored from Node.cpp into NodeRenderingContext.cpp.
+    The branch was taken before refactoring, thus this patch was manually applied to Node.cpp.
+
+    2011-06-01  Jer Noble  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        Flash of broken page when exiting full screen at jerryseinfeld.com
+        https://bugs.webkit.org/show_bug.cgi?id=61897
+        <rdar://problem/9522985>
+
+        Test: fullscreen/full-screen-placeholder.html
+
+        Entering full-screen mode is causing the page layout to change because the full-screen
+        element is taken out of the normal flow.  To counteract this effect, insert a placeholder
+        block as a parent of the full-screen renderer with the same size and style as the full-screen
+        element pre-full-screen.
+
+        Only create a placeholder for block-level elements; the technique required for inline elements
+        would be vastly more complicated.
+
+        * dom/Document.cpp:
+        (WebCore::Document::webkitWillEnterFullScreenForElement): Create a placeholder
+            based on the size and style of the full-screen element.
+        (WebCore::Document::setFullScreenRenderer): Persist the placeholder size and 
+            style across new renderers.
+        * rendering/RenderFullScreen.cpp:
+        (RenderFullScreen::RenderFullScreen): Added ivar.
+        (RenderFullScreen::destroy): Make sure to safely destroy our placeholder.
+        (RenderFullScreen::createPlaceholder): Added.
+        * rendering/RenderFullScreen.h:
+        (WebCore::RenderFullScreen::placeholder): Ivar accessor.
+
+2011-06-07  Lucas Forschler  <[email protected]>
+
     Merged 87959. 
 
     2011-06-02  Brady Eidson  <[email protected]>

Modified: branches/safari-534-branch/Source/WebCore/dom/Document.cpp (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/dom/Document.cpp	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/dom/Document.cpp	2011-06-07 23:56:06 UTC (rev 88285)
@@ -4879,7 +4879,18 @@
     ASSERT(page() && page()->settings()->fullScreenEnabled());
 
     m_fullScreenElement = element;
-    
+
+    // Create a placeholder block for a the full-screen element, to keep the page from reflowing
+    // when the element is removed from the normal flow.  Only do this for a RenderBox, as only 
+    // a box will have a frameRect.  The placeholder will be created in setFullScreenRenderer()
+    // during layout.
+    RenderObject* renderer = m_fullScreenElement->renderer();
+    bool shouldCreatePlaceholder = m_fullScreenElement->renderer()->isBox();
+    if (shouldCreatePlaceholder) {
+        m_savedPlaceholderFrameRect = toRenderBox(renderer)->frameRect();
+        m_savedPlaceholderRenderStyle = RenderStyle::clone(renderer->style());
+    }
+
     if (m_fullScreenElement != documentElement())
         m_fullScreenElement->detach();
 
@@ -4956,6 +4967,13 @@
     if (renderer == m_fullScreenRenderer)
         return;
 
+    if (renderer && m_savedPlaceholderRenderStyle) 
+        renderer->createPlaceholder(m_savedPlaceholderRenderStyle.release(), m_savedPlaceholderFrameRect);
+    else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placeholder()) {
+        RenderBlock* placeholder = m_fullScreenRenderer->placeholder();
+        renderer->createPlaceholder(RenderStyle::clone(placeholder->style()), placeholder->frameRect());
+    }
+
     if (m_fullScreenRenderer)
         m_fullScreenRenderer->destroy();
     ASSERT(!m_fullScreenRenderer);

Modified: branches/safari-534-branch/Source/WebCore/dom/Document.h (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/dom/Document.h	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/dom/Document.h	2011-06-07 23:56:06 UTC (rev 88285)
@@ -34,6 +34,7 @@
 #include "DOMTimeStamp.h"
 #include "DocumentTiming.h"
 #include "IconURL.h"
+#include "IntRect.h"
 #include "PageVisibilityState.h"
 #include "QualifiedName.h"
 #include "ScriptExecutionContext.h"
@@ -1397,6 +1398,8 @@
     Timer<Document> m_fullScreenChangeDelayTimer;
     Deque<RefPtr<Element> > m_fullScreenChangeEventTargetQueue;
     bool m_isAnimatingFullScreen;
+    IntRect m_savedPlaceholderFrameRect;
+    RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
 #endif
 
     int m_loadEventDelayCount;

Modified: branches/safari-534-branch/Source/WebCore/dom/Node.cpp (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/dom/Node.cpp	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/dom/Node.cpp	2011-06-07 23:56:06 UTC (rev 88285)
@@ -1594,7 +1594,7 @@
 }
 
 #if ENABLE(FULLSCREEN_API)
-static RenderFullScreen* wrapWithRenderFullScreen(RenderObject* object, Document* document)
+static RenderObject* wrapWithRenderFullScreen(RenderObject* object, Document* document)
 {
     RenderFullScreen* fullscreenRenderer = new (document->renderArena()) RenderFullScreen(document);
     fullscreenRenderer->setStyle(RenderFullScreen::createFullScreenStyle());
@@ -1603,6 +1603,8 @@
     if (object)
         fullscreenRenderer->addChild(object);
     document->setFullScreenRenderer(fullscreenRenderer);
+    if (fullscreenRenderer->placeholder())
+        return fullscreenRenderer->placeholder();
     return fullscreenRenderer;
 }
 #endif

Modified: branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.cpp (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.cpp	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.cpp	2011-06-07 23:56:06 UTC (rev 88285)
@@ -36,8 +36,22 @@
 
 using namespace WebCore;
 
+RenderFullScreen::RenderFullScreen(Node* node) 
+    : RenderFlexibleBox(node) 
+    , m_placeholder(0)
+{ 
+    setReplaced(false); 
+}
+
 void RenderFullScreen::destroy()
 {
+    if (m_placeholder) {
+        remove();
+        if (!m_placeholder->beingDestroyed())
+            m_placeholder->destroy();
+        m_placeholder = 0;
+    }
+
     // RenderObjects are unretained, so notify the document (which holds a pointer to a RenderFullScreen)
     // if it's RenderFullScreen is destroyed.
     if (document() && document()->fullScreenRenderer() == this)
@@ -72,4 +86,24 @@
     return fullscreenStyle.release();
 }
 
+void RenderFullScreen::createPlaceholder(PassRefPtr<RenderStyle> style, const IntRect& frameRect)
+{
+    if (style->width().isAuto())
+        style->setWidth(Length(frameRect.width(), Fixed));
+    if (style->height().isAuto())
+        style->setHeight(Length(frameRect.height(), Fixed));
+
+    if (!m_placeholder) {
+        m_placeholder = new (document()->renderArena()) RenderBlock(document());
+        m_placeholder->setStyle(style);
+        m_placeholder->setIsAnonymous(false);
+        if (parent()) {
+            parent()->addChild(m_placeholder, this);
+            remove();
+        }
+        m_placeholder->addChild(this);
+    } else
+        m_placeholder->setStyle(style);
+}
+
 #endif

Modified: branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.h (88284 => 88285)


--- branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.h	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebCore/rendering/RenderFullScreen.h	2011-06-07 23:56:06 UTC (rev 88285)
@@ -33,15 +33,18 @@
 
 class RenderFullScreen : public RenderFlexibleBox {
 public:
-    RenderFullScreen(Node* node) : RenderFlexibleBox(node) { setReplaced(false); }
+    RenderFullScreen(Node*);
     virtual void destroy();
     virtual bool isRenderFullScreen() const { return true; }
     virtual const char* renderName() const { return "RenderFullScreen"; }
-    
+
+    RenderBlock* placeholder() { return m_placeholder; }
+    void createPlaceholder(PassRefPtr<RenderStyle>, const IntRect& frameRect);
+
     static PassRefPtr<RenderStyle> createFullScreenStyle();
     
 protected:
-    bool m_isAnimating;
+    RenderBlock* m_placeholder;
 };
     
 inline RenderFullScreen* toRenderFullScreen(RenderObject* object)

Modified: branches/safari-534-branch/Source/WebKit/mac/ChangeLog (88284 => 88285)


--- branches/safari-534-branch/Source/WebKit/mac/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebKit/mac/ChangeLog	2011-06-07 23:56:06 UTC (rev 88285)
@@ -1,3 +1,24 @@
+2011-06-07  Lucas Forschler  <[email protected]>
+
+    Merged 87962.
+
+    2011-06-02  Anders Carlsson  <[email protected]>
+
+        Reviewed by Sam Weinig.
+
+        Need a way to install the memory pressure handler without initializing WebKit1
+        https://bugs.webkit.org/show_bug.cgi?id=61975
+
+        Add a WebInstallMemoryPressureHandler function which will install the memory pressure handler.
+        -[WebView WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:] will do this,
+        but we'd like to be able to install a memory pressure handler without creating a WebView or even
+        calling any WebView method since that will call +[WebView initialize].
+
+        * WebKit.exp:
+        * WebView/WebView.mm:
+        (WebInstallMemoryPressureHandler):
+        * WebView/WebViewPrivate.h:
+
 2011-05-27  Mark Rowe  <[email protected]>
 
         Merge r87520.

Modified: branches/safari-534-branch/Source/WebKit/mac/WebKit.exp (88284 => 88285)


--- branches/safari-534-branch/Source/WebKit/mac/WebKit.exp	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebKit/mac/WebKit.exp	2011-06-07 23:56:06 UTC (rev 88285)
@@ -96,6 +96,7 @@
 _WebIconNotificationUserInfoURLKey
 _WebIconSmallSize
 _WebInitForCarbon
+_WebInstallMemoryPressureHandler
 _WebKitErrorDomain
 _WebKitErrorMIMETypeKey
 _WebKitErrorPlugInNameKey

Modified: branches/safari-534-branch/Source/WebKit/mac/WebView/WebView.mm (88284 => 88285)


--- branches/safari-534-branch/Source/WebKit/mac/WebView/WebView.mm	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebKit/mac/WebView/WebView.mm	2011-06-07 23:56:06 UTC (rev 88285)
@@ -6392,6 +6392,11 @@
 
 @end
 
+void WebInstallMemoryPressureHandler(void)
+{
+    memoryPressureHandler().install();
+}
+
 #ifdef BUILDING_ON_LEOPARD
 
 static IMP originalRecursivelyRemoveMailAttributesImp;

Modified: branches/safari-534-branch/Source/WebKit/mac/WebView/WebViewPrivate.h (88284 => 88285)


--- branches/safari-534-branch/Source/WebKit/mac/WebView/WebViewPrivate.h	2011-06-07 23:38:54 UTC (rev 88284)
+++ branches/safari-534-branch/Source/WebKit/mac/WebView/WebViewPrivate.h	2011-06-07 23:56:06 UTC (rev 88285)
@@ -726,5 +726,16 @@
 - (NSCachedURLResponse *)webView:(WebView *)sender resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
 @end
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// This is a C function to avoid calling +[WebView initialize].
+void WebInstallMemoryPressureHandler(void);
+
+#ifdef __cplusplus
+}
+#endif
+
 #undef WebNSInteger
 #undef WebNSUInteger
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to