diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /layout/style/nsComputedDOMStyle.cpp | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | layout/style/nsComputedDOMStyle.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 3b25ff9726..d40d4bc801 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -733,6 +733,16 @@ static void CollectImageURLsForProperty(nsCSSPropertyID aProp, } } +float nsComputedDOMStyle::UsedFontSize() { + UpdateCurrentStyleSources(eCSSProperty_font_size); + + if (!mComputedStyle) { + return -1.0; + } + + return mComputedStyle->StyleFont()->mFont.size.ToCSSPixels(); +} + void nsComputedDOMStyle::GetCSSImageURLs(const nsACString& aPropertyName, nsTArray<nsCString>& aImageURLs, mozilla::ErrorResult& aRv) { @@ -990,6 +1000,19 @@ bool nsComputedDOMStyle::NeedsToFlushLayout(nsCSSPropertyID aPropID) const { } } +bool nsComputedDOMStyle::NeedsToFlushLayoutForContainerQuery() const { + const auto* outerFrame = GetOuterFrame(); + if (!outerFrame) { + return false; + } + const auto* innerFrame = nsLayoutUtils::GetStyleFrame(outerFrame); + MOZ_ASSERT(innerFrame, "No valid inner frame?"); + // It's possible that potential containers are styled but not yet reflowed, + // i.e. They don't have a correct size, which makes any container query + // evaluation against them invalid. + return innerFrame->HasUnreflowedContainerQueryAncestor(); +} + void nsComputedDOMStyle::Flush(Document& aDocument, FlushType aFlushType) { MOZ_ASSERT(mElement->IsInComposedDoc()); MOZ_ASSERT(mDocumentWeak == &aDocument); @@ -1051,8 +1074,9 @@ void nsComputedDOMStyle::UpdateCurrentStyleSources(nsCSSPropertyID aPropID) { Flush(*document, FlushType::Frames); } - if (NeedsToFlushLayout(aPropID)) { - MOZ_ASSERT(MayNeedToFlushLayout(aPropID)); + const bool needsToFlushLayoutForProp = NeedsToFlushLayout(aPropID); + if (needsToFlushLayoutForProp || NeedsToFlushLayoutForContainerQuery()) { + MOZ_ASSERT_IF(needsToFlushLayoutForProp, MayNeedToFlushLayout(aPropID)); didFlush = true; Flush(*document, FlushType::Layout); #ifdef DEBUG |