[CherryPick] Fullscreen element should not share styles with its siblings
authorSeonae Kim <sunaeluv.kim@samsung.com>
Tue, 30 Apr 2013 09:36:58 +0000 (18:36 +0900)
committerSeonae Kim <sunaeluv.kim@samsung.com>
Tue, 30 Apr 2013 09:36:58 +0000 (18:36 +0900)
[Title][CherryPick] Fullscreen element should not share styles with its siblings
[Issue] N/A
[Problem] The size of video element is calculated incorrectly sometimes when entering fullscreen.
[Cause] If fullscreen element has sibling, do share the style of sibling element.
[Solution] Cherry picked.
[Cherry-Picker] Seonae Kim

Fullscreen element should not share styles with it's siblings.
https://bugs.webkit.org/show_bug.cgi?id=106888

Reviewed by NOBODY (OOPS!).

Test: fullscreen/full-screen-no-style-sharing.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithElement):

Change-Id: I533bad9411777947546fbf37e0c9bf32f7166593

LayoutTests/fullscreen/full-screen-no-style-sharing-expected.txt [new file with mode: 0644]
LayoutTests/fullscreen/full-screen-no-style-sharing.html [new file with mode: 0644]
Source/WebCore/css/StyleResolver.cpp

diff --git a/LayoutTests/fullscreen/full-screen-no-style-sharing-expected.txt b/LayoutTests/fullscreen/full-screen-no-style-sharing-expected.txt
new file mode 100644 (file)
index 0000000..1539960
--- /dev/null
@@ -0,0 +1,3 @@
+EVENT(webkitfullscreenchange) TEST(video2.clientWidth==document.body.clientWidth) OK
+END OF TEST
+
diff --git a/LayoutTests/fullscreen/full-screen-no-style-sharing.html b/LayoutTests/fullscreen/full-screen-no-style-sharing.html
new file mode 100644 (file)
index 0000000..fbefbbf
--- /dev/null
@@ -0,0 +1,17 @@
+<body>
+    <video id="video1" width="1"></video>
+    <video id="video2" width="1"></video>
+    <script src="full-screen-test.js"></script>
+    <script src=../media/media-file.js></script>
+    <script>
+        var video2 = document.getElementById('video2');
+        // 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 {
+            waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video2.clientWidth==document.body.clientWidth");
+            runWithKeyDown(function(){video2.webkitRequestFullScreen()});
+        }
+    </script>
+</body>
index 868886c..a62c158 100644 (file)
@@ -1523,6 +1523,10 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const
     if (element->isLink() && m_elementLinkState != style->insideLink())
         return false;
 
+#if ENABLE(FULLSCREEN_API)
+    if (element == element->document()->webkitCurrentFullScreenElement() || m_element == m_element->document()->webkitCurrentFullScreenElement())
+        return false;
+#endif
     return true;
 }