[webkit-changes] [WebKit/WebKit] 1b24c0: UnifiedPDF: Two needless debug assertions on proce...

Tim Horton noreply at github.com
Thu Apr 11 23:07:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b24c0f4324a7024f966058f29fdc70cdeac049f
      https://github.com/WebKit/WebKit/commit/1b24c0f4324a7024f966058f29fdc70cdeac049f
  Author: Tim Horton <thorton at apple.com>
  Date:   2024-04-11 (Thu, 11 Apr 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  UnifiedPDF: Two needless debug assertions on process launch
https://bugs.webkit.org/show_bug.cgi?id=272563
rdar://126316358

Reviewed by Simon Fraser.

Fix two asserts that are plaguing me while trying to fix other things:

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFDocumentLayout.mm:
(WebKit::PDFDocumentLayout::nearestPageIndexForDocumentPoint const):
Assert if we enter with a zero page count; the result is meaningless in that case
(and will actually be a totally invalid -1, and will assert at the bottom of the function instead).

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::scaleForActualSize const):
Don't try computing a scale if the plugin is 0x0, because we'll end up dividing
by zero and propagating NaNs and zeroes throughout the scales. The UI process
actually MESSAGE_CHECKs that we don't send invalid scales, so this crops up
as a UI process crash.

(WebKit::UnifiedPDFPlugin::handleMouseEvent):
Avoid handling mouse events if we haven't yet installed the document; this avoids
entering nearestPageIndexForDocumentPoint with a zero page count.

Canonical link: https://commits.webkit.org/277416@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