[webkit-changes] [WebKit/WebKit] 9dfcb5: Safari not rendering some PDFs correctly

Richard Robinson noreply at github.com
Thu Jun 22 10:33:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9dfcb542a351d1fc7fff821dfb025427fdd2b77b
      https://github.com/WebKit/WebKit/commit/9dfcb542a351d1fc7fff821dfb025427fdd2b77b
  Author: Richard Robinson <richard_robinson2 at apple.com>
  Date:   2023-06-22 (Thu, 22 Jun 2023)

  Changed paths:
    M Source/WebCore/html/PluginDocument.cpp

  Log Message:
  -----------
  Safari not rendering some PDFs correctly
https://bugs.webkit.org/show_bug.cgi?id=258377
rdar://110632076

Reviewed by Tim Horton.

254526 at main made `PluginDocument` use "no-quirks" mode. PDFs were relying on the "body element fills the html element"
quirk to ensure their height matches the root HTML element's height, because the body element had no CSS `height` value
specified. Because `PluginDocument` is now in no-quirks mode, the body element's height can sometimes be less than the
height of the web view, which is incorrect.

254526 at main tried to ensure this would not happen by using `setAttribute` on the body element to set the relevant CSS
attributes, including the height. However, `setAttribute` is lazy, so for some PDFS, none of these attributes were
actually being applied.

To fix, use `setInlineStyleProperty` instead of `setAttribute` to ensure the attributes are properly set immediately.

Also added a comment to clarify where the body background color actually comes from in the case of PDFs, to avoid future
confusion.

* Source/WebCore/html/PluginDocument.cpp:
(WebCore::PluginDocumentParser::createDocumentStructure):

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




More information about the webkit-changes mailing list