Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedPDF] Adjust automatically resize logic.
https://bugs.webkit.org/show_bug.cgi?id=271264 rdar://123417338 Reviewed by Simon Fraser and Abrar Rahman Protyasha. This patch aims to make the "Automatically Resize," context menu item logic a little more intuitive. The way that this setting works now with this patch is as follows: 1. Defaults to off - PDFDocumentLayout has m_autoSizeState initialized to ShouldUpdateAutoSizeScale::Yes, but the plugin will set it to No after the first layout. This is so that the document gets fitted according to our existing logic on initial load. Any sort of window resizing at this point will not resize the document. 2. Turning it on rescales the PDF to the window width - This is done by adjusting the logic that we have when we handle the associated context menu event. Instead of setting the plugin's scale factor to its initial scale that was computed on load, we will set it to 1.0. 3. Any type of zooming turns it off - This is already handled already in UnifiedPDFPlugin::setPageScaleFactor. This includes HUD, pinch, and keyboard zooming. 4. The setting can also be toggleable - Expanded the associated context menu action handling to include this. When the setting is toggled off the scales will remain the same even during window resizing. Toggling it back on will reset the plugin's scale factor and adjust the document fitting scale so that the document once again fits the available width. * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::UnifiedPDFPlugin::updateLayout): (WebKit::UnifiedPDFPlugin::performContextMenuAction): Canonical link: https://commits.webkit.org/276371@main
- Loading branch information