[webkit-changes] [WebKit/WebKit] dbdb89: Set intrinsic size for inline SVG earlier

Ahmad Saleem noreply at github.com
Wed Jul 26 08:50:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dbdb89fe49e86b4bb7563df8544776e9f9c9f4fb
      https://github.com/WebKit/WebKit/commit/dbdb89fe49e86b4bb7563df8544776e9f9c9f4fb
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-07-26 (Wed, 26 Jul 2023)

  Changed paths:
    A LayoutTests/svg/in-html/inside-inline-block-expected.html
    A LayoutTests/svg/in-html/inside-inline-block.html
    M Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h
    M Source/WebCore/rendering/svg/RenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/RenderSVGRoot.h

  Log Message:
  -----------
  Set intrinsic size for inline SVG earlier

https://bugs.webkit.org/show_bug.cgi?id=257614
rdar://problem/110480382

Reviewed by Simon Fraser.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Merge: https://chromium.googlesource.com/chromium/src.git/+/545b2183e1b4ee3eb433537f9a6386b5337d6588

RenderReplaced has a m_intrinsicSize that's updated when computing
logical widths and heights (and only if needed; specified style makes
it not being set at all).

But m_intrinsicSize can be used earlier that that, when computing
preferred widths for the container, see
RenderReplaced::computeIntrinsicLogicalWidths called from
RenderReplaced::computePreferredLogicalWidths().

This patch computes the intrinsic size in the constructor to avoid
returning the stale default size.

* Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp:
(1) Add constants for 'defaultWidth' and 'defaultHeight'
(2) Add 'intrinsicSize' logic
(3) Introduce new function 'calculateIntrinsicSize'
(LegacyRenderSVGRoot::computeIntrinsicRatioInformation): Call above function and remove unneeded comments
* Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h: Definition of 'calculateIntrinsicSize'
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp: Same changes as 'Legacy' for LBSE
* Source/WebCore/rendering/svg/RenderSVGRoot.h: Ditto
* LayoutTests/svg/in-html/inside-inline-block.html: Add Test Case
* LayoutTests/svg/in-html/inside-inline-block-expected.html: Add Test Case Expectation

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




More information about the webkit-changes mailing list