Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 1417924

Browse files
committed
Bug 1430608: Make nsMediaFeatures work with a document, not a pres context. r=heycam
Returning a zero-sized viewport in the case there's no shell / pres context. For now, no other change yet. After this we can start tweaking the ShadowRoot Stylist setup, and even try to return computed styles without a document \o/. MozReview-Commit-ID: 3cT2PKQISri
1 parent 56cc5a0 commit 1417924

File tree

8 files changed

+188
-152
lines changed

8 files changed

+188
-152
lines changed

dom/base/nsIDocument.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,16 @@ class nsIDocument : public nsINode,
22152215
mIsBeingUsedAsImage = true;
22162216
}
22172217

2218+
bool IsSVGGlyphsDocument() const
2219+
{
2220+
return mIsSVGGlyphsDocument;
2221+
}
2222+
2223+
void SetIsSVGGlyphsDocument()
2224+
{
2225+
mIsSVGGlyphsDocument = true;
2226+
}
2227+
22182228
bool IsResourceDoc() const {
22192229
return IsBeingUsedAsImage() || // Are we a helper-doc for an SVG image?
22202230
mHasDisplayDocument; // Are we an external resource doc?
@@ -3542,6 +3552,9 @@ class nsIDocument : public nsINode,
35423552
// created.
35433553
bool mIsShadowDOMEnabled : 1;
35443554

3555+
// True if this document is for an SVG-in-OpenType font.
3556+
bool mIsSVGGlyphsDocument : 1;
3557+
35453558
// Whether <style scoped> support is enabled in this document.
35463559
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
35473560
unsigned int mIsScopedStyleEnabled : 2;

gfx/thebes/gfxSVGGlyphs.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,8 @@ gfxSVGGlyphsDocument::SetupPresentation()
157157
nsCOMPtr<nsIPresShell> presShell;
158158
rv = viewer->GetPresShell(getter_AddRefs(presShell));
159159
NS_ENSURE_SUCCESS(rv, rv);
160-
nsPresContext* presContext = presShell->GetPresContext();
161-
presContext->SetIsGlyph(true);
162-
163160
if (!presShell->DidInitialize()) {
164-
nsRect rect = presContext->GetVisibleArea();
161+
nsRect rect = presShell->GetPresContext()->GetVisibleArea();
165162
rv = presShell->Initialize(rect.Width(), rect.Height());
166163
NS_ENSURE_SUCCESS(rv, rv);
167164
}
@@ -395,6 +392,7 @@ gfxSVGGlyphsDocument::ParseDocument(const uint8_t *aBuffer, uint32_t aBufLen)
395392

396393
// Set this early because various decisions during page-load depend on it.
397394
document->SetIsBeingUsedAsImage();
395+
document->SetIsSVGGlyphsDocument();
398396
document->SetReadyStateInternal(nsIDocument::READYSTATE_UNINITIALIZED);
399397

400398
nsCOMPtr<nsIStreamListener> listener;

layout/base/nsPresContext.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,6 @@ class nsPresContext : public nsISupports,
11311131

11321132
void NotifyNonBlankPaint();
11331133

1134-
bool IsGlyph() const {
1135-
return mIsGlyph;
1136-
}
1137-
1138-
void SetIsGlyph(bool aValue) {
1139-
mIsGlyph = aValue;
1140-
}
1141-
11421134
bool UsesRootEMUnits() const {
11431135
return mUsesRootEMUnits;
11441136
}

0 commit comments

Comments
 (0)