Title: [264960] trunk
- Revision
- 264960
- Author
- za...@apple.com
- Date
- 2020-07-27 17:30:17 -0700 (Mon, 27 Jul 2020)
Log Message
Extension is sized incorrectly, content is cut off.
https://bugs.webkit.org/show_bug.cgi?id=214858
<rdar://problem/64135680>
Reviewed by Simon Fraser.
Source/WebCore:
Autosizing uses an 1px tall viewport to layout the content initially. When the document renderer's height is set to a percent value, this
1px tall viewport will drive the available height for the descendants and we pretty much end up with overflow content.
Autosizing takes the overflow into account when computing the final content size, however this overflow depends on the type of the layout context (e.g. flex vs. block).
Let's replace percent height values on the document renderer with the initial "height: auto".
Test: fast/dynamic/size-to-content-autosize-with-percent-document-height.html
* page/FrameView.cpp:
(WebCore::FrameView::performSizeToContentAutoSize):
LayoutTests:
* fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html: Added.
* fast/dynamic/size-to-content-autosize-with-percent-document-height.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (264959 => 264960)
--- trunk/LayoutTests/ChangeLog 2020-07-28 00:05:42 UTC (rev 264959)
+++ trunk/LayoutTests/ChangeLog 2020-07-28 00:30:17 UTC (rev 264960)
@@ -1,3 +1,14 @@
+2020-07-27 Zalan Bujtas <za...@apple.com>
+
+ Extension is sized incorrectly, content is cut off.
+ https://bugs.webkit.org/show_bug.cgi?id=214858
+ <rdar://problem/64135680>
+
+ Reviewed by Simon Fraser.
+
+ * fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html: Added.
+ * fast/dynamic/size-to-content-autosize-with-percent-document-height.html: Added.
+
2020-07-27 Ryan Haddad <ryanhad...@apple.com>
[ MacOS Debug ] Layout Test webgl/2.0.0/conformance2/textures/misc/tex-unpack-params.html is flaky timeout
Added: trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html (0 => 264960)
--- trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html 2020-07-28 00:30:17 UTC (rev 264960)
@@ -0,0 +1,4 @@
+<div style="display: flex; flex-direction: column;">
+ <div style="width: 10px; height: 100px; background-color: green;"></div>
+ <div style="width: 10px; height: 100px; background-color: blue;"></div>
+</div>
Added: trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height.html (0 => 264960)
--- trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height.html (rev 0)
+++ trunk/LayoutTests/fast/dynamic/size-to-content-autosize-with-percent-document-height.html 2020-07-28 00:30:17 UTC (rev 264960)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>This tests that autosize works fine with precent heights</title>
+<style>
+html {
+ height: 100%;
+}
+</style>
+<script>
+if (window.internals)
+ internals.enableSizeToContentAutoSizeMode(true, 200, 600);
+</script>
+</head>
+<body style="height: 100%;">
+<div style="height: 100%; display: flex; flex-direction: column;">
+ <div>
+ <div style="width: 10px; height: 100px; background-color: green;"></div>
+ </div>
+ <div style="overflow: hidden;">
+ <div style="width: 10px; height: 100px; background-color: blue;"></div>
+ </div>
+</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (264959 => 264960)
--- trunk/Source/WebCore/ChangeLog 2020-07-28 00:05:42 UTC (rev 264959)
+++ trunk/Source/WebCore/ChangeLog 2020-07-28 00:30:17 UTC (rev 264960)
@@ -1,3 +1,22 @@
+2020-07-27 Zalan Bujtas <za...@apple.com>
+
+ Extension is sized incorrectly, content is cut off.
+ https://bugs.webkit.org/show_bug.cgi?id=214858
+ <rdar://problem/64135680>
+
+ Reviewed by Simon Fraser.
+
+ Autosizing uses an 1px tall viewport to layout the content initially. When the document renderer's height is set to a percent value, this
+ 1px tall viewport will drive the available height for the descendants and we pretty much end up with overflow content.
+ Autosizing takes the overflow into account when computing the final content size, however this overflow depends on the type of the layout context (e.g. flex vs. block).
+
+ Let's replace percent height values on the document renderer with the initial "height: auto".
+
+ Test: fast/dynamic/size-to-content-autosize-with-percent-document-height.html
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::performSizeToContentAutoSize):
+
2020-07-27 Chris Dumez <cdu...@apple.com>
Update release*() functions on ExceptionOr() to always release the member
Modified: trunk/Source/WebCore/page/FrameView.cpp (264959 => 264960)
--- trunk/Source/WebCore/page/FrameView.cpp 2020-07-28 00:05:42 UTC (rev 264959)
+++ trunk/Source/WebCore/page/FrameView.cpp 2020-07-28 00:30:17 UTC (rev 264960)
@@ -3487,23 +3487,36 @@
void FrameView::performSizeToContentAutoSize()
{
+ // Do the resizing twice. The first time is basically a rough calculation using the preferred width
+ // which may result in a height change during the second iteration.
+ // Let's ignore renderers with viewport units first and resolve these boxes during the second phase of the autosizing.
LOG(Layout, "FrameView %p performSizeToContentAutoSize", this);
+ ASSERT(frame().document() && frame().document()->renderView());
- auto* document = frame().document();
- auto* renderView = document->renderView();
+ auto& document = *frame().document();
+ auto& renderView = *document.renderView();
+ auto layoutWithAdjustedStyleIfNeeded = [&] {
+ document.updateStyleIfNeeded();
+ if (auto* documentRenderer = downcast<RenderElement>(renderView.firstChild())) {
+ auto& style = documentRenderer->mutableStyle();
+ if (style.logicalHeight().isPercent()) {
+ // Percent height values on the document renderer when we don't really have a proper viewport size can
+ // result incorrect rendering in certain layout contexts (e.g flex).
+ style.setLogicalHeight({ });
+ }
+ }
+ document.updateLayout();
+ };
+ resetOverriddenViewportWidthForCSSViewportUnits();
// Start from the minimum size and allow it to grow.
auto minAutoSize = IntSize { 1, 1 };
resize(minAutoSize);
auto size = frameRect().size();
- // Do the resizing twice. The first time is basically a rough calculation using the preferred width
- // which may result in a height change during the second iteration.
- // Let's ignore renderers with viewport units first and resolve these boxes during the second phase of the autosizing.
- resetOverriddenViewportWidthForCSSViewportUnits();
for (int i = 0; i < 2; i++) {
+ layoutWithAdjustedStyleIfNeeded();
// Update various sizes including contentsSize, scrollHeight, etc.
- document->updateLayoutIgnorePendingStylesheets();
- auto newSize = IntSize { renderView->minPreferredLogicalWidth(), renderView->documentRect().height() };
+ auto newSize = IntSize { renderView.minPreferredLogicalWidth(), renderView.documentRect().height() };
// Check to see if a scrollbar is needed for a given dimension and
// if so, increase the other dimension to account for the scrollbar.
@@ -3563,9 +3576,8 @@
setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true);
}
// All the resizing above may have invalidated style (for example if viewport units are being used).
- document->updateStyleIfNeeded();
// FIXME: Use the final layout's result as the content size (webkit.org/b/173561).
- document->updateLayoutIgnorePendingStylesheets();
+ layoutWithAdjustedStyleIfNeeded();
m_autoSizeContentSize = contentsSize();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes