Title: [234235] branches/safari-606-branch
Revision
234235
Author
[email protected]
Date
2018-07-26 00:14:37 -0700 (Thu, 26 Jul 2018)

Log Message

Cherry-pick r234098. rdar://problem/42507862

    fullscreen env() variables should have initial values
    https://bugs.webkit.org/show_bug.cgi?id=187897
    <rdar://problem/42485682>

    Reviewed by Sam Weinig.

    Source/WebCore:

    The env() values for fullscreen properties need to be
    initialized, rather than wait for values to be set from WebKit.
    Without this, feature detection doesn't work, and properties
    won't parse correctly.

    Test: fullscreen/fullscreen-env-initial.html

    * dom/ConstantPropertyMap.cpp:
    (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
    (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
    also updates the duration value.
    (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
    (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
    * dom/ConstantPropertyMap.h:
    * page/Page.cpp:
    (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
    * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
    (WebCore::Page::fullscreenAutoHideDuration const):

    LayoutTests:

    * fullscreen/fullscreen-env-initial-expected.html: Added.
    * fullscreen/fullscreen-env-initial.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-606-branch/LayoutTests/ChangeLog (234234 => 234235)


--- branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-26 07:14:37 UTC (rev 234235)
@@ -1,5 +1,54 @@
 2018-07-25  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234098. rdar://problem/42507862
+
+    fullscreen env() variables should have initial values
+    https://bugs.webkit.org/show_bug.cgi?id=187897
+    <rdar://problem/42485682>
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    The env() values for fullscreen properties need to be
+    initialized, rather than wait for values to be set from WebKit.
+    Without this, feature detection doesn't work, and properties
+    won't parse correctly.
+    
+    Test: fullscreen/fullscreen-env-initial.html
+    
+    * dom/ConstantPropertyMap.cpp:
+    (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
+    (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
+    also updates the duration value.
+    (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
+    (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
+    * dom/ConstantPropertyMap.h:
+    * page/Page.cpp:
+    (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
+    * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
+    (WebCore::Page::fullscreenAutoHideDuration const):
+    
+    LayoutTests:
+    
+    * fullscreen/fullscreen-env-initial-expected.html: Added.
+    * fullscreen/fullscreen-env-initial.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-22  Dean Jackson  <[email protected]>
+
+            fullscreen env() variables should have initial values
+            https://bugs.webkit.org/show_bug.cgi?id=187897
+            <rdar://problem/42485682>
+
+            Reviewed by Sam Weinig.
+
+            * fullscreen/fullscreen-env-initial-expected.html: Added.
+            * fullscreen/fullscreen-env-initial.html: Added.
+
+2018-07-25  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234064. rdar://problem/42451634
 
     Picking a color from the color panel for typing attributes needs to inverse transform through color-filter

Added: branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial-expected.html (0 => 234235)


--- branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial-expected.html	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial-expected.html	2018-07-26 07:14:37 UTC (rev 234235)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>fullscreen-env-initial</title>
+  <style>
+      #should-be-green {
+          background-color: green;
+      }
+  </style>
+</head>
+<body>
+<p id="should-be-green">This paragraph should have a green background.</p>
+<p id="results">fullscreen-inset-top fullscreen-inset-right fullscreen-inset-bottom fullscreen-inset-left fullscreen-auto-hide-duration all had initial values.</p>
+</body>
+</html>

Added: branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial.html (0 => 234235)


--- branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial.html	                        (rev 0)
+++ branches/safari-606-branch/LayoutTests/fullscreen/fullscreen-env-initial.html	2018-07-26 07:14:37 UTC (rev 234235)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>fullscreen-env-initial</title>
+  <style>
+      #dummy {
+          position: absolute;
+          top: 0;
+          left: 0;
+          width: 0;
+          height: 0;
+          --fullscreen-inset-top: env(fullscreen-inset-top);
+          --fullscreen-inset-right: env(fullscreen-inset-right);
+          --fullscreen-inset-bottom: env(fullscreen-inset-bottom);
+          --fullscreen-inset-left: env(fullscreen-inset-left);
+          --fullscreen-auto-hide-duration: env(fullscreen-auto-hide-duration);
+      }
+      @supports (padding: env(fullscreen-inset-top)) {
+          #should-be-green {
+              background-color: green;
+          }
+      }
+  </style>
+  <script>
+      const ENVS = ["fullscreen-inset-top", "fullscreen-inset-right", "fullscreen-inset-bottom", "fullscreen-inset-left", "fullscreen-auto-hide-duration"];
+      function runTest() {
+          const results = document.getElementById("results");
+          const dummyStyle = window.getComputedStyle(document.getElementById("dummy"));
+          const checkForValue = (accumulator, value) => {
+              if (!accumulator)
+                  return false;
+              return dummyStyle.getPropertyValue(`--${value}`) != "";
+          };
+          if (ENVS.reduce(checkForValue))
+              results.textContent = `${ENVS.join(" ")} all had initial values.`;
+          else
+              results.textContent = `Some/all of ${ENVS.join(" ")} had missing initial values.`;
+      }
+
+
+window.addEventListener("load", runTest, false);
+  </script>
+</head>
+<body>
+<span id="dummy"></span>
+<p id="should-be-green">This paragraph should have a green background.</p>
+<p id="results"></p>
+</body>
+</html>

Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (234234 => 234235)


--- branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-26 07:14:37 UTC (rev 234235)
@@ -1,5 +1,70 @@
 2018-07-25  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234098. rdar://problem/42507862
+
+    fullscreen env() variables should have initial values
+    https://bugs.webkit.org/show_bug.cgi?id=187897
+    <rdar://problem/42485682>
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    The env() values for fullscreen properties need to be
+    initialized, rather than wait for values to be set from WebKit.
+    Without this, feature detection doesn't work, and properties
+    won't parse correctly.
+    
+    Test: fullscreen/fullscreen-env-initial.html
+    
+    * dom/ConstantPropertyMap.cpp:
+    (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
+    (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
+    also updates the duration value.
+    (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
+    (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
+    * dom/ConstantPropertyMap.h:
+    * page/Page.cpp:
+    (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
+    * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
+    (WebCore::Page::fullscreenAutoHideDuration const):
+    
+    LayoutTests:
+    
+    * fullscreen/fullscreen-env-initial-expected.html: Added.
+    * fullscreen/fullscreen-env-initial.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234098 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-22  Dean Jackson  <[email protected]>
+
+            fullscreen env() variables should have initial values
+            https://bugs.webkit.org/show_bug.cgi?id=187897
+            <rdar://problem/42485682>
+
+            Reviewed by Sam Weinig.
+
+            The env() values for fullscreen properties need to be
+            initialized, rather than wait for values to be set from WebKit.
+            Without this, feature detection doesn't work, and properties
+            won't parse correctly.
+
+            Test: fullscreen/fullscreen-env-initial.html
+
+            * dom/ConstantPropertyMap.cpp:
+            (WebCore::ConstantPropertyMap::buildValues): Initialize the fullscreen values.
+            (WebCore::ConstantPropertyMap::updateConstantsForFullscreen): Renamed function, because it
+            also updates the duration value.
+            (WebCore::ConstantPropertyMap::didChangeFullscreenInsets): Call new name.
+            (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets): Deleted.
+            * dom/ConstantPropertyMap.h:
+            * page/Page.cpp:
+            (WebCore::Page::setFullscreenAutoHideDuration): Don't change the value if it doesn't need it.
+            * page/Page.h: Add accessor for fullscreenAutoHideDuration. Also add a member variable.
+            (WebCore::Page::fullscreenAutoHideDuration const):
+
+2018-07-25  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234064. rdar://problem/42451634
 
     Picking a color from the color panel for typing attributes needs to inverse transform through color-filter

Modified: branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.cpp (234234 => 234235)


--- branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.cpp	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.cpp	2018-07-26 07:14:37 UTC (rev 234235)
@@ -98,6 +98,7 @@
     m_values = Values { };
 
     updateConstantsForSafeAreaInsets();
+    updateConstantsForFullscreen();
 }
 
 static Ref<CSSVariableData> variableDataForPositivePixelLength(float lengthInPx)
@@ -139,7 +140,7 @@
     m_document.invalidateMatchedPropertiesCacheAndForceStyleRecalc();
 }
 
-void ConstantPropertyMap::updateConstantsForFullscreenInsets()
+void ConstantPropertyMap::updateConstantsForFullscreen()
 {
     FloatBoxExtent fullscreenInsets = m_document.page() ? m_document.page()->fullscreenInsets() : FloatBoxExtent();
     setValueForProperty(ConstantProperty::FullscreenInsetTop, variableDataForPositivePixelLength(fullscreenInsets.top()));
@@ -146,11 +147,14 @@
     setValueForProperty(ConstantProperty::FullscreenInsetRight, variableDataForPositivePixelLength(fullscreenInsets.right()));
     setValueForProperty(ConstantProperty::FullscreenInsetBottom, variableDataForPositivePixelLength(fullscreenInsets.bottom()));
     setValueForProperty(ConstantProperty::FullscreenInsetLeft, variableDataForPositivePixelLength(fullscreenInsets.left()));
+
+    Seconds fullscreenAutoHideDuration = m_document.page() ? m_document.page()->fullscreenAutoHideDuration() : 0_s;
+    setValueForProperty(ConstantProperty::FullscreenAutoHideDuration, variableDataForPositiveDuration(fullscreenAutoHideDuration));
 }
 
 void ConstantPropertyMap::didChangeFullscreenInsets()
 {
-    updateConstantsForFullscreenInsets();
+    updateConstantsForFullscreen();
     m_document.invalidateMatchedPropertiesCacheAndForceStyleRecalc();
 }
 

Modified: branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.h (234234 => 234235)


--- branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.h	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/Source/WebCore/dom/ConstantPropertyMap.h	2018-07-26 07:14:37 UTC (rev 234235)
@@ -68,7 +68,7 @@
     void setValueForProperty(ConstantProperty, Ref<CSSVariableData>&&);
 
     void updateConstantsForSafeAreaInsets();
-    void updateConstantsForFullscreenInsets();
+    void updateConstantsForFullscreen();
 
     std::optional<Values> m_values;
 

Modified: branches/safari-606-branch/Source/WebCore/page/Page.cpp (234234 => 234235)


--- branches/safari-606-branch/Source/WebCore/page/Page.cpp	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/Source/WebCore/page/Page.cpp	2018-07-26 07:14:37 UTC (rev 234235)
@@ -2454,6 +2454,9 @@
 
 void Page::setFullscreenAutoHideDuration(Seconds duration)
 {
+    if (duration == m_fullscreenAutoHideDuration)
+        return;
+    m_fullscreenAutoHideDuration = duration;
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (!frame->document())
             continue;

Modified: branches/safari-606-branch/Source/WebCore/page/Page.h (234234 => 234235)


--- branches/safari-606-branch/Source/WebCore/page/Page.h	2018-07-26 07:14:33 UTC (rev 234234)
+++ branches/safari-606-branch/Source/WebCore/page/Page.h	2018-07-26 07:14:37 UTC (rev 234235)
@@ -352,9 +352,10 @@
     void setTextAutosizingWidth(float textAutosizingWidth) { m_textAutosizingWidth = textAutosizingWidth; }
 #endif
 
+    const FloatBoxExtent& fullscreenInsets() const { return m_fullscreenInsets; }
     WEBCORE_EXPORT void setFullscreenInsets(const FloatBoxExtent&);
-    const FloatBoxExtent& fullscreenInsets() const { return m_fullscreenInsets; }
 
+    const Seconds fullscreenAutoHideDuration() const { return m_fullscreenAutoHideDuration; }
     WEBCORE_EXPORT void setFullscreenAutoHideDuration(Seconds);
     WEBCORE_EXPORT void setFullscreenControlsHidden(bool);
 
@@ -754,6 +755,7 @@
     FloatBoxExtent m_obscuredInsets;
     FloatBoxExtent m_unobscuredSafeAreaInsets;
     FloatBoxExtent m_fullscreenInsets;
+    Seconds m_fullscreenAutoHideDuration { 0_s };
 
 #if PLATFORM(IOS)
     bool m_enclosedInScrollableAncestorView { false };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to