Diff
Modified: branches/safari-604-branch/LayoutTests/ChangeLog (220170 => 220171)
--- branches/safari-604-branch/LayoutTests/ChangeLog 2017-08-03 01:33:09 UTC (rev 220170)
+++ branches/safari-604-branch/LayoutTests/ChangeLog 2017-08-03 01:33:13 UTC (rev 220171)
@@ -1,5 +1,21 @@
2017-08-02 Jason Marcell <[email protected]>
+ Cherry-pick r220112. rdar://problem/33687415
+
+ 2017-08-01 Zalan Bujtas <[email protected]>
+
+ REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
+ https://bugs.webkit.org/show_bug.cgi?id=175009
+ <rdar://problem/33505791>
+
+ Reviewed by Simon Fraser.
+
+ * fast/frames/flattening/media-query-growing-content-expected.txt: Added.
+ * fast/frames/flattening/media-query-growing-content.html: Added.
+ * fast/frames/flattening/resources/media-query-min-height-with-flattening.html: Added.
+
+2017-08-02 Jason Marcell <[email protected]>
+
Cherry-pick r220035. rdar://problem/33687398
2017-07-28 Matt Rajca <[email protected]>
Added: branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt (0 => 220171)
--- branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content-expected.txt 2017-08-03 01:33:13 UTC (rev 220171)
@@ -0,0 +1,2 @@
+
+
Added: branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html (0 => 220171)
--- branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/frames/flattening/media-query-growing-content.html 2017-08-03 01:33:13 UTC (rev 220171)
@@ -0,0 +1,25 @@
+<!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>
Added: branches/safari-604-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html (0 => 220171)
--- branches/safari-604-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/frames/flattening/resources/media-query-min-height-with-flattening.html 2017-08-03 01:33:13 UTC (rev 220171)
@@ -0,0 +1,34 @@
+<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-604-branch/Source/WebCore/ChangeLog (220170 => 220171)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-08-03 01:33:09 UTC (rev 220170)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-08-03 01:33:13 UTC (rev 220171)
@@ -1,5 +1,34 @@
2017-08-02 Jason Marcell <[email protected]>
+ Cherry-pick r220112. rdar://problem/33687415
+
+ 2017-08-01 Zalan Bujtas <[email protected]>
+
+ REGRESSION (r217197): New Yorker website hangs for a long time on load, lots of blank tiles
+ https://bugs.webkit.org/show_bug.cgi?id=175009
+ <rdar://problem/33505791>
+
+ Reviewed by Simon Fraser.
+
+ This patch ensures that we report the desktop, non-frame-flattened frame size for media queries in subframes.
+ Some websites don't expect the iframes to be expanded to the size of the content and when the media query
+ callback mutates the content (triggering frame resize), they might end up getting into a never ending layout.
+
+ Test: fast/frames/flattening/media-query-growing-content.html
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::orientationEvaluate):
+ (WebCore::aspectRatioEvaluate):
+ (WebCore::heightEvaluate):
+ (WebCore::widthEvaluate):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::layout):
+ (WebCore::FrameView::layoutSizeForMediaQuery const):
+ (WebCore::FrameView::evaluateMediaQueryList):
+ * page/FrameView.h:
+
+2017-08-02 Jason Marcell <[email protected]>
+
Cherry-pick r220085. rdar://problem/33687398
2017-07-31 Matt Rajca <[email protected]>
Modified: branches/safari-604-branch/Source/WebCore/css/MediaQueryEvaluator.cpp (220170 => 220171)
--- branches/safari-604-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2017-08-03 01:33:09 UTC (rev 220170)
+++ branches/safari-604-branch/Source/WebCore/css/MediaQueryEvaluator.cpp 2017-08-03 01:33:13 UTC (rev 220171)
@@ -304,16 +304,14 @@
if (!view)
return false;
- auto width = view->layoutWidth();
- auto height = view->layoutHeight();
-
+ auto viewSize = view->layoutSizeForMediaQuery();
if (!is<CSSPrimitiveValue>(value)) {
// _expression_ (orientation) evaluates to true if width and height >= 0.
- return height >= 0 && width >= 0;
+ return viewSize.height() >= 0 && viewSize.width() >= 0;
}
auto keyword = downcast<CSSPrimitiveValue>(*value).valueID();
- if (width > height) // Square viewport is portrait.
+ if (viewSize.width() > viewSize.height()) // Square viewport is portrait.
return keyword == CSSValueLandscape;
return keyword == CSSValuePortrait;
}
@@ -324,12 +322,11 @@
// assume if we have a device, its aspect ratio is non-zero
if (!value)
return true;
-
FrameView* view = frame.view();
if (!view)
return true;
-
- return compareAspectRatioValue(value, view->layoutWidth(), view->layoutHeight(), op);
+ auto viewSize = view->layoutSizeForMediaQuery();
+ return compareAspectRatioValue(value, viewSize.width(), viewSize.height(), op);
}
static bool deviceAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame& frame, MediaFeaturePrefix op)
@@ -445,7 +442,7 @@
FrameView* view = frame.view();
if (!view)
return false;
- int height = view->layoutHeight();
+ int height = view->layoutSizeForMediaQuery().height();
if (!value)
return height;
if (auto* renderView = frame.document()->renderView())
@@ -459,7 +456,7 @@
FrameView* view = frame.view();
if (!view)
return false;
- int width = view->layoutWidth();
+ int width = view->layoutSizeForMediaQuery().width();
if (!value)
return width;
if (auto* renderView = frame.document()->renderView())
Modified: branches/safari-604-branch/Source/WebCore/page/FrameView.cpp (220170 => 220171)
--- branches/safari-604-branch/Source/WebCore/page/FrameView.cpp 2017-08-03 01:33:09 UTC (rev 220170)
+++ branches/safari-604-branch/Source/WebCore/page/FrameView.cpp 2017-08-03 01:33:13 UTC (rev 220171)
@@ -1316,6 +1316,8 @@
bool inChildFrameLayoutWithFrameFlattening = isInChildFrameWithFrameFlattening();
if (inChildFrameLayoutWithFrameFlattening) {
+ if (!m_frameFlatteningViewSizeForMediaQuery)
+ m_frameFlatteningViewSizeForMediaQuery = ScrollView::layoutSize();
startLayoutAtMainFrameViewIfNeeded(allowSubtree);
RenderElement* root = m_layoutRoot ? m_layoutRoot : frame().document()->renderView();
if (!root || !root->needsLayout())
@@ -1370,13 +1372,10 @@
// FIXME: This instrumentation event is not strictly accurate since cached media query results do not persist across StyleResolver rebuilds.
InspectorInstrumentation::mediaQueryResultChanged(document);
}
-
document.evaluateMediaQueryList();
-
// If there is any pagination to apply, it will affect the RenderView's style, so we should
// take care of that now.
applyPaginationToViewport();
-
// Always ensure our style info is up-to-date. This can happen in situations where
// the layout beats any sort of style recalc update that needs to occur.
document.updateStyleIfNeeded();
@@ -5386,5 +5385,10 @@
{
return renderView() && renderView()->shouldPlaceBlockDirectionScrollbarOnLeft();
}
-
+
+IntSize FrameView::layoutSizeForMediaQuery() const
+{
+ return m_frameFlatteningViewSizeForMediaQuery.value_or(ScrollView::layoutSize());
+}
+
} // namespace WebCore
Modified: branches/safari-604-branch/Source/WebCore/page/FrameView.h (220170 => 220171)
--- branches/safari-604-branch/Source/WebCore/page/FrameView.h 2017-08-03 01:33:09 UTC (rev 220170)
+++ branches/safari-604-branch/Source/WebCore/page/FrameView.h 2017-08-03 01:33:13 UTC (rev 220171)
@@ -216,7 +216,8 @@
bool shouldUpdate() const;
WEBCORE_EXPORT void adjustViewSize();
-
+ IntSize layoutSizeForMediaQuery() const;
+
WEBCORE_EXPORT void setViewportSizeForCSSViewportUnits(IntSize);
IntSize viewportSizeForCSSViewportUnits() const;
@@ -881,6 +882,8 @@
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;