зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1833471 Part 2 - Export @page pseudo-class flags to Gecko style code r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D178869
This commit is contained in:
Родитель
a18b6d735d
Коммит
332fa4dc43
|
@ -2910,7 +2910,8 @@ nsContainerFrame* nsCSSFrameConstructor::ConstructPageFrame(
|
|||
"Page name from prev-in-flow should not have been null");
|
||||
}
|
||||
RefPtr<ComputedStyle> pageContentPseudoStyle =
|
||||
styleSet->ResolvePageContentStyle(pageName);
|
||||
styleSet->ResolvePageContentStyle(pageName,
|
||||
StylePagePseudoClassFlags::NONE);
|
||||
|
||||
nsContainerFrame* pageContentFrame = NS_NewPageContentFrame(
|
||||
aPresShell, pageContentPseudoStyle, pageName.forget());
|
||||
|
|
|
@ -419,7 +419,8 @@ void nsPageContentFrame::EnsurePageName() {
|
|||
return;
|
||||
}
|
||||
RefPtr<ComputedStyle> pageContentPseudoStyle =
|
||||
PresShell()->StyleSet()->ResolvePageContentStyle(mPageName);
|
||||
PresShell()->StyleSet()->ResolvePageContentStyle(
|
||||
mPageName, StylePagePseudoClassFlags::FIRST);
|
||||
SetComputedStyleWithoutNotification(pageContentPseudoStyle);
|
||||
}
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ ServoStyleSet::ResolveNonInheritingAnonymousBoxStyle(PseudoStyleType aType) {
|
|||
}
|
||||
|
||||
already_AddRefed<ComputedStyle> ServoStyleSet::ResolvePageContentStyle(
|
||||
const nsAtom* aPageName) {
|
||||
const nsAtom* aPageName, const StylePagePseudoClassFlags& aPseudo) {
|
||||
// The empty atom is used to indicate no specified page name, and is not
|
||||
// usable as a page-rule selector. Changing this to null is a slight
|
||||
// optimization to avoid the Servo code from doing an unnecessary hashtable
|
||||
|
@ -580,10 +580,12 @@ already_AddRefed<ComputedStyle> ServoStyleSet::ResolvePageContentStyle(
|
|||
if (aPageName == nsGkAtoms::_empty) {
|
||||
aPageName = nullptr;
|
||||
}
|
||||
// Only use the cache if we are not doing a lookup for a named page style.
|
||||
// Only use the cache when we are doing a lookup for page styles without a
|
||||
// page-name or any pseudo classes.
|
||||
const bool useCache = !aPageName && !aPseudo;
|
||||
RefPtr<ComputedStyle>& cache =
|
||||
mNonInheritingComputedStyles[nsCSSAnonBoxes::NonInheriting::pageContent];
|
||||
if (!aPageName && cache) {
|
||||
if (useCache && cache) {
|
||||
RefPtr<ComputedStyle> retval = cache;
|
||||
return retval.forget();
|
||||
}
|
||||
|
@ -591,12 +593,11 @@ already_AddRefed<ComputedStyle> ServoStyleSet::ResolvePageContentStyle(
|
|||
UpdateStylistIfNeeded();
|
||||
|
||||
RefPtr<ComputedStyle> computedValues =
|
||||
Servo_ComputedValues_GetForPageContent(mRawData.get(), aPageName,
|
||||
StylePagePseudoClassFlags::NONE)
|
||||
Servo_ComputedValues_GetForPageContent(mRawData.get(), aPageName, aPseudo)
|
||||
.Consume();
|
||||
MOZ_ASSERT(computedValues);
|
||||
|
||||
if (!aPageName) {
|
||||
if (useCache) {
|
||||
cache = computedValues;
|
||||
}
|
||||
return computedValues.forget();
|
||||
|
@ -686,7 +687,8 @@ StyleSheet* ServoStyleSet::SheetAt(Origin aOrigin, size_t aIndex) const {
|
|||
ServoStyleSet::FirstPageSizeAndOrientation
|
||||
ServoStyleSet::GetFirstPageSizeAndOrientation(const nsAtom* aFirstPageName) {
|
||||
FirstPageSizeAndOrientation retval;
|
||||
const RefPtr<ComputedStyle> style = ResolvePageContentStyle(aFirstPageName);
|
||||
const RefPtr<ComputedStyle> style =
|
||||
ResolvePageContentStyle(aFirstPageName, StylePagePseudoClassFlags::FIRST);
|
||||
const StylePageSize& pageSize = style->StylePage()->mSize;
|
||||
|
||||
if (pageSize.IsSize()) {
|
||||
|
|
|
@ -35,6 +35,7 @@ enum class StyleRuleChangeKind : uint32_t;
|
|||
|
||||
template <typename Integer, typename Number, typename LinearStops>
|
||||
struct StyleTimingFunction;
|
||||
struct StylePagePseudoClassFlags;
|
||||
struct StylePiecewiseLinearFunction;
|
||||
using StyleComputedTimingFunction =
|
||||
StyleTimingFunction<int32_t, float, StylePiecewiseLinearFunction>;
|
||||
|
@ -254,9 +255,10 @@ class ServoStyleSet {
|
|||
PseudoStyleType aType);
|
||||
|
||||
// Get a ComputedStyle for a pageContent box with the specified page-name.
|
||||
// A page name that is null or the empty atom gets the global page style.
|
||||
// A page name that is null or the empty atom and has no pseudo classes gets
|
||||
// the global page style.
|
||||
already_AddRefed<ComputedStyle> ResolvePageContentStyle(
|
||||
const nsAtom* aPageName);
|
||||
const nsAtom* aPageName, const StylePagePseudoClassFlags& aPseudo);
|
||||
|
||||
already_AddRefed<ComputedStyle> ResolveXULTreePseudoStyle(
|
||||
dom::Element* aParentElement, nsCSSAnonBoxPseudoStaticAtom* aPseudoTag,
|
||||
|
|
Загрузка…
Ссылка в новой задаче