[webkit-changes] [WebKit/WebKit] 5d9c7d: [Cleanup] Remove RenderBox::shouldTreatChildAsRepl...

Alan Baradlay noreply at github.com
Fri Jan 3 05:57:04 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5d9c7d398e480760b7bb24630468e4b41d11be6f
      https://github.com/WebKit/WebKit/commit/5d9c7d398e480760b7bb24630468e4b41d11be6f
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2025-01-03 (Fri, 03 Jan 2025)

  Changed paths:
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderTableSection.cpp

  Log Message:
  -----------
  [Cleanup] Remove RenderBox::shouldTreatChildAsReplaced
https://bugs.webkit.org/show_bug.cgi?id=285289

Reviewed by Antti Koivisto.

1. "shouldTreatAsReplaced" is a rather overloaded term (and could therefore be very misleading), especially when it is on RenderBox.
(At various points during layout, "treat as replaced" has slightly different meanings)
2. This function returns true for atomic inlines which are not replaced boxes.
3. It checks against HTMLImageElement, but not all HTMLImageElement objects are replaced (see HTMLImageElement::isReplaced) and it is also a redundant check (see isReplacedOrAtomicInline)

Let's simplify it
  isReplacedOrAtomicInline() || (is<HTMLFormControlElement>(element()) && !is<HTMLFieldSetElement>(element()))
and move it to the callsites (there are only 3).

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::tableCellShouldHaveZeroInitialSize):
(WebCore::RenderBox::computePercentageLogicalHeight const):
(WebCore::RenderBox::isUnsplittableForPagination const):
(WebCore::RenderBox::shouldTreatChildAsReplaced const): Deleted.
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderTableSection.cpp:
(WebCore::shouldFlexCellChild):

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