[webkit-changes] [WebKit/WebKit] f2eb34: [UnifiedPDF] Add support for the "Automatically Re...

Sammy Gill noreply at github.com
Thu Feb 15 22:39:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f2eb34598ea0a1e2e06f6716c724e22e9d228cf7
      https://github.com/WebKit/WebKit/commit/f2eb34598ea0a1e2e06f6716c724e22e9d228cf7
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-02-15 (Thu, 15 Feb 2024)

  Changed paths:
    M Source/WebCore/platform/LocalizedStrings.cpp
    M Source/WebCore/platform/LocalizedStrings.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Add support for the "Automatically Resize" option.
https://bugs.webkit.org/show_bug.cgi?id=269510
rdar://122208120

Reviewed by Tim Horton.

The automatic resize feature controls whether or not the document
fitting scale is changed in response to the plugin's available width
changing. This is on by default but is disabled whenever any sort of
zooming occurs. We can keep track of this by adding some extra state to
PDFDocumentLayout that keeps track of whether the document fitting scale
should be adjusted during the layout of the document.

Zooming will update this state to disable the behavior. If the behavior
is disabled but the "Automatically Resize," context menu item is
selected, then the behavior will be enabled again, the zoom will get
reset to its initial value, and the document will need get laid out
again to compute the new document fitting scale.

* Source/WebCore/platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemPDFAutoSize):
* Source/WebCore/platform/LocalizedStrings.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h:
(WebKit::PDFDocumentLayout::setShouldUpdateAutoSizeScale):
(WebKit::PDFDocumentLayout::shouldUpdateAutoSizeScale const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm:
(WebKit::PDFDocumentLayout::layoutSingleColumn):
(WebKit::PDFDocumentLayout::layoutTwoUpColumn):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::toContextMenuItemTag const):
(WebKit::UnifiedPDFPlugin::titleForContextMenuItemTag const):
(WebKit::UnifiedPDFPlugin::contextMenuItem const):
(WebKit::UnifiedPDFPlugin::scaleContextMenuItems const):
(WebKit::UnifiedPDFPlugin::performContextMenuAction):
(WebKit::UnifiedPDFPlugin::zoomIn):
(WebKit::UnifiedPDFPlugin::zoomOut):
(WebKit::UnifiedPDFPlugin::resetZoom):

Canonical link: https://commits.webkit.org/274800@main




More information about the webkit-changes mailing list