Diff
Deleted: branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt (228514 => 228515)
--- branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt 2018-02-15 17:30:11 UTC (rev 228515)
@@ -1,2 +0,0 @@
-
-
Deleted: branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html (228514 => 228515)
--- branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html 2018-02-15 17:30:11 UTC (rev 228515)
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>This tests that media query can't get into an ever-growing cycle.</title>
-<script>
-if (window.testRunner)
- testRunner.dumpAsText();
-if (window.internals)
- internals.settings.setFrameFlattening("FullyEnabled");
-
-function runTest() {
- if (window.testRunner) {
- testRunner.waitUntilDone();
- setTimeout(function() {
- testRunner.notifyDone();
- }, 50);
- }
-}
-</script>
-</head>
-<body>
-<iframe _onload_="runTest()" src=""
-<div id=testResult></div>
-</body>
-</html>
Deleted: branches/safari-605-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html (228514 => 228515)
--- branches/safari-605-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html 2018-02-15 17:30:11 UTC (rev 228515)
@@ -1,34 +0,0 @@
-<style>
- div {
- width: 200px;
- height: 600px;
- }
-</style>
-<div id=growingDiv></div>
-<script>
-var counter = 0;
-window.matchMedia('(min-height: 200px)').addListener(function(changed) {
- ++counter;
- setTimeout(function() {
- growingDiv.innerText = growingDiv.innerText + ' media query callback ';
- parent.document.getElementById("testResult").innerText = counter;
- }, 0);
-});
-
-window.matchMedia('(min-width: 600px)').addListener(function(changed) {
- ++counter;
- setTimeout(function() {
- growingDiv.innerText = growingDiv.innerText + ' media query callback ';
- parent.document.getElementById("testResult").innerText = counter;
- }, 0);
-});
-
-window.matchMedia('(min-aspect-ratio: 1/1)').addListener(function(changed) {
- ++counter;
- setTimeout(function() {
- growingDiv.innerText = growingDiv.innerText + ' media query callback ';
- parent.document.getElementById("testResult").innerText = counter;
- }, 0);
-});
-
-</script>
\ No newline at end of file
Modified: branches/safari-605-branch/Source/WebCore/css/MediaQueryEvaluator.cpp (228514 => 228515)
--- branches/safari-605-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2018-02-15 17:30:11 UTC (rev 228515)
@@ -334,20 +334,22 @@
if (!view)
return false;
- auto viewSize = view->layoutSizeForMediaQuery();
+ auto width = view->layoutWidth();
+ auto height = view->layoutHeight();
+
if (!is<CSSPrimitiveValue>(value)) {
// _expression_ (orientation) evaluates to true if width and height >= 0.
- return viewSize.height() >= 0 && viewSize.width() >= 0;
+ return height >= 0 && width >= 0;
}
auto keyword = downcast<CSSPrimitiveValue>(*value).valueID();
bool result;
- if (viewSize.width() > viewSize.height()) // Square viewport is portrait.
+ if (width > height) // Square viewport is portrait.
result = keyword == CSSValueLandscape;
else
result = keyword == CSSValuePortrait;
- LOG_WITH_STREAM(MediaQueries, stream << " orientationEvaluate: view size " << viewSize.width() << "x" << viewSize.height() << " is " << value->cssText() << ": " << result);
+ LOG_WITH_STREAM(MediaQueries, stream << " orientationEvaluate: view size " << width << "x" << height << " is " << value->cssText() << ": " << result);
return result;
}
@@ -357,12 +359,13 @@
// assume if we have a device, its aspect ratio is non-zero
if (!value)
return true;
+
FrameView* view = frame.view();
if (!view)
return true;
- auto viewSize = view->layoutSizeForMediaQuery();
- bool result = compareAspectRatioValue(value, viewSize.width(), viewSize.height(), op);
- LOG_WITH_STREAM(MediaQueries, stream << " aspectRatioEvaluate: " << op << " " << aspectRatioValueAsString(value) << " actual view size " << viewSize << ": " << result);
+
+ bool result = compareAspectRatioValue(value, view->layoutWidth(), view->layoutHeight(), op);
+ LOG_WITH_STREAM(MediaQueries, stream << " aspectRatioEvaluate: " << op << " " << aspectRatioValueAsString(value) << " actual view size " << LayoutSize(view->layoutWidth(), view->layoutHeight()) << ": " << result);
return result;
}
@@ -494,7 +497,7 @@
FrameView* view = frame.view();
if (!view)
return false;
- int height = view->layoutSizeForMediaQuery().height();
+ int height = view->layoutHeight();
if (!value)
return height;
if (auto* renderView = frame.document()->renderView())
@@ -514,7 +517,7 @@
FrameView* view = frame.view();
if (!view)
return false;
- int width = view->layoutSizeForMediaQuery().width();
+ int width = view->layoutWidth();
if (!value)
return width;
if (auto* renderView = frame.document()->renderView())
Modified: branches/safari-605-branch/Source/WebCore/page/FrameView.cpp (228514 => 228515)
--- branches/safari-605-branch/Source/WebCore/page/FrameView.cpp 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/Source/WebCore/page/FrameView.cpp 2018-02-15 17:30:11 UTC (rev 228515)
@@ -4982,9 +4982,4 @@
return renderView() && renderView()->shouldPlaceBlockDirectionScrollbarOnLeft();
}
-IntSize FrameView::layoutSizeForMediaQuery() const
-{
- return m_frameFlatteningViewSizeForMediaQuery.value_or(ScrollView::layoutSize());
-}
-
} // namespace WebCore
Modified: branches/safari-605-branch/Source/WebCore/page/FrameView.h (228514 => 228515)
--- branches/safari-605-branch/Source/WebCore/page/FrameView.h 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/Source/WebCore/page/FrameView.h 2018-02-15 17:30:11 UTC (rev 228515)
@@ -208,7 +208,6 @@
bool shouldUpdate() const;
WEBCORE_EXPORT void adjustViewSize();
- IntSize layoutSizeForMediaQuery() const;
WEBCORE_EXPORT void setViewportSizeForCSSViewportUnits(IntSize);
IntSize viewportSizeForCSSViewportUnits() const;
@@ -771,8 +770,6 @@
void removeFromAXObjectCache();
void notifyWidgets(WidgetNotification);
- void setFrameFlatteningViewSizeForMediaQuery() { m_frameFlatteningViewSizeForMediaQuery = layoutSize(); }
- bool frameFlatteningViewSizeForMediaQueryIsSet() const { return m_frameFlatteningViewSizeForMediaQuery.has_value(); }
RenderElement* viewportRenderer() const;
void willDoLayout(WeakPtr<RenderElement> layoutRoot);
@@ -877,8 +874,6 @@
int m_autoSizeFixedMinimumHeight;
// The intrinsic content size decided by autosizing.
IntSize m_autoSizeContentSize;
- // Report the first computed frame view size to media queries.
- std::optional<IntSize> m_frameFlatteningViewSizeForMediaQuery;
std::unique_ptr<ScrollableAreaSet> m_scrollableAreas;
std::unique_ptr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
Modified: branches/safari-605-branch/Source/WebCore/page/LayoutContext.cpp (228514 => 228515)
--- branches/safari-605-branch/Source/WebCore/page/LayoutContext.cpp 2018-02-15 17:19:23 UTC (rev 228514)
+++ branches/safari-605-branch/Source/WebCore/page/LayoutContext.cpp 2018-02-15 17:30:11 UTC (rev 228515)
@@ -504,10 +504,6 @@
if (!view().isInChildFrameWithFrameFlattening())
return false;
- if (!view().frameFlatteningViewSizeForMediaQueryIsSet()) {
- LOG_WITH_STREAM(MediaQueries, stream << "FrameView " << this << " snapshotting size " << view().layoutSize() << " for media queries");
- view().setFrameFlatteningViewSizeForMediaQuery();
- }
startLayoutAtMainFrameViewIfNeeded();
auto* layoutRoot = subtreeLayoutRoot() ? subtreeLayoutRoot() : frame().document()->renderView();
return !layoutRoot || !layoutRoot->needsLayout();