Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 249b15d9fda8ed8fd74b0cacb4a90011c34c351f
https://github.com/WebKit/WebKit/commit/249b15d9fda8ed8fd74b0cacb4a90011c34c351f
Author: Cole Carley <[email protected]>
Date: 2026-09-16 (Wed, 16 Sep 2026)
Changed paths:
M Source/WebCore/page/QuirkBehaviors.h
M Source/WebCore/page/QuirkTable.cpp
M Source/WebCore/page/Quirks.cpp
M Source/WebCore/page/Quirks.h
M Source/WebCore/page/QuirksData.h
M Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp
Log Message:
-----------
[Quirks] Add element matching conditions to the Quirk table
rdar://186404545
Reviewed by Brent Fulgham.
This patch adds conditions to QuirkBehaviors, getting us closer to
our goal of data-defined Quirks.
Now when defining a QuirkBehavior, you can make sure that it is only
enabled when it meets a condition. The first condition I've added is an
element selector. The QuirkBehavior is only considered active when the
element passed to the accessor matches the element selector.
I chose to keep QuirkBehaviors and QuirksData self contained, so the
QuirkBehavior only holds the selector string. It is up to the client
of the QuirkBehavior to actually do check if that selector matches
anything.
Test: Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp
* Source/WebCore/page/QuirkBehaviors.h:
(WebCore::QuirkParameters::fromScript):
(WebCore::QuirkBehaviorConditions::elementMatchesSelector):
(WebCore::QuirkBehavior::operator() const):
(WebCore::QuirkBehavior::when const):
(WebCore::QuirkBehavior::applyCondition const):
* Source/WebCore/page/QuirkTable.cpp:
* Source/WebCore/page/Quirks.cpp:
(WebCore::urlHasQuirk):
(WebCore::Quirks::elementMatchesSelectorCondition):
(WebCore::Quirks::needsAnchorToBeMouseFocusable const):
(WebCore::Quirks::needsFormControlToBeMouseFocusable const):
(WebCore::Quirks::needsAutoplayPlayPauseEvents const):
(WebCore::Quirks::needsSeekingSupportDisabled const):
(WebCore::Quirks::shouldAutoplayWebAudioForArbitraryUserGesture const):
(WebCore::Quirks::hasBrokenEncryptedMediaAPISupportQuirk const):
(WebCore::Quirks::isTouchBarUpdateSuppressedForHiddenContentEditable const):
(WebCore::Quirks::isNeverRichlyEditableForTouchBar const):
(WebCore::Quirks::shouldSuppressAutocorrectionAndAutocapitalizationInHiddenEditableAreas
const):
(WebCore::Quirks::shouldDispatchSyntheticMouseEventsWhenModifyingSelection
const):
(WebCore::Quirks::needsYouTubeMouseOutQuirk const):
(WebCore::Quirks::needsYouTubeCaptionsQuirk const):
(WebCore::Quirks::needsCNNCaptionQuirk const):
(WebCore::Quirks::needsYouTubeEmbedAutoplayQuirk const):
(WebCore::Quirks::shouldDisableWritingSuggestionsByDefault const):
(WebCore::Quirks::ensureCaptionVisibilityInFullscreenAndPictureInPicture const):
(WebCore::Quirks::shouldDisableElementFullscreenQuirk const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldPreventDispatchOfTouchEvent const):
(WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented
const):
(WebCore::Quirks::shouldAvoidResizingWhenInputViewBoundsChange const):
(WebCore::Quirks::shouldDisablePointerEventsQuirk const):
(WebCore::Quirks::inputMethodMustUseCompositionEvents const):
(WebCore::Quirks::shouldIgnoreInputModeNone const):
(WebCore::Quirks::needsGMailOverflowScrollQuirk const):
(WebCore::Quirks::needsYouTubeOverflowScrollQuirk const):
(WebCore::Quirks::needsWebExScrollabilityQuirk const):
(WebCore::Quirks::needsFacebookRemoveNotSupportedQuirk const):
(WebCore::Quirks::needsScrollbarWidthThinDisabledQuirk const):
(WebCore::Quirks::needsBodyScrollbarWidthNoneDisabledQuirk const):
(WebCore::Quirks::needsAirIndiaExpressLayeringQuirk const):
(WebCore::Quirks::needsFullscreenDisplayNoneQuirk const):
(WebCore::Quirks::needsFullscreenObjectFitQuirk const):
(WebCore::Quirks::needsZomatoEmailLoginLabelQuirk const):
(WebCore::Quirks::needsGoogleMapsScrollingQuirk const):
(WebCore::Quirks::needsGoogleTranslateScrollingQuirk const):
(WebCore::Quirks::needsNetflixVolumeSliderQuirk const):
(WebCore::Quirks::needsGeforcenowWarningDisplayNoneQuirk const):
(WebCore::Quirks::needsYahooVolumeSliderQuirk const):
(WebCore::Quirks::shouldSilenceResizeObservers const):
(WebCore::Quirks::shouldSilenceWindowResizeEventsDuringApplicationSnapshotting
const):
(WebCore::Quirks::shouldDeferIntersectionObserversDuringResize const):
(WebCore::Quirks::shouldSilenceMediaQueryListChangeEvents const):
(WebCore::Quirks::shouldAvoidScrollingWhenFocusedContentIsVisible const):
(WebCore::Quirks::shouldUseLayoutViewportForClientRects const):
(WebCore::Quirks::shouldUseLegacySelectPopoverDismissalBehaviorInDataActivation
const):
(WebCore::Quirks::shouldIgnoreAriaForFastPathContentObservationCheck const):
(WebCore::Quirks::shouldIgnoreViewportArgumentsToAvoidExcessiveZoom const):
(WebCore::Quirks::shouldIgnoreViewportArgumentsToAvoidEnlargedView const):
(WebCore::Quirks::shouldUseDynamicViewportUnitsAsDefault const):
(WebCore::Quirks::needsPreloadAutoQuirk const):
(WebCore::Quirks::needsSuppressedPauseEventOnFullscreenExitQuirk const):
(WebCore::Quirks::shouldBypassBackForwardCache const):
(WebCore::Quirks::shouldBypassAsyncScriptDeferring const):
(WebCore::Quirks::shouldEnableFacebookFlagQuirk const):
(WebCore::Quirks::applyFacebookFlagQuirk):
(WebCore::Quirks::shouldEnableLegacyGetUserMediaQuirk const):
(WebCore::Quirks::shouldDisableImageCaptureQuirk const):
(WebCore::Quirks::shouldAllowMediaStreamTrackSerializationQuirk const):
(WebCore::Quirks::shouldEnableCameraAndMicrophonePermissionStateQuirk const):
(WebCore::Quirks::shouldEnableRemoteTrackLabelQuirk const):
(WebCore::Quirks::shouldEnableCameraBackgroundPlayback const):
(WebCore::Quirks::shouldEnableSpeakerSelectionPermissionsPolicyQuirk const):
(WebCore::Quirks::shouldEnableEnumerateDeviceQuirk const):
(WebCore::Quirks::shouldEnableRTCEncodedStreamsQuirk const):
(WebCore::Quirks::shouldAllowNotificationPermissionWithoutUserGesture const):
(WebCore::Quirks::shouldUnloadHeavyFrame const):
(WebCore::Quirks::needsCanPlayAfterSeekedQuirk const):
(WebCore::Quirks::shouldLayOutAtMinimumWindowWidthWhenIgnoringScalingConstraints
const):
(WebCore::Quirks::requiresUserGestureToPauseInPictureInPicture const):
(WebCore::Quirks::requiresUserGestureToPauseInFullscreenAfterOrientationChange
const):
(WebCore::Quirks::requiresUserGestureToPlayInFullscreen const):
(WebCore::Quirks::returnNullPictureInPictureElementDuringFullscreenChange
const):
(WebCore::Quirks::requiresUserGestureToLoadInPictureInPicture const):
(WebCore::Quirks::blocksReturnToFullscreenFromPictureInPictureQuirk const):
(WebCore::Quirks::blocksEnteringStandardFullscreenFromPictureInPictureQuirk
const):
(WebCore::Quirks::shouldDisableEndFullscreenEventWhenEnteringPictureInPictureFromFullscreenQuirk
const):
(WebCore::Quirks::allowLayeredFullscreenVideos const):
(WebCore::Quirks::shouldDisableFullscreenVideoAspectRatioAdaptiveSizing const):
(WebCore::Quirks::shouldEnableFontLoadingAPIQuirk const):
(WebCore::Quirks::shouldDisableAdSkippingInPip const):
(WebCore::Quirks::needsVideoShouldMaintainAspectRatioQuirk const):
(WebCore::Quirks::shouldExposeShowModalDialog const):
(WebCore::Quirks::shouldNavigatorPluginsBeEmpty const):
(WebCore::Quirks::shouldDisableLazyIframeLoadingQuirk const):
(WebCore::Quirks::shouldDisableMediaLayerTeardownOnPageVisibilityChangeQuirk
const):
(WebCore::Quirks::shouldDisableScrollAnchoringQuirk const):
(WebCore::Quirks::shouldDisableFetchMetadata const):
(WebCore::Quirks::shouldBlockFetchWithNewlineAndLessThan const):
(WebCore::Quirks::shouldDisablePushStateFilePathRestrictions const):
(WebCore::Quirks::needsResettingTransitionCancelsRunningTransitionQuirk const):
(WebCore::Quirks::shouldDisableDataURLPaddingValidation const):
(WebCore::Quirks::shouldPreventOrientationMediaQueryFromEvaluatingToLandscape
const):
(WebCore::Quirks::shouldFlipScreenDimensions const):
(WebCore::Quirks::shouldAvoidProgrammaticScrollClamping const):
(WebCore::Quirks::shouldIgnorePlaysInlineRequirementQuirk const):
(WebCore::Quirks::shouldIgnoreTextAutoSizing const):
(WebCore::Quirks::scriptsToEvaluateBeforeRunningScriptFromURL):
(WebCore::Quirks::shouldHideCoarsePointerCharacteristics const):
(WebCore::Quirks::implicitMuteWhenVolumeSetToZero const):
(WebCore::Quirks::shouldDispatchPointerOutAndLeaveAfterHandlingSyntheticClick
const):
(WebCore::Quirks::needsZeroMaxTouchPointsQuirk const):
(WebCore::Quirks::needsChromeMediaControlsPseudoElement const):
(WebCore::Quirks::shouldIgnoreContentObservationForClick const):
(WebCore::Quirks::shouldHideSoftTopScrollEdgeEffectDuringFocus const):
(WebCore::Quirks::shouldSynthesizeTouchEventsAfterNonSyntheticClick const):
(WebCore::Quirks::needsChromeOSNavigatorUserAgentQuirk const):
(WebCore::Quirks::shouldSendFakeTouchForceChangeEvent const):
(WebCore::Quirks::shouldTreatAddingMouseOutEventListenerAsContentChange const):
(WebCore::Quirks::needsMozillaFileTypeForDataTransfer const):
(WebCore::Quirks::shouldLimitHLSPlaybackRate const):
(WebCore::Quirks::shouldSuppressHLSSubtitles const):
(WebCore::Quirks::shouldBlockAudiblePlaybackWhileAudioIsPlaying const):
(WebCore::Quirks::shouldSuppressMediaSessionPauseActionOnInterruption const):
(WebCore::Quirks::shouldAvoidStartingSelectionOnMouseDownOverPointerCursor
const):
(WebCore::Quirks::shouldReuseLiveRangeForSelectionUpdate const):
(WebCore::Quirks::needsExpediaGroupAnimationQuirk const):
(WebCore::Quirks::needsClaudeSidebarViewportUnitQuirk const):
(WebCore::Quirks::needsHideSelectionDuringOverflowScrollQuirk const):
(WebCore::Quirks::needsAmazonDesignMenuViewportUnitQuirk const):
(WebCore::Quirks::needsLimitedMatroskaSupport const):
(WebCore::Quirks::needsSupportsProgressMonitoring const):
(WebCore::Quirks::clearLogoutSurvivingIdentityCookiesIfNeeded):
(WebCore::Quirks::needsCustomUserAgentData const):
(WebCore::Quirks::needsNavigatorUserAgentDataQuirk const):
(WebCore::Quirks::needsNowPlayingFullscreenSwapQuirk const):
(WebCore::Quirks::needsSuppressPostLayoutBoundaryEventsQuirk const):
(WebCore::Quirks::needsTikTokOverflowingContentQuirk const):
(WebCore::Quirks::needsInstagramResizingReelsQuirk const):
(WebCore::Quirks::needsWebKitMediaTextTrackDisplayQuirk const):
(WebCore::Quirks::shouldSupportHoverMediaQueries const):
(WebCore::Quirks::shouldRewriteMediaRangeRequestForURL const):
(WebCore::Quirks::shouldDisableThreadedAnimationsQuirk const):
(WebCore::Quirks::shouldEnterNativeFullscreenWhenCallingElementRequestFullscreenQuirk
const):
(WebCore::Quirks::shouldDelayReloadWhenRegisteringServiceWorker const):
(WebCore::Quirks::shouldDisableDOMAudioSessionQuirk const):
(WebCore::Quirks::shouldComparareUsedValuesForBorderWidthForTriggeringTransitions
const):
(WebCore::Quirks::shouldReportVisibleDueToActivePictureInPictureContent const):
(WebCore::Quirks::needsWebKitMediaKeysTransportStreamIsTypeSupportedQuirk
const):
(WebCore::Quirks::determineRelevantQuirks):
(WebCore::Quirks::activeQuirks const):
(WebCore::Quirks::hasRelevantQuirks const):
(WebCore::targetOrAncestorMatches): Deleted.
* Source/WebCore/page/Quirks.h:
(WebCore::Quirks::shouldAllowPopupFromMicrosoftOfficeToOneDrive const):
(WebCore::Quirks::isBehaviorEnabledAfterProbing const):
* Source/WebCore/page/QuirksData.h:
(WebCore::QuirksData::isBehaviorEnabled const):
(WebCore::QuirksData::hasBehaviors const):
(WebCore::QuirksData::behaviorsMatching):
(WebCore::QuirksData::addSite):
(WebCore::QuirksData::setEnabled):
(WebCore::QuirksData::addBehavior):
(WebCore::QuirksData::removeBehaviorsMatching):
(WebCore::QuirksData::merge):
(WebCore::QuirksData::hasEnabledBehaviors const): Deleted.
(WebCore::QuirksData::parametersFor const): Deleted.
(WebCore::QuirksData::applyTableRow): Deleted.
* Tools/TestWebKitAPI/Tests/WebCore/Quirks.cpp:
(TestWebKitAPI::TEST_F(QuirksTest, EmbeddedQuirksResolveFromTheDocumentURL)):
(TestWebKitAPI::TEST_F(QuirksTest, SiteSpecificQuirksResolveWithoutADocument)):
(TestWebKitAPI::scriptsForScriptURL):
(TestWebKitAPI::TEST_F(QuirksTest,
DocumentsWithoutAScriptQuirkGetNoParameters)):
(TestWebKitAPI::TEST_F(QuirksTest,
ParametersAreOnlyReturnedForTheBehaviorThatSuppliedThem)):
(TestWebKitAPI::TEST_F(QuirksTest,
OneQuirkCanCarryDifferentParametersForDifferentScriptURLs)):
(TestWebKitAPI::TEST_F(QuirksTest,
EveryMatchingRowContributesWhenSeveralSupplyTheSameBehavior)):
(TestWebKitAPI::elementSelectorsFor):
(TestWebKitAPI::TEST_F(QuirksTest,
AnElementSelectorConditionIsRecordedOnTheBehavior)):
(TestWebKitAPI::TEST_F(QuirksTest,
AScriptURLConditionTravelsWithTheParametersItScopes)):
(TestWebKitAPI::TEST_F(QuirksTest,
AddingAndRemovingBehaviorsKeepsTheEnabledFlagInSync)):
(TestWebKitAPI::TEST_F(QuirksTest,
MergeUnionsFlagsAndSitesAndConcatenatesBehaviors)):
(TestWebKitAPI::TEST_F(QuirksTest,
SitesThatOnlyNeedSimulatedMouseEventsOnSomeElementsCarryASelector)):
(TestWebKitAPI::TEST_F(QuirksTest,
SitesThatNeedSimulatedMouseEventsEverywhereCarryNoSelector)):
(TestWebKitAPI::matchesSelector):
(TestWebKitAPI::TEST_F(QuirksTest,
ATargetThatIsNotAnElementAndHasNoParentElementNeverMatches)):
(TestWebKitAPI::TEST_F(QuirksTest,
AnElementTargetIsMatchedAgainstTheSelectorItself)):
(TestWebKitAPI::TEST_F(QuirksTest,
DescendantsMatchOnlyBecauseTheSelectorReachesDownToThem)):
(TestWebKitAPI::TEST_F(QuirksTest, TextNodeTargetsResolveToTheirParentElement)):
(TestWebKitAPI::TEST_F(QuirksTest,
DetachedTargetsAreStillMatchedAgainstTheirOwnSubtree)):
(TestWebKitAPI::TEST_F(QuirksTest,
MixedCaseClassSelectorMatchesInEitherDocumentMode)):
(TestWebKitAPI::TEST_F(QuirksTest,
ConditionsSupportTheSelectorShapesAQuirkMightNeed)):
(TestWebKitAPI::TEST_F(QuirksTest, TheSameSelectorIsEvaluatedPerDocument)):
(TestWebKitAPI::TEST_F(QuirksTest, IsMicrosoftTeamsRedirectURL)):
Canonical link: https://commits.webkit.org/321257@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications