-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce StyleFontData to store the FontCascade object #22531
base: main
Are you sure you want to change the base?
Introduce StyleFontData to store the FontCascade object #22531
Conversation
EWS run on previous version of this PR (hash db653db) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with comments addressed.
db653db
to
2744fcf
Compare
EWS run on previous version of this PR (hash 2744fcf) |
return adoptRef(*new StyleFontData(*this)); | ||
} | ||
|
||
bool StyleFontData::operator==(const StyleFontData& o) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= default
?
2744fcf
to
a1376ed
Compare
EWS run on previous version of this PR (hash a1376ed) |
β¦changes https://bugs.webkit.org/show_bug.cgi?id=267423 rdar://120854167 Reviewed by Antti Koivisto. WebKit#22531 caused the TestWebKitAPI.WKWebViewThemeColor.KVO API test to break, when changing the to the `print` media type failed to cause a change of theme color when the theme meta tag had `media=screen`. That PR reduces the frequency of style diffs caused by FontCascade differences. In the API test, this results in a change to the `print` media type no longer triggering a layout on the (empty) document. Since the layout no longer occurs, we never hit `updateStyleForLayout()`, so don't end up calling `updateElementsAffectedByMediaQueries()`. Fix by calling `document.updateElementsAffectedByMediaQueries()` from `Page::updateStyleAfterChangeInEnvironment()`, and have `WebPage::setOverriddenMediaType()` call `updateStyleAfterChangeInEnvironment()` which seems like the right thing to do. * Source/WebCore/html/HTMLMetaElement.cpp: Whitespace. * Source/WebCore/page/LocalFrameViewLayoutContext.cpp: Whitespace. * Source/WebCore/page/Page.cpp: (WebCore::Page::updateStyleAfterChangeInEnvironment): * Source/WebCore/page/Page.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setOverriddenMediaType): Canonical link: https://commits.webkit.org/272947@main
a1376ed
to
8f8b49d
Compare
EWS run on previous version of this PR (hash 8f8b49d) |
β¦y changes https://bugs.webkit.org/show_bug.cgi?id=267564 rdar://121024996 Reviewed by Antoine Quint. On iOS with WebKit#22531, fast/attachment/attachment-dynamic-type.html fails, showing that fonts failed to update after we change `contentSizeCategory()` via Internals. When the content size category changes via the user setting it in the UI, we get notified via a `UIContentSizeCategoryDidChangeNotification` notification, and in response to this we call `FontCache::invalidateAllFontCaches()` (see `fontCacheRegisteredFontsChangedNotificationCallback()`). So we need to do the same when the content size category is changed through Internals. This caused webanimations/css-animation-effect-target-change-and-get-keyframes-crash.html to crash with a null m_target, so add a null check in `computeCSSAnimationBlendingKeyframes()`. * Source/WebCore/animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): * Source/WebCore/platform/graphics/cocoa/FontCacheCocoa.mm: (WebCore::setContentSizeCategory): * Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp: (WebCore::FontCache::platformInit): Canonical link: https://commits.webkit.org/273070@main
8f8b49d
to
bde6612
Compare
EWS run on previous version of this PR (hash bde6612) |
https://bugs.webkit.org/show_bug.cgi?id=267252 rdar://120688639 FontCascade::operator== shows up on profiles under RenderStyle::diff() in the Design subtest of MotionMark, which is animating the `color` property on many elements. `color` and `fontCascade` are both members of `StyleInheritedData`, so we end up copying and comparing `StyleInheritedData` a lot. But FontCascade is large (232 bytes) and expensive to compare, so we can optimize by moving it into its own ref-counted class that `StyleInheritedData` can own via a `DataRef`. This approach was chosen, rather than making `FontCascade` directly ref-counted, because it's used on the stack in various places. Now RenderStyle can test for `fontData` pointer equality in various places before doing more expensive checks. This reveals some cases where we fail to issue correct style invalidations; fast/css/ios/update-user-interface-level.html shows that we need to explicitly update the base view background color when "elevated user interface" mode changes, so do this via `Document::updateElementsAffectedBySystemColors()`. * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::updateElementsAffectedBySystemColors): (WebCore::Document::updateElementsAffectedByMediaQueries): * Source/WebCore/dom/Document.h: * Source/WebCore/page/Page.cpp: (WebCore::Page::appearanceDidChange): * Source/WebCore/rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::hashForTextAutosizing const): (WebCore::RenderStyle::equalForTextAutosizing const): (WebCore::RenderStyle::changeRequiresLayout const): (WebCore::RenderStyle::conservativelyCollectChangedAnimatableProperties const): (WebCore::RenderStyle::fontCascade const): (WebCore::RenderStyle::metricsOfPrimaryFont const): (WebCore::RenderStyle::fontDescription const): (WebCore::RenderStyle::setFontDescription): (WebCore::RenderStyle::setLetterSpacing): (WebCore::RenderStyle::setWordSpacing): * Source/WebCore/rendering/style/RenderStyleInlines.h: (WebCore::RenderStyle::letterSpacing const): (WebCore::RenderStyle::wordSpacing const): * Source/WebCore/rendering/style/StyleFontData.cpp: Added. (WebCore::StyleFontData::StyleFontData): (WebCore::StyleFontData::copy const): (WebCore::StyleFontData::operator== const): * Source/WebCore/rendering/style/StyleFontData.h: Added. (WebCore::StyleFontData::create): * Source/WebCore/rendering/style/StyleInheritedData.cpp: (WebCore::StyleInheritedData::StyleInheritedData): (WebCore::StyleInheritedData::nonFastPathInheritedEqual const): * Source/WebCore/rendering/style/StyleInheritedData.h:
bde6612
to
b965532
Compare
EWS run on current version of this PR (hash b965532) |
b965532
b965532