diff options
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 |