Changeset 264960 in webkit
- Timestamp:
- Jul 27, 2020 5:30:17 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r264953 r264960 1 2020-07-27 Zalan Bujtas <zalan@apple.com> 2 3 Extension is sized incorrectly, content is cut off. 4 https://bugs.webkit.org/show_bug.cgi?id=214858 5 <rdar://problem/64135680> 6 7 Reviewed by Simon Fraser. 8 9 * fast/dynamic/size-to-content-autosize-with-percent-document-height-expected.html: Added. 10 * fast/dynamic/size-to-content-autosize-with-percent-document-height.html: Added. 11 1 12 2020-07-27 Ryan Haddad <ryanhaddad@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r264958 r264960 1 2020-07-27 Zalan Bujtas <zalan@apple.com> 2 3 Extension is sized incorrectly, content is cut off. 4 https://bugs.webkit.org/show_bug.cgi?id=214858 5 <rdar://problem/64135680> 6 7 Reviewed by Simon Fraser. 8 9 Autosizing uses an 1px tall viewport to layout the content initially. When the document renderer's height is set to a percent value, this 10 1px tall viewport will drive the available height for the descendants and we pretty much end up with overflow content. 11 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). 12 13 Let's replace percent height values on the document renderer with the initial "height: auto". 14 15 Test: fast/dynamic/size-to-content-autosize-with-percent-document-height.html 16 17 * page/FrameView.cpp: 18 (WebCore::FrameView::performSizeToContentAutoSize): 19 1 20 2020-07-27 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WebCore/page/FrameView.cpp
r264627 r264960 3488 3488 void FrameView::performSizeToContentAutoSize() 3489 3489 { 3490 // Do the resizing twice. The first time is basically a rough calculation using the preferred width 3491 // which may result in a height change during the second iteration. 3492 // Let's ignore renderers with viewport units first and resolve these boxes during the second phase of the autosizing. 3490 3493 LOG(Layout, "FrameView %p performSizeToContentAutoSize", this); 3491 3492 auto* document = frame().document(); 3493 auto* renderView = document->renderView(); 3494 3494 ASSERT(frame().document() && frame().document()->renderView()); 3495 3496 auto& document = *frame().document(); 3497 auto& renderView = *document.renderView(); 3498 auto layoutWithAdjustedStyleIfNeeded = [&] { 3499 document.updateStyleIfNeeded(); 3500 if (auto* documentRenderer = downcast<RenderElement>(renderView.firstChild())) { 3501 auto& style = documentRenderer->mutableStyle(); 3502 if (style.logicalHeight().isPercent()) { 3503 // Percent height values on the document renderer when we don't really have a proper viewport size can 3504 // result incorrect rendering in certain layout contexts (e.g flex). 3505 style.setLogicalHeight({ }); 3506 } 3507 } 3508 document.updateLayout(); 3509 }; 3510 3511 resetOverriddenViewportWidthForCSSViewportUnits(); 3495 3512 // Start from the minimum size and allow it to grow. 3496 3513 auto minAutoSize = IntSize { 1, 1 }; 3497 3514 resize(minAutoSize); 3498 3515 auto size = frameRect().size(); 3499 // Do the resizing twice. The first time is basically a rough calculation using the preferred width3500 // which may result in a height change during the second iteration.3501 // Let's ignore renderers with viewport units first and resolve these boxes during the second phase of the autosizing.3502 resetOverriddenViewportWidthForCSSViewportUnits();3503 3516 for (int i = 0; i < 2; i++) { 3517 layoutWithAdjustedStyleIfNeeded(); 3504 3518 // Update various sizes including contentsSize, scrollHeight, etc. 3505 document->updateLayoutIgnorePendingStylesheets(); 3506 auto newSize = IntSize { renderView->minPreferredLogicalWidth(), renderView->documentRect().height() }; 3519 auto newSize = IntSize { renderView.minPreferredLogicalWidth(), renderView.documentRect().height() }; 3507 3520 3508 3521 // Check to see if a scrollbar is needed for a given dimension and … … 3564 3577 } 3565 3578 // All the resizing above may have invalidated style (for example if viewport units are being used). 3566 document->updateStyleIfNeeded();3567 3579 // FIXME: Use the final layout's result as the content size (webkit.org/b/173561). 3568 document->updateLayoutIgnorePendingStylesheets();3580 layoutWithAdjustedStyleIfNeeded(); 3569 3581 m_autoSizeContentSize = contentsSize(); 3570 3582 }
Note: See TracChangeset
for help on using the changeset viewer.