- Revision
- 234098
- Author
- [email protected]
- Date
- 2018-07-23 09:53:54 -0700 (Mon, 23 Jul 2018)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (234097 => 234098)
--- trunk/LayoutTests/ChangeLog 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/LayoutTests/ChangeLog 2018-07-23 16:53:54 UTC (rev 234098)
@@ -1,3 +1,14 @@
+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-20 John Wilander <[email protected]>
Resource Load Statistics: Enable basic functionality in experimental debug mode
Added: trunk/LayoutTests/fullscreen/fullscreen-env-initial-expected.html (0 => 234098)
--- trunk/LayoutTests/fullscreen/fullscreen-env-initial-expected.html (rev 0)
+++ trunk/LayoutTests/fullscreen/fullscreen-env-initial-expected.html 2018-07-23 16:53:54 UTC (rev 234098)
@@ -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>
Property changes on: trunk/LayoutTests/fullscreen/fullscreen-env-initial-expected.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Added: trunk/LayoutTests/fullscreen/fullscreen-env-initial.html (0 => 234098)
--- trunk/LayoutTests/fullscreen/fullscreen-env-initial.html (rev 0)
+++ trunk/LayoutTests/fullscreen/fullscreen-env-initial.html 2018-07-23 16:53:54 UTC (rev 234098)
@@ -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>
Property changes on: trunk/LayoutTests/fullscreen/fullscreen-env-initial.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (234097 => 234098)
--- trunk/Source/WebCore/ChangeLog 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/Source/WebCore/ChangeLog 2018-07-23 16:53:54 UTC (rev 234098)
@@ -1,3 +1,30 @@
+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-22 Zalan Bujtas <[email protected]>
[LFC][IFC] Add center/right/justify line alignment support.
Modified: trunk/Source/WebCore/dom/ConstantPropertyMap.cpp (234097 => 234098)
--- trunk/Source/WebCore/dom/ConstantPropertyMap.cpp 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/Source/WebCore/dom/ConstantPropertyMap.cpp 2018-07-23 16:53:54 UTC (rev 234098)
@@ -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: trunk/Source/WebCore/dom/ConstantPropertyMap.h (234097 => 234098)
--- trunk/Source/WebCore/dom/ConstantPropertyMap.h 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/Source/WebCore/dom/ConstantPropertyMap.h 2018-07-23 16:53:54 UTC (rev 234098)
@@ -68,7 +68,7 @@
void setValueForProperty(ConstantProperty, Ref<CSSVariableData>&&);
void updateConstantsForSafeAreaInsets();
- void updateConstantsForFullscreenInsets();
+ void updateConstantsForFullscreen();
std::optional<Values> m_values;
Modified: trunk/Source/WebCore/page/Page.cpp (234097 => 234098)
--- trunk/Source/WebCore/page/Page.cpp 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/Source/WebCore/page/Page.cpp 2018-07-23 16:53:54 UTC (rev 234098)
@@ -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: trunk/Source/WebCore/page/Page.h (234097 => 234098)
--- trunk/Source/WebCore/page/Page.h 2018-07-23 16:13:40 UTC (rev 234097)
+++ trunk/Source/WebCore/page/Page.h 2018-07-23 16:53:54 UTC (rev 234098)
@@ -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 };