[webkit-changes] [WebKit/WebKit] f5c4ea: ComputedStyleExtractor methods should be const whe...

Sammy Gill noreply at github.com
Fri Aug 18 13:43:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f5c4eacf1b680be9ab02d77323051599228a47c0
      https://github.com/WebKit/WebKit/commit/f5c4eacf1b680be9ab02d77323051599228a47c0
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/ComputedStyleExtractor.h
    M Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp

  Log Message:
  -----------
  ComputedStyleExtractor methods should be const when possible.
https://bugs.webkit.org/show_bug.cgi?id=260401
rdar://problem/114099664

Reviewed by Tim Nguyen.

Many of the methods for ComputedStyleExtractor compute a value and then
return it without modifying any sort of state in the class. In these
cases we should try to mark these methods as const if this can be
easily done. This is useful for other code that many use a const
ComputedStyleExtractor and would like to use these methods. For example,
in 260397 I plan on passing in a const ComputedStyleExtractor into
ShorthandSerializer so that we can use it for the computed style
of the grid-template property.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::ComputedStyleExtractor::whiteSpaceShorthandValue const):
(WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword const):
(WebCore::ComputedStyleExtractor::useFixedFontDefaultSize const):
(WebCore::ComputedStyleExtractor::fontVariantShorthandValue const):
(WebCore::ComputedStyleExtractor::customPropertyValue const):
(WebCore::ComputedStyleExtractor::customPropertyText const):
(WebCore::ComputedStyleExtractor::propertyValue const):
(WebCore::ComputedStyleExtractor::hasProperty const):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle const):
(WebCore::ComputedStyleExtractor::propertyMatches const):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties const):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesFor2SidesShorthand const):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesFor4SidesShorthand const):
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand const):
(WebCore::ComputedStyleExtractor::copyProperties const):
(WebCore::ComputedStyleExtractor::getLayerCount const):
(WebCore::ComputedStyleExtractor::getFillLayerPropertyShorthandValue const):
(WebCore::ComputedStyleExtractor::getBackgroundShorthandValue const):
(WebCore::ComputedStyleExtractor::getMaskShorthandValue const):
(WebCore::ComputedStyleExtractor::whiteSpaceShorthandValue): Deleted.
(WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword): Deleted.
(WebCore::ComputedStyleExtractor::useFixedFontDefaultSize): Deleted.
(WebCore::ComputedStyleExtractor::fontVariantShorthandValue): Deleted.
(WebCore::ComputedStyleExtractor::customPropertyValue): Deleted.
(WebCore::ComputedStyleExtractor::customPropertyText): Deleted.
(WebCore::ComputedStyleExtractor::propertyValue): Deleted.
(WebCore::ComputedStyleExtractor::hasProperty): Deleted.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Deleted.
(WebCore::ComputedStyleExtractor::propertyMatches): Deleted.
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties): Deleted.
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesFor2SidesShorthand): Deleted.
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesFor4SidesShorthand): Deleted.
(WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand): Deleted.
(WebCore::ComputedStyleExtractor::copyProperties): Deleted.
(WebCore::ComputedStyleExtractor::getLayerCount): Deleted.
(WebCore::ComputedStyleExtractor::getFillLayerPropertyShorthandValue): Deleted.
(WebCore::ComputedStyleExtractor::getBackgroundShorthandValue): Deleted.
(WebCore::ComputedStyleExtractor::getMaskShorthandValue): Deleted.
* Source/WebCore/css/ComputedStyleExtractor.h:
* Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue const):
(WebCore::ComputedStyleExtractor::svgPropertyValue): Deleted.

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




More information about the webkit-changes mailing list