Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 155d07de56e25c9b835595973c4b8c5a31cebb04
      
https://github.com/WebKit/WebKit/commit/155d07de56e25c9b835595973c4b8c5a31cebb04
  Author: Sammy Gill <sammy.g...@apple.com>
  Date:   2025-08-06 (Wed, 06 Aug 2025)

  Changed paths:
    M Source/WebCore/rendering/RenderImage.cpp
    M Source/WebCore/rendering/RenderImage.h
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderReplaced.h
    M Source/WebCore/rendering/svg/RenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/RenderSVGRoot.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.h

  Log Message:
  -----------
  Decouple computeIntrinsicSizeAndPreferredAspectRatio into two separate 
functions.
https://bugs.webkit.org/show_bug.cgi?id=296523
rdar://problem/156800789

Reviewed by Brent Fulgham.

computeIntrinsicSizeAndPreferredAspectRatio currently does two different
things: compute the intrinsic size of the renderer as well as the
preferred aspect ratio. If we instead decouple this into two different
functions, this will improve the readability and maintainability of the
code. For example, any changes that are made to the logic related to
determining the preferred aspect ratio will not need to be concerned
about the other logic related to the renderer's intrinsic size. In some
cases, you may need the intrinsic size to determine the preferred aspect
ratio, but that will be just a matter of calling the new helper function
whose responsibility will be to give that value to the caller.

* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeIntrinsicSize const):
(WebCore::RenderSVGRoot::calculateIntrinsicSize const): Deleted.
calculateIntrinsicSize was only being used in two different places:
1.) Inside the constructor of RenderSVGRoot
2.) Directly from the newly added computeIntrinsicSize.
Since these are the only two locations, and is being used in a fairly
straightforward manner in both cases, we probably do not need to keep
both of them around especially since they are both similarly named. It
might end up becoming confusing to determine which one you should call
and when. So I went ahead and moved the logic inside of
calculateIntrinsicSize into the new function and replaced the call
inside the constructor. This required modifying the previous ASSERT we
were using to only trigger when we are inside of render tree layout so
that we can keep using it inside the constructor.

* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::computeIntrinsicSize const):
(WebCore::LegacyRenderSVGRoot::calculateIntrinsicSize const): Deleted.
Same as RenderSVGRoot.cpp.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to