Changeset 232356 in webkit
- Timestamp:
- May 31, 2018 10:55:43 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r232337 r232356 1 2018-05-31 Antti Koivisto <antti@apple.com> 2 3 WebKit memory management: Safari jetsams on some websites when zooming and scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=186091 5 <rdar://problem/36315010> 6 7 Reviewed by Geoff Garen. 8 9 When zooming a page rapidly the visible rect and the page zoom level may get momentarily out of sync. 10 When this happens we may generate tiles for a much larger area than needed and run out of memory 11 building the next layer tree transaction. Running out of memory is more likely if the page has lots of 12 tiled layers in addition to the main content layer. 13 14 We already have code for dealing with the scale mismatch for zoom-out case (where this would cause 15 visibly missing tiles). This patch enables the same exact adjustment for zoom-in case (where the 16 symptom is creating too many tiles). 17 18 * WebProcess/WebPage/ios/WebPageIOS.mm: 19 (WebKit::adjustExposedRectForNewScale): 20 21 Do some renames to make it clear that this can both expand and contract the visible rect. 22 Bail out if there is nothing to do. 23 24 (WebKit::WebPage::updateVisibleContentRects): 25 26 Call adjustExposedRectForNewScale directly and unconditionally. 27 28 (WebKit::adjustExposedRectForBoundedScale): Deleted. 29 1 30 2018-05-30 Yusuke Suzuki <utatane.tea@gmail.com> 2 31 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r232201 r232356 300 300 static inline FloatRect adjustExposedRectForNewScale(const FloatRect& exposedRect, double exposedRectScale, double newScale) 301 301 { 302 double overscaledWidth = exposedRect.width(); 303 double missingHorizonalMargin = exposedRect.width() * exposedRectScale / newScale - overscaledWidth; 304 305 double overscaledHeight = exposedRect.height(); 306 double missingVerticalMargin = exposedRect.height() * exposedRectScale / newScale - overscaledHeight; 307 308 return FloatRect(exposedRect.x() - missingHorizonalMargin / 2, exposedRect.y() - missingVerticalMargin / 2, exposedRect.width() + missingHorizonalMargin, exposedRect.height() + missingVerticalMargin); 302 if (exposedRectScale == newScale) 303 return exposedRect; 304 305 float horizontalChange = exposedRect.width() * exposedRectScale / newScale - exposedRect.width(); 306 float verticalChange = exposedRect.height() * exposedRectScale / newScale - exposedRect.height(); 307 308 auto adjustedRect = exposedRect; 309 adjustedRect.inflate({ horizontalChange / 2, verticalChange / 2 }); 310 return adjustedRect; 309 311 } 310 312 … … 2809 2811 } 2810 2812 2811 static inline FloatRect adjustExposedRectForBoundedScale(const FloatRect& exposedRect, double exposedRectScale, double newScale)2812 {2813 if (exposedRectScale < newScale)2814 return exposedRect;2815 2816 return adjustExposedRectForNewScale(exposedRect, exposedRectScale, newScale);2817 }2818 2819 2813 std::optional<float> WebPage::scaleFromUIProcess(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo) const 2820 2814 { … … 2887 2881 float scaleToUse = scaleFromUIProcess.value_or(m_page->pageScaleFactor()); 2888 2882 FloatRect exposedContentRect = visibleContentRectUpdateInfo.exposedContentRect(); 2889 FloatRect adjustedExposedContentRect = adjustExposedRectFor BoundedScale(exposedContentRect, visibleContentRectUpdateInfo.scale(), scaleToUse);2883 FloatRect adjustedExposedContentRect = adjustExposedRectForNewScale(exposedContentRect, visibleContentRectUpdateInfo.scale(), scaleToUse); 2890 2884 m_drawingArea->setExposedContentRect(adjustedExposedContentRect); 2891 2885
Note: See TracChangeset
for help on using the changeset viewer.