Title: [217751] trunk
- Revision
- 217751
- Author
- za...@apple.com
- Date
- 2017-06-02 21:40:38 -0700 (Fri, 02 Jun 2017)
Log Message
Cleanup FrameView::autoSizeIfEnabled.
https://bugs.webkit.org/show_bug.cgi?id=172889
<rdar://problem/32550783>
Reviewed by Tim Horton.
Source/WebCore:
This patch ensures that we always have a clean tree (and a valid and current document size) when
setting m_autoSizeContentSize.
* page/FrameView.cpp:
(WebCore::FrameView::autoSizeIfEnabled):
Tools:
* TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm:
(-[AutoLayoutWKWebView load:withWidth:expectingContentSize:resettingWidth:]): progression.
(TEST):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (217750 => 217751)
--- trunk/Source/WebCore/ChangeLog 2017-06-03 03:44:51 UTC (rev 217750)
+++ trunk/Source/WebCore/ChangeLog 2017-06-03 04:40:38 UTC (rev 217751)
@@ -1,3 +1,17 @@
+2017-06-02 Zalan Bujtas <za...@apple.com>
+
+ Cleanup FrameView::autoSizeIfEnabled.
+ https://bugs.webkit.org/show_bug.cgi?id=172889
+ <rdar://problem/32550783>
+
+ Reviewed by Tim Horton.
+
+ This patch ensures that we always have a clean tree (and a valid and current document size) when
+ setting m_autoSizeContentSize.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::autoSizeIfEnabled):
+
2017-06-02 Wenson Hsieh <wenson_hs...@apple.com>
REGRESSION(r216212): RenderReplaced::paint() should not save and restore the context unless it has to
Modified: trunk/Source/WebCore/page/FrameView.cpp (217750 => 217751)
--- trunk/Source/WebCore/page/FrameView.cpp 2017-06-03 03:44:51 UTC (rev 217750)
+++ trunk/Source/WebCore/page/FrameView.cpp 2017-06-03 04:40:38 UTC (rev 217751)
@@ -3655,33 +3655,28 @@
if (m_inAutoSize)
return;
- LOG(Layout, "FrameView %p autoSizeIfEnabled", this);
-
- SetForScope<bool> changeInAutoSize(m_inAutoSize, true);
-
- Document* document = frame().document();
+ auto* document = frame().document();
if (!document)
return;
- RenderView* documentView = document->renderView();
- Element* documentElement = document->documentElement();
- if (!documentView || !documentElement)
+ auto* renderView = document->renderView();
+ if (!renderView)
return;
+ LOG(Layout, "FrameView %p autoSizeIfEnabled", this);
+ SetForScope<bool> changeInAutoSize(m_inAutoSize, true);
if (m_layoutRoot)
convertSubtreeLayoutToFullLayout();
// Start from the minimum size and allow it to grow.
resize(m_minAutoSize.width(), m_minAutoSize.height());
-
IntSize 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.
for (int i = 0; i < 2; i++) {
// Update various sizes including contentsSize, scrollHeight, etc.
document->updateLayoutIgnorePendingStylesheets();
- int width = documentView->minPreferredLogicalWidth();
- int height = documentView->documentRect().height();
+ int width = renderView->minPreferredLogicalWidth();
+ int height = renderView->documentRect().height();
IntSize newSize(width, height);
// Check to see if a scrollbar is needed for a given dimension and
@@ -3740,18 +3735,16 @@
setHorizontalScrollbarLock(false);
setScrollbarModes(horizonalScrollbarMode, verticalScrollbarMode, true, true);
}
-
+ if (m_autoSizeFixedMinimumHeight) {
+ auto contentsSize = this->contentsSize();
+ resize(contentsSize.width(), std::max(m_autoSizeFixedMinimumHeight, contentsSize.height()));
+ }
// All the resizing above may have invalidated style (for example if viewport units are being used).
- document->updateStyleIfNeeded();
-
+ document->updateLayoutIgnorePendingStylesheets();
m_autoSizeContentSize = contentsSize();
-
- if (m_autoSizeFixedMinimumHeight) {
- resize(m_autoSizeContentSize.width(), std::max(m_autoSizeFixedMinimumHeight, m_autoSizeContentSize.height()));
- document->updateLayoutIgnorePendingStylesheets();
- }
-
m_didRunAutosize = true;
+ ASSERT(!needsLayout());
+ // FIXME: Now that autoSizeIfEnabled() actually returns clean, we don't need to call it from layout() anymore (see webkit.org/b/172890).
}
void FrameView::setAutoSizeFixedMinimumHeight(int fixedMinimumHeight)
Modified: trunk/Tools/ChangeLog (217750 => 217751)
--- trunk/Tools/ChangeLog 2017-06-03 03:44:51 UTC (rev 217750)
+++ trunk/Tools/ChangeLog 2017-06-03 04:40:38 UTC (rev 217751)
@@ -1,3 +1,15 @@
+2017-06-02 Zalan Bujtas <za...@apple.com>
+
+ Cleanup FrameView::autoSizeIfEnabled.
+ https://bugs.webkit.org/show_bug.cgi?id=172889
+ <rdar://problem/32550783>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm:
+ (-[AutoLayoutWKWebView load:withWidth:expectingContentSize:resettingWidth:]): progression.
+ (TEST):
+
2017-06-02 Chris Dumez <cdu...@apple.com>
ResourceLoadStatistics are not using unique paths during test runs
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm (217750 => 217751)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm 2017-06-03 03:44:51 UTC (rev 217750)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm 2017-06-03 04:40:38 UTC (rev 217751)
@@ -67,6 +67,7 @@
".large { width: 100px; height: 100px; }"
".veryWide { width: 100px; height: 10px; }"
".inline { display: inline-block; }"
+ ".viewportUnit { height: 50vh; }"
"</style>";
[self loadHTMLString:[baseHTML stringByAppendingString:HTMLString] baseURL:nil];
@@ -130,6 +131,10 @@
// 100x10 rect with the constraint (width >= 50) -> 100x10
[webView load:@"<div class='veryWide'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 10)];
+ // 100px height + 50vh -> 150px
+ [webView _setViewportSizeForCSSViewportUnits:CGSizeMake(100, 100)];
+ [webView load:@"<div class='viewportUnit'></div><div class='large'></div>" withWidth:100 expectingContentSize:NSMakeSize(100, 150)];
+
// Ten 10x10 rects, inline, should result in two rows of five; with the constraint (width >= 50) -> 50x20
[webView load:@"<div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div><div class='small inline'></div>" withWidth:50 expectingContentSize:NSMakeSize(50, 20)];
@@ -157,7 +162,7 @@
// of the intrinsic height of the content. We have to load differently-sized content so that we can wait for
// the intrinsic size change callback.
[webView _setShouldExpandContentToViewHeightForAutoLayout:YES];
- [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 100) resettingWidth:NO];
+ [webView load:@"<div class='large'></div>" withWidth:50 expectingContentSize:NSMakeSize(100, 1000) resettingWidth:NO];
[webView evaluateJavaScript:@"window.innerHeight" completionHandler:^(id value, NSError *error) {
EXPECT_TRUE([value isKindOfClass:[NSNumber class]]);
EXPECT_EQ(1000, [value integerValue]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes