Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7330772d995fe52703882143d0e37717ef941632
      
https://github.com/WebKit/WebKit/commit/7330772d995fe52703882143d0e37717ef941632
  Author: Sammy Gill <sammy.g...@apple.com>
  Date:   2025-08-28 (Thu, 28 Aug 2025)

  Changed paths:
    M Tools/lldb/lldb_webkit.py

  Log Message:
  -----------
  Add a few type summaries for StyleLength types.
https://bugs.webkit.org/show_bug.cgi?id=298062
rdar://159391129

Reviewed by Alan Baradlay.

With the introduction of the new strongly typed Style system, it has
become a bit cumbersome to figure out what the underlying length is
while you are in the middle of a debug session. For example, if you want
to find out what the type is, you would need to query via the isFixed(),
isPercent(), etc. functions until you find the right type.

This patch helps improve the debugging experience a bit by adding some
type summaries to a few of these new length types (PreferredSize,
MinimumSize, and MaximumSize) to provide a summary of the length in a
nice and readable format. I am only adding summaries for these types
specifically in this initial patch since they are fairly common but it
should hopefully be straightforward to build upon this and add summaries
for the rest as needed. One thing to note is that the calc summary
just returns "calc," but this is the same as the old Length summary
provider.

The structure of the summary providers is based upon the overall
architecture of LengthWrapperBase and its derived classes.
Implementations of LengthWrapperBase provide any keyword values via
template parameters, which end up influencing how its opaque type is
mapped. For example, the first keyword of the length is mapped to 1, the
second is mapped to 2, etc. Fixed is mapped to value right after
the last keyword, percentage is mapped to right after fixed, and calc
is mapped to fixed + 2.

This means that we can abstract out most of the logic for these type
summaries since the only thing that makes the behavior of the
implementations is which keywords we support.

* Tools/lldb/lldb_webkit.py:
(WebCoreStyleLengthProviderBase):
This base class is used to contain most of the logic/API that is
required to analyze the actual type. All the derived class needs to do
is override the list of keywords for whatever is supported.

(WebCoreStyleLengthProviderBase.__init__):
(WebCoreStyleLengthProviderBase.has_quirk):
(WebCoreStyleLengthProviderBase.has_keywords):
(WebCoreStyleLengthProviderBase.fixed_type_value):
(WebCoreStyleLengthProviderBase.percentage_type_value):
(WebCoreStyleLengthProviderBase.calculated_type_value):
Maps the same logic as in LengthWrapperBase for the mapping of these
values in relation to the keywords.

(addSummaryProviderForWebCoreStyleLength):
This helper function is used to add the type summaries for
implementation LengthWrapperBase. All that is needed is the type that a
summary is needed for (e.g. WebCore::Style::PreferredSize) along with a
list of any keywords that it supports.

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