summaryrefslogtreecommitdiffstats
path: root/layout/style/nsComputedDOMStyle.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /layout/style/nsComputedDOMStyle.cpp
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-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 'layout/style/nsComputedDOMStyle.cpp')
-rw-r--r--layout/style/nsComputedDOMStyle.cpp28
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