[webkit-changes] [WebKit/WebKit] 13d7a9: Unable to zoom out all the way on one specific enc...

Abrar Rahman Protyasha noreply at github.com
Wed Sep 11 10:00:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 13d7a93baa0ccbb274c0e1f825602af133f2e0fa
      https://github.com/WebKit/WebKit/commit/13d7a93baa0ccbb274c0e1f825602af133f2e0fa
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-09-11 (Wed, 11 Sep 2024)

  Changed paths:
    M Source/WTF/wtf/OptionSet.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.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
    M Tools/TestWebKitAPI/Tests/WTF/OptionSet.cpp

  Log Message:
  -----------
  Unable to zoom out all the way on one specific encrypted PDF
https://bugs.webkit.org/show_bug.cgi?id=279490
rdar://135716681

Reviewed by Tim Horton.

This patch revisits the issue originally addressed by 282007 at main, which
is that for a class of encrypted PDF documents, we don't have accurate
page geometry before the document is unlocked. As such, document layout
updates may settle at the wrong initial scale / anchor position for such
documents, resulting in symptoms reported in this bug and in bug 277812.

This patch:
- Adjusts the condition from 282007 at main: having a page count doesn't
  mean we have accurate page geometry, so we reset scale when unlocking
  assuming we don't.

- Returns an option set informing what changes to the document layout
  were made in PDFDocumentLayout::updateLayout(). If the option set
  isn't empty, that implies we did not have accurate page geometry on
  previous layout updates, and as such we should reset scale and ignore
  any previously determined anchor positions.

- Overrides UnifiedPDFPlugin::[min/max]ScaleFactor() to return the
  minimum/maximum zoom scales defined for the plugin, respectively. This
  aligns the HUD zoom limits with the pinch zoom limits.

- Adds an operator|= to WTF::OptionSet for ease of updating the option
  set in UnifiedPDFPlugin::updateLayout().

* Source/WTF/wtf/OptionSet.h:
(WTF::OptionSet::operator|=):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::minScaleFactor const):
(WebKit::PDFPluginBase::maxScaleFactor const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm:
(WebKit::PDFDocumentLayout::updateLayout):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::attemptToUnlockPDF):
(WebKit::UnifiedPDFPlugin::maxScaleFactor const):
(WebKit::UnifiedPDFPlugin::scaleForActualSize const):
(WebKit::UnifiedPDFPlugin::updateLayout):
* Tools/TestWebKitAPI/Tests/WTF/OptionSet.cpp:
(TestWebKitAPI::TEST(WTF_OptionSet, OrAssignment)):

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list