Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4955ef671c0ba9fe20c6c0e31f8936bc41e3f406
      
https://github.com/WebKit/WebKit/commit/4955ef671c0ba9fe20c6c0e31f8936bc41e3f406
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/GraphicsContext.h

  Log Message:
  -----------
  GraphicsContext::hasBlurredDropShadow()/hasDropShadow() make redundant copies 
of the drop shadow
https://bugs.webkit.org/show_bug.cgi?id=317995
rdar://180783813

Reviewed by Kimmo Kinnunen.

hasBlurredDropShadow() and hasDropShadow() each called the public
dropShadow() accessor once or twice per query. That accessor returns
std::optional<GraphicsDropShadow> by value, so every call copied the
whole optional, including the GraphicsDropShadow's Color member, only to
read a single field.

Have the two helpers read GraphicsContextState::dropShadow() directly,
which already hands back a const reference. This removes all of those
copies with no change to the public API.

The public dropShadow() keeps returning by value rather than by const
reference: a reference would alias m_state and could be left dangling by
a subsequent save()/restore() or setDropShadow() that mutates the state
stack, and LIFETIME_BOUND does not catch that misuse.

No change in behavior, so no new tests.

* Source/WebCore/platform/graphics/GraphicsContext.h:
(WebCore::GraphicsContext::hasBlurredDropShadow const):
(WebCore::GraphicsContext::hasDropShadow const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to