зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1447483: Merge nsStyleContext and ServoStyleContext, rename to ComputedStyle. r=jwatt
MozReview-Commit-ID: JPopq0LudD
This commit is contained in:
Родитель
30afff82d1
Коммит
ca5ac79cca
|
@ -17,8 +17,8 @@ using namespace mozilla::a11y;
|
|||
StyleInfo::StyleInfo(dom::Element* aElement) :
|
||||
mElement(aElement)
|
||||
{
|
||||
mStyleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
mComputedStyle =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -26,7 +26,7 @@ StyleInfo::Display(nsAString& aValue)
|
|||
{
|
||||
aValue.Truncate();
|
||||
AppendASCIItoUTF16(
|
||||
nsCSSProps::ValueToKeyword(mStyleContext->StyleDisplay()->mDisplay,
|
||||
nsCSSProps::ValueToKeyword(mComputedStyle->StyleDisplay()->mDisplay,
|
||||
nsCSSProps::kDisplayKTable), aValue);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ StyleInfo::TextAlign(nsAString& aValue)
|
|||
{
|
||||
aValue.Truncate();
|
||||
AppendASCIItoUTF16(
|
||||
nsCSSProps::ValueToKeyword(mStyleContext->StyleText()->mTextAlign,
|
||||
nsCSSProps::ValueToKeyword(mComputedStyle->StyleText()->mTextAlign,
|
||||
nsCSSProps::kTextAlignKTable), aValue);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ StyleInfo::TextIndent(nsAString& aValue)
|
|||
aValue.Truncate();
|
||||
|
||||
const nsStyleCoord& styleCoord =
|
||||
mStyleContext->StyleText()->mTextIndent;
|
||||
mComputedStyle->StyleText()->mTextIndent;
|
||||
|
||||
nscoord coordVal = 0;
|
||||
switch (styleCoord.GetUnit()) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define _mozilla_a11y_style_h_
|
||||
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
@ -39,7 +39,7 @@ private:
|
|||
void Margin(Side aSide, nsAString& aValue);
|
||||
|
||||
dom::Element* mElement;
|
||||
RefPtr<nsStyleContext> mStyleContext;
|
||||
RefPtr<ComputedStyle> mComputedStyle;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
|
@ -33,7 +34,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIPresShellInlines.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsStyleContextInlines.h"
|
||||
#include "nsTArray.h"
|
||||
#include "PendingAnimationTracker.h"
|
||||
|
||||
|
@ -167,14 +167,11 @@ FindAnimationsForCompositor(const nsIFrame* aFrame,
|
|||
Maybe<NonOwningAnimationTarget> pseudoElement =
|
||||
EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
|
||||
if (pseudoElement) {
|
||||
StyleBackendType backend =
|
||||
aFrame->StyleContext()->IsServo()
|
||||
? StyleBackendType::Servo
|
||||
: StyleBackendType::Gecko;
|
||||
StyleBackendType backend = StyleBackendType::Servo;
|
||||
EffectCompositor::MaybeUpdateCascadeResults(backend,
|
||||
pseudoElement->mElement,
|
||||
pseudoElement->mPseudoType,
|
||||
aFrame->StyleContext());
|
||||
aFrame->Style());
|
||||
}
|
||||
|
||||
if (!nsLayoutUtils::AreAsyncAnimationsEnabled()) {
|
||||
|
@ -550,7 +547,7 @@ EffectCompositor::ClearIsRunningOnCompositor(const nsIFrame *aFrame,
|
|||
EffectCompositor::MaybeUpdateCascadeResults(StyleBackendType aBackendType,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
|
||||
if (!effects || !effects->CascadeNeedsUpdate()) {
|
||||
|
@ -558,7 +555,7 @@ EffectCompositor::MaybeUpdateCascadeResults(StyleBackendType aBackendType,
|
|||
}
|
||||
|
||||
UpdateCascadeResults(aBackendType, *effects, aElement, aPseudoType,
|
||||
aStyleContext);
|
||||
aComputedStyle);
|
||||
|
||||
MOZ_ASSERT(!effects->CascadeNeedsUpdate(), "Failed to update cascade state");
|
||||
}
|
||||
|
@ -570,7 +567,7 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame)
|
|||
Maybe<NonOwningAnimationTarget> result;
|
||||
|
||||
CSSPseudoElementType pseudoType =
|
||||
aFrame->StyleContext()->GetPseudoType();
|
||||
aFrame->Style()->GetPseudoType();
|
||||
|
||||
if (pseudoType != CSSPseudoElementType::NotPseudo &&
|
||||
pseudoType != CSSPseudoElementType::before &&
|
||||
|
@ -606,7 +603,7 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
EffectSet& aEffectSet,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aBackendType != StyleBackendType::Servo || aElement,
|
||||
"Should have an element to get style data from if we are using"
|
||||
|
@ -615,7 +612,7 @@ EffectCompositor::GetOverriddenProperties(StyleBackendType aBackendType,
|
|||
nsCSSPropertyIDSet result;
|
||||
|
||||
Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
|
||||
if (aBackendType == StyleBackendType::Gecko && !aStyleContext) {
|
||||
if (aBackendType == StyleBackendType::Gecko && !aComputedStyle) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else if (aBackendType == StyleBackendType::Servo && !elementToRestyle) {
|
||||
return result;
|
||||
|
@ -667,7 +664,7 @@ EffectCompositor::UpdateCascadeResults(StyleBackendType aBackendType,
|
|||
EffectSet& aEffectSet,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(EffectSet::GetEffectSet(aElement, aPseudoType) == &aEffectSet,
|
||||
"Effect set should correspond to the specified (pseudo-)element");
|
||||
|
@ -692,7 +689,7 @@ EffectCompositor::UpdateCascadeResults(StyleBackendType aBackendType,
|
|||
GetOverriddenProperties(aBackendType,
|
||||
aEffectSet,
|
||||
aElement, aPseudoType,
|
||||
aStyleContext);
|
||||
aComputedStyle);
|
||||
|
||||
// Returns a bitset the represents which properties from
|
||||
// LayerAnimationInfo::sRecords are present in |aPropertySet|.
|
||||
|
@ -1032,7 +1029,7 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
|
|||
template
|
||||
void
|
||||
EffectCompositor::UpdateEffectProperties(
|
||||
const ServoStyleContext* aStyleContext,
|
||||
const ComputedStyle* aComputedStyle,
|
||||
Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ class nsCSSPropertyIDSet;
|
|||
class nsAtom;
|
||||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
class nsStyleContext;
|
||||
struct RawServoAnimationValueMap;
|
||||
typedef RawServoAnimationValueMap* RawServoAnimationValueMapBorrowedMut;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ComputedStyle;
|
||||
class EffectSet;
|
||||
class RestyleTracker;
|
||||
class StyleAnimationValue;
|
||||
|
@ -153,12 +153,12 @@ public:
|
|||
// the change in the set of effects or a change in one of the effects'
|
||||
// "in effect" state.
|
||||
//
|
||||
// When |aBackendType| is StyleBackendType::Gecko, |aStyleContext| is used to
|
||||
// find overridden properties. If it is nullptr, the nsStyleContext of the
|
||||
// When |aBackendType| is StyleBackendType::Gecko, |aComputedStyle| is used to
|
||||
// find overridden properties. If it is nullptr, the ComputedStyle of the
|
||||
// primary frame of the specified (pseudo-)element, if available, is used.
|
||||
//
|
||||
// When |aBackendType| is StyleBackendType::Servo, we fetch the rule node
|
||||
// from the |aElement| (i.e. |aStyleContext| is ignored).
|
||||
// from the |aElement| (i.e. |aComputedStyle| is ignored).
|
||||
//
|
||||
// This method does NOT detect if other styles that apply above the
|
||||
// animation level of the cascade have changed.
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
MaybeUpdateCascadeResults(StyleBackendType aBackendType,
|
||||
dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// Update the mPropertiesWithImportantRules and
|
||||
// mPropertiesForAnimationsLevel members of the given EffectSet, and also
|
||||
|
@ -181,7 +181,7 @@ public:
|
|||
// MarkCascadeNeedsUpdate during the traversal so instead we call this as part
|
||||
// of a follow-up sequential task.
|
||||
//
|
||||
// As with MaybeUpdateCascadeResults, |aStyleContext| is only used
|
||||
// As with MaybeUpdateCascadeResults, |aComputedStyle| is only used
|
||||
// when |aBackendType| is StyleBackendType::Gecko. When |aBackendType| is
|
||||
// StyleBackendType::Servo, it is ignored.
|
||||
static void
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
EffectSet& aEffectSet,
|
||||
dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// Helper to fetch the corresponding element and pseudo-type from a frame.
|
||||
//
|
||||
|
@ -242,8 +242,8 @@ private:
|
|||
// than the animations level.
|
||||
//
|
||||
// When |aBackendType| is StyleBackendType::Gecko, we determine which
|
||||
// properties are specified using the provided |aStyleContext| and
|
||||
// |aElement| and |aPseudoType| are ignored. If |aStyleContext| is nullptr,
|
||||
// properties are specified using the provided |aComputedStyle| and
|
||||
// |aElement| and |aPseudoType| are ignored. If |aComputedStyle| is nullptr,
|
||||
// we automatically look up the style context of primary frame of the
|
||||
// (pseudo-)element.
|
||||
//
|
||||
|
@ -254,7 +254,7 @@ private:
|
|||
EffectSet& aEffectSet,
|
||||
dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
static nsPresContext* GetPresContext(dom::Element* aElement);
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
#include "mozilla/dom/KeyframeEffect.h"
|
||||
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
|
||||
// For UnrestrictedDoubleOrKeyframeAnimationOptions
|
||||
#include "mozilla/dom/AnimationEffectTiming.h"
|
||||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "nsDocument.h" // For nsDocument::IsWebAnimationsEnabled
|
||||
#include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch
|
||||
#include "nsStyleContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -110,7 +110,7 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
|||
|
||||
if (mTarget) {
|
||||
UpdateTargetRegistration();
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
RefPtr<ComputedStyle> styleContext = GetTargetComputedStyle();
|
||||
if (styleContext) {
|
||||
UpdateProperties(styleContext);
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ KeyframeEffect::SetComposite(const CompositeOperation& aComposite)
|
|||
}
|
||||
|
||||
if (mTarget) {
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
RefPtr<ComputedStyle> styleContext = GetTargetComputedStyle();
|
||||
if (styleContext) {
|
||||
UpdateProperties(styleContext);
|
||||
}
|
||||
|
|
|
@ -65,11 +65,11 @@ public:
|
|||
|
||||
void NotifySpecifiedTimingUpdated();
|
||||
|
||||
// This method calls GetTargetStyleContext which is not safe to use when
|
||||
// This method calls GetTargetComputedStyle which is not safe to use when
|
||||
// we are in the middle of updating style. If we need to use this when
|
||||
// updating style, we should pass the nsStyleContext into this method and use
|
||||
// updating style, we should pass the ComputedStyle into this method and use
|
||||
// that to update the properties rather than calling
|
||||
// GetStyleContext.
|
||||
// GetComputedStyle.
|
||||
void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
|
||||
|
||||
IterationCompositeOperation IterationComposite(CallerType aCallerType)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/dom/KeyframeEffectBinding.h"
|
||||
#include "mozilla/AnimationUtils.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/FloatingPoint.h" // For IsFinite
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
|
@ -22,7 +23,7 @@
|
|||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "Layers.h" // For Layer
|
||||
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContext
|
||||
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetComputedStyle
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSPropertyIDSet.h"
|
||||
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
|
||||
|
@ -32,7 +33,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
#include "nsStyleContextInlines.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -190,17 +190,13 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> styleContext = GetTargetStyleContext();
|
||||
if (styleContext) {
|
||||
if (styleContext->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
} else {
|
||||
SetKeyframes(Move(keyframes), styleContext->AsServo());
|
||||
}
|
||||
RefPtr<ComputedStyle> style = GetTargetComputedStyle();
|
||||
if (style) {
|
||||
SetKeyframes(Move(keyframes), style);
|
||||
} else {
|
||||
// SetKeyframes has the same behavior for null StyleType* for
|
||||
// both backends, just pick one and use it.
|
||||
SetKeyframes(Move(keyframes), (ServoStyleContext*) nullptr);
|
||||
SetKeyframes(Move(keyframes), (ComputedStyle*) nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +204,7 @@ KeyframeEffectReadOnly::SetKeyframes(JSContext* aContext,
|
|||
void
|
||||
KeyframeEffectReadOnly::SetKeyframes(
|
||||
nsTArray<Keyframe>&& aKeyframes,
|
||||
const ServoStyleContext* aComputedValues)
|
||||
const ComputedStyle* aComputedValues)
|
||||
{
|
||||
DoSetKeyframes(Move(aKeyframes), aComputedValues);
|
||||
}
|
||||
|
@ -297,22 +293,9 @@ SpecifiedKeyframeArraysAreEqual(const nsTArray<Keyframe>& aA,
|
|||
#endif
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::UpdateProperties(nsStyleContext* aStyleContext)
|
||||
KeyframeEffectReadOnly::UpdateProperties(const ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aStyleContext);
|
||||
|
||||
if (aStyleContext->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
UpdateProperties(aStyleContext->AsServo());
|
||||
}
|
||||
|
||||
void
|
||||
KeyframeEffectReadOnly::UpdateProperties(
|
||||
const ServoStyleContext* aStyleContext)
|
||||
{
|
||||
DoUpdateProperties(aStyleContext);
|
||||
DoUpdateProperties(aComputedStyle);
|
||||
}
|
||||
|
||||
template<typename StyleType>
|
||||
|
@ -323,7 +306,7 @@ KeyframeEffectReadOnly::DoUpdateProperties(StyleType* aStyle)
|
|||
|
||||
// Skip updating properties when we are composing style.
|
||||
// FIXME: Bug 1324966. Drop this check once we have a function to get
|
||||
// nsStyleContext without resolving animating style.
|
||||
// ComputedStyle without resolving animating style.
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mIsComposingStyle,
|
||||
"Should not be called while processing ComposeStyle()");
|
||||
if (mIsComposingStyle) {
|
||||
|
@ -367,7 +350,7 @@ KeyframeEffectReadOnly::DoUpdateProperties(StyleType* aStyle)
|
|||
|
||||
void
|
||||
KeyframeEffectReadOnly::EnsureBaseStyles(
|
||||
const ServoStyleContext* aComputedValues,
|
||||
const ComputedStyle* aComputedValues,
|
||||
const nsTArray<AnimationProperty>& aProperties)
|
||||
{
|
||||
if (!mTarget) {
|
||||
|
@ -392,12 +375,12 @@ KeyframeEffectReadOnly::EnsureBaseStyles(
|
|||
" we should have also failed to calculate the computed values"
|
||||
" passed-in as aProperties");
|
||||
|
||||
RefPtr<ServoStyleContext> baseStyleContext;
|
||||
RefPtr<ComputedStyle> baseComputedStyle;
|
||||
for (const AnimationProperty& property : aProperties) {
|
||||
EnsureBaseStyle(property,
|
||||
presContext,
|
||||
aComputedValues,
|
||||
baseStyleContext);
|
||||
baseComputedStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,8 +388,8 @@ void
|
|||
KeyframeEffectReadOnly::EnsureBaseStyle(
|
||||
const AnimationProperty& aProperty,
|
||||
nsPresContext* aPresContext,
|
||||
const ServoStyleContext* aComputedStyle,
|
||||
RefPtr<ServoStyleContext>& aBaseStyleContext)
|
||||
const ComputedStyle* aComputedStyle,
|
||||
RefPtr<ComputedStyle>& aBaseComputedStyle)
|
||||
{
|
||||
bool hasAdditiveValues = false;
|
||||
|
||||
|
@ -421,18 +404,18 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
|
|||
return;
|
||||
}
|
||||
|
||||
if (!aBaseStyleContext) {
|
||||
if (!aBaseComputedStyle) {
|
||||
Element* animatingElement =
|
||||
EffectCompositor::GetElementToRestyle(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
aBaseStyleContext =
|
||||
aBaseComputedStyle =
|
||||
aPresContext->StyleSet()->AsServo()->GetBaseContextForElement(
|
||||
animatingElement,
|
||||
aPresContext,
|
||||
aComputedStyle);
|
||||
}
|
||||
RefPtr<RawServoAnimationValue> baseValue =
|
||||
Servo_ComputedValues_ExtractAnimationValue(aBaseStyleContext,
|
||||
Servo_ComputedValues_ExtractAnimationValue(aBaseComputedStyle,
|
||||
aProperty.mProperty).Consume();
|
||||
mBaseStyleValuesForServo.Put(aProperty.mProperty, baseValue);
|
||||
}
|
||||
|
@ -839,8 +822,8 @@ KeyframeEffectReadOnly::RequestRestyle(
|
|||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::GetTargetStyleContext()
|
||||
already_AddRefed<ComputedStyle>
|
||||
KeyframeEffectReadOnly::GetTargetComputedStyle()
|
||||
{
|
||||
if (!GetRenderedDocument()) {
|
||||
return nullptr;
|
||||
|
@ -853,7 +836,7 @@ KeyframeEffectReadOnly::GetTargetStyleContext()
|
|||
? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
|
||||
: nullptr;
|
||||
|
||||
return nsComputedDOMStyle::GetStyleContext(mTarget->mElement, pseudo);
|
||||
return nsComputedDOMStyle::GetComputedStyle(mTarget->mElement, pseudo);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1040,7 +1023,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
|||
// be consistent with Gecko, we just expand the variables (assuming we have
|
||||
// enough context to do so). For that we need to grab the style context so we
|
||||
// know what custom property values to provide.
|
||||
RefPtr<nsStyleContext> styleContext;
|
||||
RefPtr<ComputedStyle> styleContext;
|
||||
if (isServo && isCSSAnimation) {
|
||||
// The following will flush style but that's ok since if you update
|
||||
// a variable's computed value, you expect to see that updated value in the
|
||||
|
@ -1050,7 +1033,7 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
|||
// we might end up returning variables as-is or empty string. That should be
|
||||
// acceptable however, since such a case is rare and this is only
|
||||
// short-term (and unshipped) behavior until bug 1391537 is fixed.
|
||||
styleContext = GetTargetStyleContext();
|
||||
styleContext = GetTargetComputedStyle();
|
||||
}
|
||||
|
||||
for (const Keyframe& keyframe : mKeyframes) {
|
||||
|
@ -1102,13 +1085,13 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
|||
continue;
|
||||
}
|
||||
if (propertyValue.mServoDeclarationBlock) {
|
||||
const ServoStyleContext* servoStyleContext =
|
||||
const ComputedStyle* servoComputedStyle =
|
||||
styleContext ? styleContext->AsServo() : nullptr;
|
||||
Servo_DeclarationBlock_SerializeOneValue(
|
||||
propertyValue.mServoDeclarationBlock,
|
||||
propertyValue.mProperty,
|
||||
&stringValue,
|
||||
servoStyleContext,
|
||||
servoComputedStyle,
|
||||
customProperties);
|
||||
} else {
|
||||
RawServoAnimationValue* value =
|
||||
|
@ -1503,30 +1486,30 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
|||
}
|
||||
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
KeyframeEffectReadOnly::CreateStyleContextForAnimationValue(
|
||||
already_AddRefed<ComputedStyle>
|
||||
KeyframeEffectReadOnly::CreateComputedStyleForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationValue& aValue,
|
||||
const ServoStyleContext* aBaseStyleContext)
|
||||
const ComputedStyle* aBaseComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aBaseStyleContext,
|
||||
"CreateStyleContextForAnimationValue needs to be called "
|
||||
"with a valid ServoStyleContext");
|
||||
MOZ_ASSERT(aBaseComputedStyle,
|
||||
"CreateComputedStyleForAnimationValue needs to be called "
|
||||
"with a valid ComputedStyle");
|
||||
|
||||
ServoStyleSet* styleSet =
|
||||
aBaseStyleContext->PresContext()->StyleSet()->AsServo();
|
||||
aBaseComputedStyle->PresContext()->StyleSet()->AsServo();
|
||||
Element* elementForResolve =
|
||||
EffectCompositor::GetElementToRestyle(mTarget->mElement,
|
||||
mTarget->mPseudoType);
|
||||
MOZ_ASSERT(elementForResolve, "The target element shouldn't be null");
|
||||
return styleSet->ResolveServoStyleByAddingAnimation(elementForResolve,
|
||||
aBaseStyleContext,
|
||||
aBaseComputedStyle,
|
||||
aValue.mServo);
|
||||
}
|
||||
|
||||
template<typename StyleType>
|
||||
void
|
||||
KeyframeEffectReadOnly::CalculateCumulativeChangeHint(StyleType* aStyleContext)
|
||||
KeyframeEffectReadOnly::CalculateCumulativeChangeHint(StyleType* aComputedStyle)
|
||||
{
|
||||
mCumulativeChangeHint = nsChangeHint(0);
|
||||
|
||||
|
@ -1549,19 +1532,19 @@ KeyframeEffectReadOnly::CalculateCumulativeChangeHint(StyleType* aStyleContext)
|
|||
mCumulativeChangeHint = ~nsChangeHint_Hints_CanIgnoreIfNotVisible;
|
||||
return;
|
||||
}
|
||||
RefPtr<nsStyleContext> fromContext =
|
||||
CreateStyleContextForAnimationValue(property.mProperty,
|
||||
RefPtr<ComputedStyle> fromContext =
|
||||
CreateComputedStyleForAnimationValue(property.mProperty,
|
||||
segment.mFromValue,
|
||||
aStyleContext);
|
||||
aComputedStyle);
|
||||
if (!fromContext) {
|
||||
mCumulativeChangeHint = ~nsChangeHint_Hints_CanIgnoreIfNotVisible;
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> toContext =
|
||||
CreateStyleContextForAnimationValue(property.mProperty,
|
||||
RefPtr<ComputedStyle> toContext =
|
||||
CreateComputedStyleForAnimationValue(property.mProperty,
|
||||
segment.mToValue,
|
||||
aStyleContext);
|
||||
aComputedStyle);
|
||||
if (!toContext) {
|
||||
mCumulativeChangeHint = ~nsChangeHint_Hints_CanIgnoreIfNotVisible;
|
||||
return;
|
||||
|
|
|
@ -45,8 +45,8 @@ class ErrorResult;
|
|||
struct AnimationRule;
|
||||
struct TimingParams;
|
||||
class EffectSet;
|
||||
class ServoStyleContext;
|
||||
class GeckoStyleContext;
|
||||
class ComputedStyle;
|
||||
class GeckoComputedStyle;
|
||||
|
||||
namespace dom {
|
||||
class ElementOrCSSPseudoElement;
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
void SetKeyframes(JSContext* aContext, JS::Handle<JSObject*> aKeyframes,
|
||||
ErrorResult& aRv);
|
||||
void SetKeyframes(nsTArray<Keyframe>&& aKeyframes,
|
||||
const ServoStyleContext* aComputedValues);
|
||||
const ComputedStyle* aComputedValues);
|
||||
|
||||
// Returns true if the effect includes |aProperty| regardless of whether the
|
||||
// property is overridden by !important rule.
|
||||
|
@ -192,10 +192,8 @@ public:
|
|||
}
|
||||
|
||||
// Update |mProperties| by recalculating from |mKeyframes| using
|
||||
// |aStyleContext| to resolve specified values.
|
||||
void UpdateProperties(nsStyleContext* aStyleContext);
|
||||
// Servo version of the above function.
|
||||
void UpdateProperties(const ServoStyleContext* aComputedValues);
|
||||
// |aComputedStyle| to resolve specified values.
|
||||
void UpdateProperties(const ComputedStyle* aComputedValues);
|
||||
|
||||
// Update various bits of state related to running ComposeStyle().
|
||||
// We need to update this outside ComposeStyle() because we should avoid
|
||||
|
@ -247,7 +245,7 @@ public:
|
|||
// Cumulative change hint on each segment for each property.
|
||||
// This is used for deciding the animation is paint-only.
|
||||
template<typename StyleType>
|
||||
void CalculateCumulativeChangeHint(StyleType* aStyleContext);
|
||||
void CalculateCumulativeChangeHint(StyleType* aComputedStyle);
|
||||
|
||||
// Returns true if all of animation properties' change hints
|
||||
// can ignore painting if the animation is not visible.
|
||||
|
@ -300,7 +298,7 @@ protected:
|
|||
KeyframeEffectReadOnly& aSource,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// Build properties by recalculating from |mKeyframes| using |aStyleContext|
|
||||
// Build properties by recalculating from |mKeyframes| using |aComputedStyle|
|
||||
// to resolve specified values. This function also applies paced spacing if
|
||||
// needed.
|
||||
template<typename StyleType>
|
||||
|
@ -328,24 +326,24 @@ protected:
|
|||
|
||||
// Looks up the style context associated with the target element, if any.
|
||||
// We need to be careful to *not* call this when we are updating the style
|
||||
// context. That's because calling GetStyleContext when we are in the process
|
||||
// context. That's because calling GetComputedStyle when we are in the process
|
||||
// of building a style context may trigger various forms of infinite
|
||||
// recursion.
|
||||
already_AddRefed<nsStyleContext> GetTargetStyleContext();
|
||||
already_AddRefed<ComputedStyle> GetTargetComputedStyle();
|
||||
|
||||
// A wrapper for marking cascade update according to the current
|
||||
// target and its effectSet.
|
||||
void MarkCascadeNeedsUpdate();
|
||||
|
||||
void EnsureBaseStyles(const ServoStyleContext* aComputedValues,
|
||||
void EnsureBaseStyles(const ComputedStyle* aComputedValues,
|
||||
const nsTArray<AnimationProperty>& aProperties);
|
||||
|
||||
// Stylo version of the above function that also first checks for an additive
|
||||
// value in |aProperty|'s list of segments.
|
||||
void EnsureBaseStyle(const AnimationProperty& aProperty,
|
||||
nsPresContext* aPresContext,
|
||||
const ServoStyleContext* aComputedValues,
|
||||
RefPtr<mozilla::ServoStyleContext>& aBaseComputedValues);
|
||||
const ComputedStyle* aComputedValues,
|
||||
RefPtr<ComputedStyle>& aBaseComputedValues);
|
||||
|
||||
Maybe<OwningAnimationTarget> mTarget;
|
||||
|
||||
|
@ -398,10 +396,10 @@ private:
|
|||
const ComputedTiming& aComputedTiming);
|
||||
|
||||
|
||||
already_AddRefed<nsStyleContext> CreateStyleContextForAnimationValue(
|
||||
already_AddRefed<ComputedStyle> CreateComputedStyleForAnimationValue(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationValue& aValue,
|
||||
const ServoStyleContext* aBaseStyleContext);
|
||||
const ComputedStyle* aBaseComputedStyle);
|
||||
|
||||
nsIFrame* GetAnimationFrame() const;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/RangedArray.h"
|
||||
|
@ -28,7 +29,6 @@
|
|||
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
|
||||
#include "nsDocument.h" // For nsDocument::IsWebAnimationsEnabled
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsTArray.h"
|
||||
#include <algorithm> // For std::stable_sort, std::min
|
||||
|
||||
|
@ -370,7 +370,7 @@ MarkAsComputeValuesFailureKey(PropertyValuePair& aPair);
|
|||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
const ServoStyleContext* aComputedValues);
|
||||
const ComputedStyle* aComputedValues);
|
||||
|
||||
static void
|
||||
BuildSegmentsFromValueEntries(nsTArray<KeyframeValueEntry>& aEntries,
|
||||
|
@ -945,7 +945,7 @@ MarkAsComputeValuesFailureKey(PropertyValuePair& aPair)
|
|||
static nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
const ServoStyleContext* aStyleContext)
|
||||
const ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
MOZ_ASSERT(aElement->IsStyledByServo());
|
||||
|
@ -962,7 +962,7 @@ GetComputedKeyframeValues(const nsTArray<Keyframe>& aKeyframes,
|
|||
}
|
||||
|
||||
result = presContext->StyleSet()->AsServo()
|
||||
->GetComputedKeyframeValuesFor(aKeyframes, aElement, aStyleContext);
|
||||
->GetComputedKeyframeValuesFor(aKeyframes, aElement, aComputedStyle);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1533,7 +1533,7 @@ nsTArray<AnimationProperty>
|
|||
KeyframeUtils::GetAnimationPropertiesFromKeyframes(
|
||||
const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
const ServoStyleContext* aStyle,
|
||||
const ComputedStyle* aStyle,
|
||||
dom::CompositeOperation aEffectComposite);
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
struct JSContext;
|
||||
class JSObject;
|
||||
class nsIDocument;
|
||||
class nsStyleContext;
|
||||
class ComputedStyle;
|
||||
struct RawServoDeclarationBlock;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
*
|
||||
* @param aKeyframes The input keyframes.
|
||||
* @param aElement The context element.
|
||||
* @param aStyleType The |ServoStyleContext| or |GeckoStyleContext| to use
|
||||
* @param aStyleType The |ComputedStyle| or |GeckoComputedStyle| to use
|
||||
* when computing values.
|
||||
* @param aEffectComposite The composite operation specified on the effect.
|
||||
* For any keyframes in |aKeyframes| that do not specify a composite
|
||||
|
|
|
@ -544,8 +544,8 @@ Element::GetBindingURL(nsIDocument *aDocument, css::URLValue **aResult)
|
|||
}
|
||||
|
||||
// Get the computed -moz-binding directly from the style context
|
||||
RefPtr<nsStyleContext> sc =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr);
|
||||
RefPtr<ComputedStyle> sc =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
|
||||
NS_ENSURE_TRUE(sc, false);
|
||||
|
||||
NS_IF_ADDREF(*aResult = sc->StyleDisplay()->mBinding);
|
||||
|
@ -1505,8 +1505,8 @@ Element::GetElementsWithGrid(nsTArray<RefPtr<Element>>& aElements)
|
|||
// generate a nsGridContainerFrame during layout.
|
||||
auto IsDisplayGrid = [](Element* aElement) -> bool
|
||||
{
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContext(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyle(aElement, nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleDisplay* display = styleContext->StyleDisplay();
|
||||
return (display->mDisplay == StyleDisplay::Grid ||
|
||||
|
@ -4385,7 +4385,7 @@ Element::AddSizeOfExcludingThis(nsWindowSizes& aSizes, size_t* aNodeSize) const
|
|||
|
||||
// Now measure just the ComputedValues (and style structs) under
|
||||
// mServoData. This counts towards the relevant fields in |aSizes|.
|
||||
RefPtr<ServoStyleContext> sc;
|
||||
RefPtr<ComputedStyle> sc;
|
||||
if (Servo_Element_HasPrimaryComputedValues(this)) {
|
||||
sc = Servo_Element_GetPrimaryComputedValues(this).Consume();
|
||||
if (!aSizes.mState.HaveSeenPtr(sc.get())) {
|
||||
|
|
|
@ -2726,8 +2726,8 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContext(element, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyle(element, nullptr);
|
||||
*aResult = v1.ComputeDistance(property, v2, styleContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2824,13 +2824,12 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
}
|
||||
|
||||
RefPtr<nsAtom> pseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElement);
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetUnanimatedStyleContextNoFlush(element, pseudo);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(element, pseudo);
|
||||
if (!styleContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (styleContext->IsServo()) {
|
||||
RefPtr<RawServoAnimationValue> value =
|
||||
Servo_ComputedValues_ExtractAnimationValue(styleContext->AsServo(),
|
||||
propertyID).Consume();
|
||||
|
@ -2839,9 +2838,6 @@ nsDOMWindowUtils::GetUnanimatedComputedStyle(nsIDOMElement* aElement,
|
|||
}
|
||||
Servo_AnimationValue_Serialize(value, propertyID, &aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -1851,8 +1851,8 @@ nsPlainTextSerializer::IsInPre()
|
|||
bool
|
||||
nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
|
||||
{
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleText* textStyle = styleContext->StyleText();
|
||||
return textStyle->WhiteSpaceOrNewlineIsSignificant();
|
||||
|
@ -1864,8 +1864,8 @@ nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
|
|||
bool
|
||||
nsPlainTextSerializer::IsElementBlock(Element* aElement)
|
||||
{
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleDisplay* displayStyle = styleContext->StyleDisplay();
|
||||
return displayStyle->IsBlockOutsideStyle();
|
||||
|
|
|
@ -3741,8 +3741,8 @@ ElementIsVisibleNoFlush(Element* aElement)
|
|||
if (!aElement) {
|
||||
return false;
|
||||
}
|
||||
RefPtr<nsStyleContext> sc =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> sc =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
return sc && sc->StyleVisibility()->IsVisible();
|
||||
}
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ CollectWindowReports(nsGlobalWindowInner *aWindow,
|
|||
REPORT_SIZE("/layout/rule-nodes", mArenaSizes.mRuleNodes,
|
||||
"Memory used by CSS rule nodes within a window.");
|
||||
|
||||
REPORT_SIZE("/layout/style-contexts", mArenaSizes.mStyleContexts,
|
||||
REPORT_SIZE("/layout/style-contexts", mArenaSizes.mComputedStyles,
|
||||
"Memory used by style contexts within a window.");
|
||||
|
||||
// There are many different kinds of style structs, but it is likely that
|
||||
|
@ -708,7 +708,7 @@ nsWindowMemoryReporter::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||
"This is the sum of all windows' 'layout/rule-nodes' numbers.");
|
||||
|
||||
REPORT("window-objects/layout/style-contexts",
|
||||
windowTotalSizes.mArenaSizes.mStyleContexts,
|
||||
windowTotalSizes.mArenaSizes.mComputedStyles,
|
||||
"This is the sum of all windows' 'layout/style-contexts' numbers.");
|
||||
|
||||
size_t geckoStyleTotal = 0;
|
||||
|
|
|
@ -103,7 +103,7 @@ struct nsArenaSizes {
|
|||
#define FOR_EACH_SIZE(macro) \
|
||||
macro(Other, mLineBoxes) \
|
||||
macro(Style, mRuleNodes) \
|
||||
macro(Style, mStyleContexts)
|
||||
macro(Style, mComputedStyles)
|
||||
|
||||
nsArenaSizes()
|
||||
:
|
||||
|
|
|
@ -720,8 +720,8 @@ nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
|
|||
if (!aNode->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aNode->AsElement(), nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aNode->AsElement(), nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleText* textStyle = styleContext->StyleText();
|
||||
return textStyle->WhiteSpaceOrNewlineIsSignificant();
|
||||
|
|
|
@ -1175,8 +1175,8 @@ CanvasRenderingContext2D::ParseColor(const nsAString& aString,
|
|||
if (wasCurrentColor && mCanvasElement) {
|
||||
// Otherwise, get the value of the color property, flushing style
|
||||
// if necessary.
|
||||
RefPtr<nsStyleContext> canvasStyle =
|
||||
nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr);
|
||||
RefPtr<ComputedStyle> canvasStyle =
|
||||
nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
|
||||
if (canvasStyle) {
|
||||
*aColor = canvasStyle->StyleColor()->mColor;
|
||||
}
|
||||
|
@ -1955,8 +1955,8 @@ CanvasRenderingContext2D::ClearTarget()
|
|||
|
||||
// For vertical writing-mode, unless text-orientation is sideways,
|
||||
// we'll modify the initial value of textBaseline to 'middle'.
|
||||
RefPtr<nsStyleContext> canvasStyle =
|
||||
nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr);
|
||||
RefPtr<ComputedStyle> canvasStyle =
|
||||
nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
|
||||
if (canvasStyle) {
|
||||
WritingMode wm(canvasStyle);
|
||||
if (wm.IsVertical() && !wm.IsSideways()) {
|
||||
|
@ -2683,7 +2683,7 @@ CreateFontDeclarationForServo(const nsAString& aFont,
|
|||
return CreateDeclarationForServo(eCSSProperty_font, aFont, aDocument);
|
||||
}
|
||||
|
||||
static already_AddRefed<ServoStyleContext>
|
||||
static already_AddRefed<ComputedStyle>
|
||||
GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
||||
nsIPresShell* aPresShell,
|
||||
nsAString& aOutUsedFont,
|
||||
|
@ -2708,11 +2708,11 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
|||
|
||||
ServoStyleSet* styleSet = aPresShell->StyleSet()->AsServo();
|
||||
|
||||
RefPtr<nsStyleContext> parentStyle;
|
||||
RefPtr<ComputedStyle> parentStyle;
|
||||
// have to get a parent style context for inherit-like relative
|
||||
// values (2em, bolder, etc.)
|
||||
if (aElement && aElement->IsInComposedDoc()) {
|
||||
parentStyle = nsComputedDOMStyle::GetStyleContext(aElement, nullptr);
|
||||
parentStyle = nsComputedDOMStyle::GetComputedStyle(aElement, nullptr);
|
||||
if (!parentStyle) {
|
||||
// The flush killed the shell, so we couldn't get any meaningful style
|
||||
// back.
|
||||
|
@ -2735,7 +2735,7 @@ GetFontStyleForServo(Element* aElement, const nsAString& aFont,
|
|||
"We should have returned an error above if the presshell is "
|
||||
"being destroyed.");
|
||||
|
||||
RefPtr<ServoStyleContext> sc =
|
||||
RefPtr<ComputedStyle> sc =
|
||||
styleSet->ResolveForDeclarations(parentStyle->AsServo(), declarations);
|
||||
|
||||
// The font getter is required to be reserialized based on what we
|
||||
|
@ -2754,9 +2754,9 @@ CreateFilterDeclarationForServo(const nsAString& aFilter,
|
|||
return CreateDeclarationForServo(eCSSProperty_filter, aFilter, aDocument);
|
||||
}
|
||||
|
||||
static already_AddRefed<ServoStyleContext>
|
||||
static already_AddRefed<ComputedStyle>
|
||||
ResolveFilterStyleForServo(const nsAString& aFilterString,
|
||||
const ServoStyleContext* aParentStyle,
|
||||
const ComputedStyle* aParentStyle,
|
||||
nsIPresShell* aPresShell,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
|
@ -2777,7 +2777,7 @@ ResolveFilterStyleForServo(const nsAString& aFilterString,
|
|||
}
|
||||
|
||||
ServoStyleSet* styleSet = aPresShell->StyleSet()->AsServo();
|
||||
RefPtr<ServoStyleContext> computedValues =
|
||||
RefPtr<ComputedStyle> computedValues =
|
||||
styleSet->ResolveForDeclarations(aParentStyle, declarations);
|
||||
|
||||
return computedValues.forget();
|
||||
|
@ -2809,7 +2809,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
// For stylo
|
||||
MOZ_ASSERT(presShell->StyleSet()->IsServo());
|
||||
|
||||
RefPtr<ServoStyleContext> parentStyle =
|
||||
RefPtr<ComputedStyle> parentStyle =
|
||||
GetFontStyleForServo(mCanvasElement,
|
||||
GetFont(),
|
||||
presShell,
|
||||
|
@ -2819,7 +2819,7 @@ CanvasRenderingContext2D::ParseFilter(const nsAString& aString,
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<ServoStyleContext> computedValues =
|
||||
RefPtr<ComputedStyle> computedValues =
|
||||
ResolveFilterStyleForServo(aString,
|
||||
parentStyle,
|
||||
presShell,
|
||||
|
@ -3735,7 +3735,7 @@ CanvasRenderingContext2D::SetFontInternal(const nsAString& aFont,
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> sc;
|
||||
RefPtr<ComputedStyle> sc;
|
||||
nsString usedFont;
|
||||
if (presShell->StyleSet()->IsServo()) {
|
||||
sc =
|
||||
|
@ -4305,11 +4305,11 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
// for now, default to ltr if not in doc
|
||||
bool isRTL = false;
|
||||
|
||||
RefPtr<nsStyleContext> canvasStyle;
|
||||
RefPtr<ComputedStyle> canvasStyle;
|
||||
if (mCanvasElement && mCanvasElement->IsInComposedDoc()) {
|
||||
// try to find the closest context
|
||||
canvasStyle =
|
||||
nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr);
|
||||
nsComputedDOMStyle::GetComputedStyle(mCanvasElement, nullptr);
|
||||
if (!canvasStyle) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ImageDocument.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/dom/DOMPrefs.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ImageDocumentBinding.h"
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "imgINotificationObserver.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
|
|
|
@ -23,10 +23,10 @@ using namespace mozilla::dom;
|
|||
// Class Methods
|
||||
nsSMILCSSProperty::nsSMILCSSProperty(nsCSSPropertyID aPropID,
|
||||
Element* aElement,
|
||||
nsStyleContext* aBaseStyleContext)
|
||||
ComputedStyle* aBaseComputedStyle)
|
||||
: mPropID(aPropID)
|
||||
, mElement(aElement)
|
||||
, mBaseStyleContext(aBaseStyleContext)
|
||||
, mBaseComputedStyle(aBaseComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(IsPropertyAnimatable(mPropID,
|
||||
aElement->OwnerDoc()->GetStyleBackendType()),
|
||||
|
@ -47,7 +47,7 @@ nsSMILCSSProperty::GetBaseValue() const
|
|||
// (c) No base style context
|
||||
if (nsCSSProps::IsShorthand(mPropID) ||
|
||||
mPropID == eCSSProperty_display ||
|
||||
!mBaseStyleContext) {
|
||||
!mBaseComputedStyle) {
|
||||
// We can't look up the base (computed-style) value of shorthand
|
||||
// properties because they aren't guaranteed to have a consistent computed
|
||||
// value.
|
||||
|
@ -69,7 +69,7 @@ nsSMILCSSProperty::GetBaseValue() const
|
|||
AnimationValue computedValue;
|
||||
if (mElement->IsStyledByServo()) {
|
||||
computedValue.mServo =
|
||||
Servo_ComputedValues_ExtractAnimationValue(mBaseStyleContext->AsServo(), mPropID)
|
||||
Servo_ComputedValues_ExtractAnimationValue(mBaseComputedStyle->AsServo(), mPropID)
|
||||
.Consume();
|
||||
if (!computedValue.mServo) {
|
||||
return baseValue;
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
#include "nsCSSPropertyID.h"
|
||||
#include "nsCSSValue.h"
|
||||
|
||||
class nsStyleContext;
|
||||
|
||||
namespace mozilla {
|
||||
class ComputedStyle;
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
@ -36,14 +35,14 @@ public:
|
|||
* Constructs a new nsSMILCSSProperty.
|
||||
* @param aPropID The CSS property we're interested in animating.
|
||||
* @param aElement The element whose CSS property is being animated.
|
||||
* @param aBaseStyleContext The style context to use when getting the base
|
||||
* @param aBaseComputedStyle The style context to use when getting the base
|
||||
* value. If this is nullptr and GetBaseValue is
|
||||
* called, an empty nsSMILValue initialized with
|
||||
* the nsSMILCSSValueType will be returned.
|
||||
*/
|
||||
nsSMILCSSProperty(nsCSSPropertyID aPropID,
|
||||
mozilla::dom::Element* aElement,
|
||||
nsStyleContext* aBaseStyleContext);
|
||||
mozilla::ComputedStyle* aBaseComputedStyle);
|
||||
|
||||
// nsISMILAttr methods
|
||||
virtual nsresult ValueFromString(const nsAString& aStr,
|
||||
|
@ -76,11 +75,12 @@ protected:
|
|||
// that time.
|
||||
mozilla::dom::Element* mElement;
|
||||
|
||||
// The style context to use when fetching base styles.
|
||||
// The style to use when fetching base styles.
|
||||
//
|
||||
// As with mElement, since an nsISMILAttr only lives as long as the
|
||||
// compositing step and since ComposeAttribute holds an owning reference to
|
||||
// the base style context, we can use a non-owning reference here.
|
||||
nsStyleContext* mBaseStyleContext;
|
||||
mozilla::ComputedStyle* mBaseComputedStyle;
|
||||
};
|
||||
|
||||
#endif // NS_SMILCSSPROPERTY_H_
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsStyleUtil.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::StyleAnimationValue;
|
||||
|
||||
|
@ -495,7 +496,7 @@ static ServoAnimationValues
|
|||
ValueFromStringHelper(nsCSSPropertyID aPropID,
|
||||
Element* aTargetElement,
|
||||
nsPresContext* aPresContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
const nsAString& aString)
|
||||
{
|
||||
ServoAnimationValues result;
|
||||
|
@ -519,7 +520,7 @@ ValueFromStringHelper(nsCSSPropertyID aPropID,
|
|||
// Compute value
|
||||
aPresContext->StyleSet()->AsServo()->GetAnimationValues(servoDeclarationBlock,
|
||||
aTargetElement,
|
||||
aStyleContext->AsServo(),
|
||||
aComputedStyle->AsServo(),
|
||||
result);
|
||||
|
||||
return result;
|
||||
|
@ -549,13 +550,12 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContext(aTargetElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyle(aTargetElement, nullptr);
|
||||
if (!styleContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (styleContext->IsServo()) {
|
||||
ServoAnimationValues parsedValues =
|
||||
ValueFromStringHelper(aPropID, aTargetElement, presContext,
|
||||
styleContext, aString);
|
||||
|
@ -569,10 +569,6 @@ nsSMILCSSValueType::ValueFromString(nsCSSPropertyID aPropID,
|
|||
sSingleton.Init(aValue);
|
||||
aValue.mU.mPtr = new ValueWrapper(aPropID, Move(parsedValues));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -57,16 +57,16 @@ nsSMILCompositor::ComposeAttribute(bool& aMightHavePendingStyleUpdates)
|
|||
|
||||
// If we might need to resolve base styles, grab a suitable style context
|
||||
// for initializing our nsISMILAttr with.
|
||||
RefPtr<nsStyleContext> baseStyleContext;
|
||||
RefPtr<ComputedStyle> baseComputedStyle;
|
||||
if (MightNeedBaseStyle()) {
|
||||
baseStyleContext =
|
||||
nsComputedDOMStyle::GetUnanimatedStyleContextNoFlush(mKey.mElement,
|
||||
baseComputedStyle =
|
||||
nsComputedDOMStyle::GetUnanimatedComputedStyleNoFlush(mKey.mElement,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
// FIRST: Get the nsISMILAttr (to grab base value from, and to eventually
|
||||
// give animated value to)
|
||||
UniquePtr<nsISMILAttr> smilAttr = CreateSMILAttr(baseStyleContext);
|
||||
UniquePtr<nsISMILAttr> smilAttr = CreateSMILAttr(baseComputedStyle);
|
||||
if (!smilAttr) {
|
||||
// Target attribute not found (or, out of memory)
|
||||
return;
|
||||
|
@ -134,13 +134,13 @@ nsSMILCompositor::ClearAnimationEffects()
|
|||
// Protected Helper Functions
|
||||
// --------------------------
|
||||
UniquePtr<nsISMILAttr>
|
||||
nsSMILCompositor::CreateSMILAttr(nsStyleContext* aBaseStyleContext)
|
||||
nsSMILCompositor::CreateSMILAttr(ComputedStyle* aBaseComputedStyle)
|
||||
{
|
||||
nsCSSPropertyID propID = GetCSSPropertyToAnimate();
|
||||
|
||||
if (propID != eCSSProperty_UNKNOWN) {
|
||||
return MakeUnique<nsSMILCSSProperty>(propID, mKey.mElement.get(),
|
||||
aBaseStyleContext);
|
||||
aBaseComputedStyle);
|
||||
}
|
||||
|
||||
return mKey.mElement->GetAnimatedAttr(mKey.mAttributeNamespaceID,
|
||||
|
|
|
@ -75,10 +75,10 @@ public:
|
|||
private:
|
||||
// Create a nsISMILAttr for my target, on the heap.
|
||||
//
|
||||
// @param aBaseStyleContext An optional style context which, if set, will be
|
||||
// @param aBaseComputedStyle An optional style context which, if set, will be
|
||||
// used when fetching the base style.
|
||||
mozilla::UniquePtr<nsISMILAttr>
|
||||
CreateSMILAttr(nsStyleContext* aBaseStyleContext);
|
||||
CreateSMILAttr(mozilla::ComputedStyle* aBaseComputedStyle);
|
||||
|
||||
// Returns the CSS property this compositor should animate, or
|
||||
// eCSSProperty_UNKNOWN if this compositor does not animate a CSS property.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "nsSVGPathDataParser.h"
|
||||
#include "SVGPathData.h"
|
||||
#include "SVGPathElement.h"
|
||||
|
@ -171,16 +171,16 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
|||
void
|
||||
SVGContentUtils::GetStrokeOptions(AutoStrokeOptions* aStrokeOptions,
|
||||
nsSVGElement* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
SVGContextPaint* aContextPaint,
|
||||
StrokeOptionFlags aFlags)
|
||||
{
|
||||
RefPtr<nsStyleContext> styleContext;
|
||||
if (aStyleContext) {
|
||||
styleContext = aStyleContext;
|
||||
RefPtr<ComputedStyle> styleContext;
|
||||
if (aComputedStyle) {
|
||||
styleContext = aComputedStyle;
|
||||
} else {
|
||||
styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
}
|
||||
|
||||
if (!styleContext) {
|
||||
|
@ -245,15 +245,15 @@ SVGContentUtils::GetStrokeOptions(AutoStrokeOptions* aStrokeOptions,
|
|||
|
||||
Float
|
||||
SVGContentUtils::GetStrokeWidth(nsSVGElement* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
SVGContextPaint* aContextPaint)
|
||||
{
|
||||
RefPtr<nsStyleContext> styleContext;
|
||||
if (aStyleContext) {
|
||||
styleContext = aStyleContext;
|
||||
RefPtr<ComputedStyle> styleContext;
|
||||
if (aComputedStyle) {
|
||||
styleContext = aComputedStyle;
|
||||
} else {
|
||||
styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
}
|
||||
|
||||
if (!styleContext) {
|
||||
|
@ -275,8 +275,8 @@ SVGContentUtils::GetFontSize(Element *aElement)
|
|||
if (!aElement)
|
||||
return 1.0f;
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
if (!styleContext) {
|
||||
// ReportToConsole
|
||||
NS_WARNING("Couldn't get style context for content in GetFontStyle");
|
||||
|
@ -290,18 +290,18 @@ float
|
|||
SVGContentUtils::GetFontSize(nsIFrame *aFrame)
|
||||
{
|
||||
MOZ_ASSERT(aFrame, "NULL frame in GetFontSize");
|
||||
return GetFontSize(aFrame->StyleContext());
|
||||
return GetFontSize(aFrame->Style());
|
||||
}
|
||||
|
||||
float
|
||||
SVGContentUtils::GetFontSize(nsStyleContext *aStyleContext)
|
||||
SVGContentUtils::GetFontSize(ComputedStyle *aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aStyleContext, "NULL style context in GetFontSize");
|
||||
MOZ_ASSERT(aComputedStyle, "NULL style context in GetFontSize");
|
||||
|
||||
nsPresContext *presContext = aStyleContext->PresContext();
|
||||
nsPresContext *presContext = aComputedStyle->PresContext();
|
||||
MOZ_ASSERT(presContext, "NULL pres context in GetFontSize");
|
||||
|
||||
nscoord fontSize = aStyleContext->StyleFont()->mSize;
|
||||
nscoord fontSize = aComputedStyle->StyleFont()->mSize;
|
||||
return nsPresContext::AppUnitsToFloatCSSPixels(fontSize) /
|
||||
presContext->EffectiveTextZoom();
|
||||
}
|
||||
|
@ -312,8 +312,8 @@ SVGContentUtils::GetFontXHeight(Element *aElement)
|
|||
if (!aElement)
|
||||
return 1.0f;
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(aElement, nullptr);
|
||||
if (!styleContext) {
|
||||
// ReportToConsole
|
||||
NS_WARNING("Couldn't get style context for content in GetFontStyle");
|
||||
|
@ -327,19 +327,19 @@ float
|
|||
SVGContentUtils::GetFontXHeight(nsIFrame *aFrame)
|
||||
{
|
||||
MOZ_ASSERT(aFrame, "NULL frame in GetFontXHeight");
|
||||
return GetFontXHeight(aFrame->StyleContext());
|
||||
return GetFontXHeight(aFrame->Style());
|
||||
}
|
||||
|
||||
float
|
||||
SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext)
|
||||
SVGContentUtils::GetFontXHeight(ComputedStyle *aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aStyleContext, "NULL style context in GetFontXHeight");
|
||||
MOZ_ASSERT(aComputedStyle, "NULL style context in GetFontXHeight");
|
||||
|
||||
nsPresContext *presContext = aStyleContext->PresContext();
|
||||
nsPresContext *presContext = aComputedStyle->PresContext();
|
||||
MOZ_ASSERT(presContext, "NULL pres context in GetFontXHeight");
|
||||
|
||||
RefPtr<nsFontMetrics> fontMetrics =
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext);
|
||||
nsLayoutUtils::GetFontMetricsForComputedStyle(aComputedStyle);
|
||||
|
||||
if (!fontMetrics) {
|
||||
// ReportToConsole
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIFrame;
|
||||
class nsStyleContext;
|
||||
class nsStyleCoord;
|
||||
class nsSVGElement;
|
||||
|
||||
namespace mozilla {
|
||||
class ComputedStyle;
|
||||
class nsSVGAnimatedTransformList;
|
||||
class SVGAnimatedPreserveAspectRatio;
|
||||
class SVGContextPaint;
|
||||
|
@ -75,6 +75,7 @@ enum SVGTransformTypes {
|
|||
class SVGContentUtils
|
||||
{
|
||||
public:
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
typedef mozilla::gfx::Float Float;
|
||||
typedef mozilla::gfx::Matrix Matrix;
|
||||
typedef mozilla::gfx::Rect Rect;
|
||||
|
@ -155,13 +156,13 @@ public:
|
|||
*/
|
||||
static void GetStrokeOptions(AutoStrokeOptions* aStrokeOptions,
|
||||
nsSVGElement* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
mozilla::SVGContextPaint* aContextPaint,
|
||||
StrokeOptionFlags aFlags = eAllStrokeOptions);
|
||||
|
||||
/**
|
||||
* Returns the current computed value of the CSS property 'stroke-width' for
|
||||
* the given element. aStyleContext may be provided as an optimization.
|
||||
* the given element. aComputedStyle may be provided as an optimization.
|
||||
* aContextPaint is also optional.
|
||||
*
|
||||
* Note that this function does NOT take account of the value of the 'stroke'
|
||||
|
@ -169,7 +170,7 @@ public:
|
|||
* "0", respectively.
|
||||
*/
|
||||
static Float GetStrokeWidth(nsSVGElement* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
mozilla::SVGContextPaint* aContextPaint);
|
||||
|
||||
/*
|
||||
|
@ -181,7 +182,7 @@ public:
|
|||
*/
|
||||
static float GetFontSize(mozilla::dom::Element *aElement);
|
||||
static float GetFontSize(nsIFrame *aFrame);
|
||||
static float GetFontSize(nsStyleContext *aStyleContext);
|
||||
static float GetFontSize(ComputedStyle *aComputedStyle);
|
||||
/*
|
||||
* Get the number of CSS px (user units) per ex (i.e. the x-height in user
|
||||
* units) for an nsIContent
|
||||
|
@ -191,7 +192,7 @@ public:
|
|||
*/
|
||||
static float GetFontXHeight(mozilla::dom::Element *aElement);
|
||||
static float GetFontXHeight(nsIFrame *aFrame);
|
||||
static float GetFontXHeight(nsStyleContext *aStyleContext);
|
||||
static float GetFontXHeight(ComputedStyle *aComputedStyle);
|
||||
|
||||
/*
|
||||
* Report a localized error message to the error console.
|
||||
|
|
|
@ -109,7 +109,7 @@ SVGFEDropShadowElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
|||
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsStyleContext* style = frame->StyleContext();
|
||||
ComputedStyle* style = frame->Style();
|
||||
Color color(Color::FromABGR(style->StyleSVGReset()->mFloodColor));
|
||||
color.a *= style->StyleSVGReset()->mFloodOpacity;
|
||||
descr.Attributes().Set(eDropShadowColor, color);
|
||||
|
|
|
@ -43,7 +43,7 @@ SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
|
|||
FilterPrimitiveDescription descr(PrimitiveType::Flood);
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsStyleContext* style = frame->StyleContext();
|
||||
ComputedStyle* style = frame->Style();
|
||||
Color color(Color::FromABGR(style->StyleSVGReset()->mFloodColor));
|
||||
color.a *= style->StyleSVGReset()->mFloodOpacity;
|
||||
descr.Attributes().Set(eFloodColor, color);
|
||||
|
|
|
@ -138,8 +138,8 @@ SVGGeometryElement::GetFillRule()
|
|||
{
|
||||
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
|
||||
|
||||
if (styleContext) {
|
||||
MOZ_ASSERT(styleContext->StyleSVG()->mFillRule == StyleFillRule::Nonzero ||
|
||||
|
|
|
@ -298,8 +298,8 @@ SVGPathElement::BuildPath(PathBuilder* aBuilder)
|
|||
uint8_t strokeLineCap = NS_STYLE_STROKE_LINECAP_BUTT;
|
||||
Float strokeWidth = 0;
|
||||
|
||||
RefPtr<nsStyleContext> styleContext =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr);
|
||||
RefPtr<ComputedStyle> styleContext =
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
|
||||
if (styleContext) {
|
||||
const nsStyleSVG* style = styleContext->StyleSVG();
|
||||
// Note: the path that we return may be used for hit-testing, and SVG
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsSVGFilters.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "mozilla/dom/SVGFilterElement.h"
|
||||
|
@ -161,7 +161,7 @@ nsSVGFE::StyleIsSetToSRGB()
|
|||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (!frame) return false;
|
||||
|
||||
nsStyleContext* style = frame->StyleContext();
|
||||
ComputedStyle* style = frame->Style();
|
||||
return style->StyleSVG()->mColorInterpolationFilters ==
|
||||
NS_STYLE_COLOR_INTERPOLATION_SRGB;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ nsSVGFELightingElement::AddLightingAttributes(const FilterPrimitiveDescription&
|
|||
return FilterPrimitiveDescription(PrimitiveType::Empty);
|
||||
}
|
||||
|
||||
nsStyleContext* style = frame->StyleContext();
|
||||
ComputedStyle* style = frame->Style();
|
||||
Color color(Color::FromABGR(style->StyleSVGReset()->mLightingColor));
|
||||
color.a = 1.f;
|
||||
float surfaceScale = mNumberAttributes[SURFACE_SCALE].GetAnimValue();
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
#include "nsIDocumentObserver.h"
|
||||
#include "imgILoader.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
@ -258,7 +258,7 @@ nsXBLResourceLoader::NotifyBoundElements()
|
|||
nsIFrame* childFrame = content->GetPrimaryFrame();
|
||||
if (!childFrame) {
|
||||
// Check if it's in the display:none or display:contents maps.
|
||||
nsStyleContext* sc =
|
||||
ComputedStyle* sc =
|
||||
shell->FrameConstructor()->GetDisplayNoneStyleFor(content);
|
||||
|
||||
if (!sc) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -41,7 +42,6 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsXBLSerialize.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "StyleSheetTransactions.h" // for AddStyleSheetTransaction, etc.
|
||||
#include "TextEditUtils.h" // for TextEditUtils
|
||||
#include "mozilla/CheckedInt.h" // for CheckedInt
|
||||
#include "mozilla/ComputedStyle.h" // for ComputedStyle
|
||||
#include "mozilla/EditAction.h" // for EditAction
|
||||
#include "mozilla/EditorDOMPoint.h" // for EditorDOMPoint
|
||||
#include "mozilla/EditorSpellCheck.h" // for EditorSpellCheck
|
||||
|
@ -103,7 +104,6 @@
|
|||
#include "nsString.h" // for nsAutoString, nsString, etc.
|
||||
#include "nsStringFwd.h" // for nsString
|
||||
#include "nsStyleConsts.h" // for NS_STYLE_DIRECTION_RTL, etc.
|
||||
#include "nsStyleContext.h" // for nsStyleContext
|
||||
#include "nsStyleStruct.h" // for nsStyleDisplay, nsStyleText, etc.
|
||||
#include "nsStyleStructFwd.h" // for nsIFrame::StyleUIReset, etc.
|
||||
#include "nsTextNode.h" // for nsTextNode
|
||||
|
@ -4109,13 +4109,13 @@ EditorBase::IsPreformatted(nsIDOMNode* aNode,
|
|||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
// Look at the node (and its parent if it's not an element), and grab its style context
|
||||
RefPtr<nsStyleContext> elementStyle;
|
||||
RefPtr<ComputedStyle> elementStyle;
|
||||
if (!content->IsElement()) {
|
||||
content = content->GetParent();
|
||||
}
|
||||
if (content && content->IsElement()) {
|
||||
elementStyle =
|
||||
nsComputedDOMStyle::GetStyleContextNoFlush(content->AsElement(), nullptr);
|
||||
nsComputedDOMStyle::GetComputedStyleNoFlush(content->AsElement(), nullptr);
|
||||
}
|
||||
|
||||
if (!elementStyle) {
|
||||
|
|
|
@ -621,8 +621,8 @@ HTMLEditor::GetTemporaryStyleForFocusedPositionedElement(Element& aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
RefPtr<nsStyleContext> style =
|
||||
nsComputedDOMStyle::GetStyleContext(&aElement, nullptr);
|
||||
RefPtr<ComputedStyle> style =
|
||||
nsComputedDOMStyle::GetComputedStyle(&aElement, nullptr);
|
||||
NS_ENSURE_STATE(style);
|
||||
|
||||
const uint8_t kBlackBgTrigger = 0xd0;
|
||||
|
|
|
@ -476,7 +476,7 @@ function ignoreContents(entry)
|
|||
|
||||
// The analysis thinks we'll write to mBits in the DoGetStyleFoo<false>
|
||||
// call. Maybe the template parameter confuses it?
|
||||
/nsStyleContext::PeekStyle/,
|
||||
/ComputedStyle::PeekStyle/,
|
||||
|
||||
// The analysis can't cope with the indirection used for the objects
|
||||
// being initialized here, from nsCSSValue::Array::Create to the return
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
#include "mozilla/ArenaObjectID.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -24,7 +24,7 @@ ArenaRefPtr<T>::AssertValidType()
|
|||
{
|
||||
// If adding new types, please update nsPresArena::ClearArenaRefPtrWithoutDeregistering
|
||||
// as well
|
||||
static_assert(IsSame<T, GeckoStyleContext>::value || IsSame<T, nsStyleContext>::value,
|
||||
static_assert(IsSame<T, ComputedStyle>::value,
|
||||
"ArenaRefPtr<T> template parameter T must be declared in "
|
||||
"nsPresArenaObjectList and explicitly handled in"
|
||||
"nsPresArena.cpp");
|
||||
|
|
|
@ -1341,11 +1341,11 @@ PresShell::Destroy()
|
|||
// (b) before the mPresContext->DetachShell() below, so
|
||||
// that when we clear the ArenaRefPtrs they'll still be able to
|
||||
// get back to this PresShell to deregister themselves (e.g. note
|
||||
// how nsStyleContext::Arena returns the PresShell got from its
|
||||
// how ComputedStyle::Arena returns the PresShell got from its
|
||||
// rule node's nsPresContext, which would return null if we'd already
|
||||
// called mPresContext->DetachShell()), and
|
||||
// (c) before the mStyleSet->BeginShutdown() call just below, so that
|
||||
// the nsStyleContexts don't complain they're being destroyed later
|
||||
// the ComputedStyles don't complain they're being destroyed later
|
||||
// than the rule tree is.
|
||||
mFrameArena.ClearArenaRefPtrs();
|
||||
|
||||
|
@ -5363,7 +5363,7 @@ void PresShell::UpdateCanvasBackground()
|
|||
// cache of that color.
|
||||
nsIFrame* rootStyleFrame = FrameConstructor()->GetRootElementStyleFrame();
|
||||
if (rootStyleFrame) {
|
||||
nsStyleContext* bgStyle =
|
||||
ComputedStyle* bgStyle =
|
||||
nsCSSRendering::FindRootFrameBackground(rootStyleFrame);
|
||||
// XXX We should really be passing the canvasframe, not the root element
|
||||
// style frame but we don't have access to the canvasframe here. It isn't
|
||||
|
@ -9080,7 +9080,7 @@ PresShell::WindowSizeMoveDone()
|
|||
|
||||
#ifdef MOZ_XUL
|
||||
/*
|
||||
* It's better to add stuff to the |DidSetStyleContext| method of the
|
||||
* It's better to add stuff to the |DidSetComputedStyle| method of the
|
||||
* relevant frames than adding it here. These methods should (ideally,
|
||||
* anyway) go away.
|
||||
*/
|
||||
|
@ -9717,11 +9717,11 @@ PresShell::VerifyIncrementalReflow()
|
|||
|
||||
// Layout debugging hooks
|
||||
void
|
||||
PresShell::ListStyleContexts(FILE *out, int32_t aIndent)
|
||||
PresShell::ListComputedStyles(FILE *out, int32_t aIndent)
|
||||
{
|
||||
nsIFrame* rootFrame = GetRootFrame();
|
||||
if (rootFrame) {
|
||||
rootFrame->StyleContext()->List(out, aIndent);
|
||||
rootFrame->Style()->List(out, aIndent);
|
||||
}
|
||||
|
||||
// The root element's frame's style context is the root of a separate tree.
|
||||
|
@ -9729,7 +9729,7 @@ PresShell::ListStyleContexts(FILE *out, int32_t aIndent)
|
|||
if (rootElement) {
|
||||
nsIFrame* rootElementFrame = rootElement->GetPrimaryFrame();
|
||||
if (rootElementFrame) {
|
||||
rootElementFrame->StyleContext()->List(out, aIndent);
|
||||
rootElementFrame->Style()->List(out, aIndent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void ListStyleContexts(FILE *out, int32_t aIndent = 0) override;
|
||||
void ListComputedStyles(FILE *out, int32_t aIndent = 0) override;
|
||||
|
||||
void ListStyleSheets(FILE *out, int32_t aIndent = 0) override;
|
||||
void VerifyStyleTree() override;
|
||||
|
|
|
@ -1146,7 +1146,7 @@ ApplyRenderingChangeToTree(nsIPresShell* aPresShell,
|
|||
if (aChange & nsChangeHint_RepaintFrame) {
|
||||
// If the frame's background is propagated to an ancestor, walk up to
|
||||
// that ancestor and apply the RepaintFrame change hint to it.
|
||||
nsStyleContext* bgSC;
|
||||
ComputedStyle* bgSC;
|
||||
nsIFrame* propagatedFrame = aFrame;
|
||||
while (!nsCSSRendering::FindBackground(propagatedFrame, &bgSC)) {
|
||||
propagatedFrame = propagatedFrame->GetParent();
|
||||
|
@ -1782,8 +1782,8 @@ RestyleManager::AddLayerChangesForAnimation(nsIFrame* aFrame,
|
|||
// If we have a transform layer but don't have any transform style, we
|
||||
// probably just removed the transform but haven't destroyed the layer
|
||||
// yet. In this case we will add the appropriate change hint
|
||||
// (nsChangeHint_UpdateContainingBlock) when we compare style contexts
|
||||
// so we can skip adding any change hint here. (If we *were* to add
|
||||
// (nsChangeHint_UpdateContainingBlock) when we compare styles so we can
|
||||
// skip adding any change hint here. (If we *were* to add
|
||||
// nsChangeHint_UpdateTransformLayer, ApplyRenderingChangeToTree would
|
||||
// complain that we're updating a transform layer without a transform).
|
||||
if (layerInfo.mLayerType == DisplayItemType::TYPE_TRANSFORM &&
|
||||
|
|
|
@ -102,9 +102,9 @@ public:
|
|||
// This method takes the content node for the generated content for
|
||||
// animation/transition on ::before and ::after, rather than the
|
||||
// content node for the real element.
|
||||
void Put(nsIContent* aContent, nsStyleContext* aStyleContext) {
|
||||
void Put(nsIContent* aContent, ComputedStyle* aComputedStyle) {
|
||||
MOZ_ASSERT(aContent);
|
||||
CSSPseudoElementType pseudoType = aStyleContext->GetPseudoType();
|
||||
CSSPseudoElementType pseudoType = aComputedStyle->GetPseudoType();
|
||||
if (pseudoType == CSSPseudoElementType::NotPseudo) {
|
||||
mContents.AppendElement(aContent);
|
||||
} else if (pseudoType == CSSPseudoElementType::before) {
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
nsAtom* aAttribute,
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aOldValue);
|
||||
inline nsresult ReparentStyleContext(nsIFrame* aFrame);
|
||||
inline nsresult ReparentComputedStyle(nsIFrame* aFrame);
|
||||
|
||||
inline void UpdateOnlyAnimationStyles();
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ RestyleManager::AttributeChanged(dom::Element* aElement,
|
|||
}
|
||||
|
||||
nsresult
|
||||
RestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
||||
RestyleManager::ReparentComputedStyle(nsIFrame* aFrame)
|
||||
{
|
||||
MOZ_STYLO_FORWARD(ReparentStyleContext, (aFrame));
|
||||
MOZ_STYLO_FORWARD(ReparentComputedStyle, (aFrame));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
#include "mozilla/AutoRestyleTimelineMarker.h"
|
||||
#include "mozilla/AutoTimelineMarker.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "mozilla/DocumentStyleRootIterator.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/ServoStyleContext.h"
|
||||
#include "mozilla/ServoStyleContextInlines.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/ViewportFrame.h"
|
||||
#include "mozilla/dom/ChildIterator.h"
|
||||
|
@ -40,7 +40,7 @@ namespace mozilla {
|
|||
static bool
|
||||
IsAnonBox(const nsIFrame& aFrame)
|
||||
{
|
||||
return aFrame.StyleContext()->IsAnonBox();
|
||||
return aFrame.Style()->IsAnonBox();
|
||||
}
|
||||
|
||||
static const nsIFrame*
|
||||
|
@ -105,7 +105,7 @@ ExpectedOwnerForChild(const nsIFrame& aFrame)
|
|||
// a frame of a DOM element or pseudo. Hop through anon and line-boxes
|
||||
// generated by our DOM parent, and go find the owner frame for it.
|
||||
while (parent && (IsAnonBox(*parent) || parent->IsLineFrame())) {
|
||||
auto* pseudo = parent->StyleContext()->GetPseudo();
|
||||
auto* pseudo = parent->Style()->GetPseudo();
|
||||
if (pseudo == nsCSSAnonBoxes::tableWrapper) {
|
||||
const nsIFrame* tableFrame = parent->PrincipalChildList().FirstChild();
|
||||
MOZ_ASSERT(tableFrame->IsTableFrame());
|
||||
|
@ -167,16 +167,16 @@ ServoRestyleState::ChangesHandledFor(const nsIFrame& aFrame) const
|
|||
void
|
||||
ServoRestyleState::AddPendingWrapperRestyle(nsIFrame* aWrapperFrame)
|
||||
{
|
||||
MOZ_ASSERT(aWrapperFrame->StyleContext()->IsWrapperAnonBox(),
|
||||
MOZ_ASSERT(aWrapperFrame->Style()->IsWrapperAnonBox(),
|
||||
"All our wrappers are anon boxes, and why would we restyle "
|
||||
"non-inheriting ones?");
|
||||
MOZ_ASSERT(aWrapperFrame->StyleContext()->IsInheritingAnonBox(),
|
||||
MOZ_ASSERT(aWrapperFrame->Style()->IsInheritingAnonBox(),
|
||||
"All our wrappers are anon boxes, and why would we restyle "
|
||||
"non-inheriting ones?");
|
||||
MOZ_ASSERT(aWrapperFrame->StyleContext()->GetPseudo() !=
|
||||
MOZ_ASSERT(aWrapperFrame->Style()->GetPseudo() !=
|
||||
nsCSSAnonBoxes::cellContent,
|
||||
"Someone should be using TableAwareParentFor");
|
||||
MOZ_ASSERT(aWrapperFrame->StyleContext()->GetPseudo() !=
|
||||
MOZ_ASSERT(aWrapperFrame->Style()->GetPseudo() !=
|
||||
nsCSSAnonBoxes::tableWrapper,
|
||||
"Someone should be using TableAwareParentFor");
|
||||
// Make sure we only add first continuations.
|
||||
|
@ -221,7 +221,7 @@ ServoRestyleState::ProcessMaybeNestedWrapperRestyle(nsIFrame* aParent,
|
|||
MOZ_ASSERT(aIndex < mPendingWrapperRestyles.Length());
|
||||
|
||||
nsIFrame* cur = mPendingWrapperRestyles[aIndex];
|
||||
MOZ_ASSERT(cur->StyleContext()->IsWrapperAnonBox());
|
||||
MOZ_ASSERT(cur->Style()->IsWrapperAnonBox());
|
||||
|
||||
// Where is cur supposed to inherit from? From its parent frame, except in
|
||||
// the case when cur is a table, in which case it should be its grandparent.
|
||||
|
@ -245,7 +245,7 @@ ServoRestyleState::ProcessMaybeNestedWrapperRestyle(nsIFrame* aParent,
|
|||
parent = parent->GetParent();
|
||||
}
|
||||
MOZ_ASSERT(FirstContinuationOrPartOfIBSplit(parent) == aParent ||
|
||||
(parent->StyleContext()->IsInheritingAnonBox() &&
|
||||
(parent->Style()->IsInheritingAnonBox() &&
|
||||
parent->GetContent() == aParent->GetContent()));
|
||||
|
||||
// Now "this" is a ServoRestyleState for aParent, so if parent is not a next
|
||||
|
@ -305,7 +305,7 @@ ServoRestyleState::TableAwareParentFor(const nsIFrame* aChild)
|
|||
|
||||
nsIFrame* parent = aChild->GetParent();
|
||||
// Now if parent is a cell-content frame, we actually want the cellframe.
|
||||
if (parent->StyleContext()->GetPseudo() == nsCSSAnonBoxes::cellContent) {
|
||||
if (parent->Style()->GetPseudo() == nsCSSAnonBoxes::cellContent) {
|
||||
parent = parent->GetParent();
|
||||
} else if (parent->IsTableWrapperFrame()) {
|
||||
// Must be a caption. In that case we want the table here.
|
||||
|
@ -481,7 +481,7 @@ struct ServoRestyleManager::TextPostTraversalState
|
|||
{
|
||||
public:
|
||||
TextPostTraversalState(Element& aParentElement,
|
||||
ServoStyleContext* aParentContext,
|
||||
ComputedStyle* aParentContext,
|
||||
bool aDisplayContentsParentStyleChanged,
|
||||
ServoRestyleState& aParentRestyleState)
|
||||
: mParentElement(aParentElement)
|
||||
|
@ -495,7 +495,7 @@ public:
|
|||
|
||||
nsStyleChangeList& ChangeList() { return mParentRestyleState.ChangeList(); }
|
||||
|
||||
nsStyleContext& ComputeStyle(nsIContent* aTextNode)
|
||||
ComputedStyle& ComputeStyle(nsIContent* aTextNode)
|
||||
{
|
||||
if (!mStyle) {
|
||||
mStyle = mParentRestyleState.StyleSet().ResolveStyleForText(
|
||||
|
@ -507,7 +507,7 @@ public:
|
|||
|
||||
void ComputeHintIfNeeded(nsIContent* aContent,
|
||||
nsIFrame* aTextFrame,
|
||||
nsStyleContext& aNewContext)
|
||||
ComputedStyle& aNewContext)
|
||||
{
|
||||
MOZ_ASSERT(aTextFrame);
|
||||
MOZ_ASSERT(aNewContext.GetPseudo() == nsCSSAnonBoxes::mozText);
|
||||
|
@ -516,7 +516,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
ServoStyleContext* oldContext = aTextFrame->StyleContext()->AsServo();
|
||||
ComputedStyle* oldContext = aTextFrame->Style()->AsServo();
|
||||
MOZ_ASSERT(oldContext->GetPseudo() == nsCSSAnonBoxes::mozText);
|
||||
|
||||
// We rely on the fact that all the text children for the same element share
|
||||
|
@ -542,7 +542,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
ServoStyleContext& ParentStyle() {
|
||||
ComputedStyle& ParentStyle() {
|
||||
if (!mParentContext) {
|
||||
mLazilyResolvedParentContext =
|
||||
mParentRestyleState.StyleSet().ResolveServoStyle(&mParentElement);
|
||||
|
@ -552,10 +552,10 @@ private:
|
|||
}
|
||||
|
||||
Element& mParentElement;
|
||||
ServoStyleContext* mParentContext;
|
||||
RefPtr<ServoStyleContext> mLazilyResolvedParentContext;
|
||||
ComputedStyle* mParentContext;
|
||||
RefPtr<ComputedStyle> mLazilyResolvedParentContext;
|
||||
ServoRestyleState& mParentRestyleState;
|
||||
RefPtr<nsStyleContext> mStyle;
|
||||
RefPtr<ComputedStyle> mStyle;
|
||||
bool mShouldPostHints;
|
||||
bool mShouldComputeHints;
|
||||
nsChangeHint mComputedHint;
|
||||
|
@ -566,7 +566,7 @@ UpdateBackdropIfNeeded(nsIFrame* aFrame,
|
|||
ServoStyleSet& aStyleSet,
|
||||
nsStyleChangeList& aChangeList)
|
||||
{
|
||||
const nsStyleDisplay* display = aFrame->StyleContext()->StyleDisplay();
|
||||
const nsStyleDisplay* display = aFrame->Style()->StyleDisplay();
|
||||
if (display->mTopLayer != NS_STYLE_TOP_LAYER_TOP) {
|
||||
return;
|
||||
}
|
||||
|
@ -585,13 +585,13 @@ UpdateBackdropIfNeeded(nsIFrame* aFrame,
|
|||
nsIFrame* backdropFrame =
|
||||
nsPlaceholderFrame::GetRealFrameForPlaceholder(backdropPlaceholder);
|
||||
MOZ_ASSERT(backdropFrame->IsBackdropFrame());
|
||||
MOZ_ASSERT(backdropFrame->StyleContext()->GetPseudoType() ==
|
||||
MOZ_ASSERT(backdropFrame->Style()->GetPseudoType() ==
|
||||
CSSPseudoElementType::backdrop);
|
||||
|
||||
RefPtr<nsStyleContext> newContext =
|
||||
RefPtr<ComputedStyle> newContext =
|
||||
aStyleSet.ResolvePseudoElementStyle(aFrame->GetContent()->AsElement(),
|
||||
CSSPseudoElementType::backdrop,
|
||||
aFrame->StyleContext()->AsServo(),
|
||||
aFrame->Style()->AsServo(),
|
||||
/* aPseudoElement = */ nullptr);
|
||||
|
||||
// NOTE(emilio): We can't use the changes handled for the owner of the
|
||||
|
@ -626,9 +626,9 @@ UpdateFirstLetterIfNeeded(nsIFrame* aFrame, ServoRestyleState& aRestyleState)
|
|||
}
|
||||
|
||||
static void
|
||||
UpdateOneAdditionalStyleContext(nsIFrame* aFrame,
|
||||
UpdateOneAdditionalComputedStyle(nsIFrame* aFrame,
|
||||
uint32_t aIndex,
|
||||
ServoStyleContext& aOldContext,
|
||||
ComputedStyle& aOldContext,
|
||||
ServoRestyleState& aRestyleState)
|
||||
{
|
||||
auto pseudoType = aOldContext.GetPseudoType();
|
||||
|
@ -636,11 +636,11 @@ UpdateOneAdditionalStyleContext(nsIFrame* aFrame,
|
|||
MOZ_ASSERT(
|
||||
!nsCSSPseudoElements::PseudoElementSupportsUserActionState(pseudoType));
|
||||
|
||||
RefPtr<ServoStyleContext> newContext =
|
||||
RefPtr<ComputedStyle> newContext =
|
||||
aRestyleState.StyleSet().ResolvePseudoElementStyle(
|
||||
aFrame->GetContent()->AsElement(),
|
||||
pseudoType,
|
||||
aFrame->StyleContext()->AsServo(),
|
||||
aFrame->Style()->AsServo(),
|
||||
/* aPseudoElement = */ nullptr);
|
||||
|
||||
uint32_t equalStructs, samePointerStructs; // Not used, actually.
|
||||
|
@ -663,11 +663,11 @@ UpdateOneAdditionalStyleContext(nsIFrame* aFrame,
|
|||
aFrame, aFrame->GetContent(), childHint);
|
||||
}
|
||||
|
||||
aFrame->SetAdditionalStyleContext(aIndex, newContext);
|
||||
aFrame->SetAdditionalComputedStyle(aIndex, newContext);
|
||||
}
|
||||
|
||||
static void
|
||||
UpdateAdditionalStyleContexts(nsIFrame* aFrame,
|
||||
UpdateAdditionalComputedStyles(nsIFrame* aFrame,
|
||||
ServoRestyleState& aRestyleState)
|
||||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
|
@ -676,8 +676,8 @@ UpdateAdditionalStyleContexts(nsIFrame* aFrame,
|
|||
// FIXME(emilio): Consider adding a bit or something to avoid the initial
|
||||
// virtual call?
|
||||
uint32_t index = 0;
|
||||
while (auto* oldContext = aFrame->GetAdditionalStyleContext(index)) {
|
||||
UpdateOneAdditionalStyleContext(
|
||||
while (auto* oldContext = aFrame->GetAdditionalComputedStyle(index)) {
|
||||
UpdateOneAdditionalComputedStyle(
|
||||
aFrame, index++, *oldContext->AsServo(), aRestyleState);
|
||||
}
|
||||
}
|
||||
|
@ -715,8 +715,8 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ServoPostTraversalFlags)
|
|||
static ServoPostTraversalFlags
|
||||
SendA11yNotifications(nsPresContext* aPresContext,
|
||||
Element* aElement,
|
||||
nsStyleContext* aOldStyleContext,
|
||||
nsStyleContext* aNewStyleContext,
|
||||
ComputedStyle* aOldComputedStyle,
|
||||
ComputedStyle* aNewComputedStyle,
|
||||
ServoPostTraversalFlags aFlags)
|
||||
{
|
||||
using Flags = ServoPostTraversalFlags;
|
||||
|
@ -737,7 +737,7 @@ SendA11yNotifications(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
bool needsNotify = false;
|
||||
bool isVisible = aNewStyleContext->StyleVisibility()->IsVisible();
|
||||
bool isVisible = aNewComputedStyle->StyleVisibility()->IsVisible();
|
||||
if (aFlags & Flags::SendA11yNotificationsIfShown) {
|
||||
if (!isVisible) {
|
||||
// Propagate the sending-if-shown flag to descendants.
|
||||
|
@ -750,7 +750,7 @@ SendA11yNotifications(nsPresContext* aPresContext,
|
|||
} else {
|
||||
// If we shouldn't skip in any case, we need to check whether our
|
||||
// own visibility has changed.
|
||||
bool wasVisible = aOldStyleContext->StyleVisibility()->IsVisible();
|
||||
bool wasVisible = aOldComputedStyle->StyleVisibility()->IsVisible();
|
||||
needsNotify = wasVisible != isVisible;
|
||||
}
|
||||
|
||||
|
@ -776,7 +776,7 @@ SendA11yNotifications(nsPresContext* aPresContext,
|
|||
bool
|
||||
ServoRestyleManager::ProcessPostTraversal(
|
||||
Element* aElement,
|
||||
ServoStyleContext* aParentContext,
|
||||
ComputedStyle* aParentContext,
|
||||
ServoRestyleState& aRestyleState,
|
||||
ServoPostTraversalFlags aFlags)
|
||||
{
|
||||
|
@ -848,22 +848,22 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
}
|
||||
|
||||
// TODO(emilio): We could avoid some refcount traffic here, specially in the
|
||||
// ServoStyleContext case, which uses atomic refcounting.
|
||||
// ComputedStyle case, which uses atomic refcounting.
|
||||
//
|
||||
// Hold the old style context alive, because it could become a dangling
|
||||
// pointer during the replacement. In practice it's not a huge deal, but
|
||||
// better not playing with dangling pointers if not needed.
|
||||
RefPtr<ServoStyleContext> oldStyleContext =
|
||||
styleFrame ? styleFrame->StyleContext()->AsServo() : nullptr;
|
||||
// Hold the ComputedStyle alive, because it could become a dangling pointer
|
||||
// during the replacement. In practice it's not a huge deal, but better not
|
||||
// playing with dangling pointers if not needed.
|
||||
RefPtr<ComputedStyle> oldComputedStyle =
|
||||
styleFrame ? styleFrame->Style()->AsServo() : nullptr;
|
||||
|
||||
nsStyleContext* displayContentsStyle = nullptr;
|
||||
ComputedStyle* displayContentsStyle = nullptr;
|
||||
// FIXME(emilio, bug 1303605): This can be simpler for Servo.
|
||||
// Note that we intentionally don't check for display: none content.
|
||||
if (!oldStyleContext) {
|
||||
if (!oldComputedStyle) {
|
||||
displayContentsStyle =
|
||||
PresContext()->FrameConstructor()->GetDisplayContentsStyleFor(aElement);
|
||||
if (displayContentsStyle) {
|
||||
oldStyleContext = displayContentsStyle->AsServo();
|
||||
oldComputedStyle = displayContentsStyle->AsServo();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -881,20 +881,20 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
ServoRestyleState& childrenRestyleState =
|
||||
thisFrameRestyleState ? *thisFrameRestyleState : aRestyleState;
|
||||
|
||||
RefPtr<ServoStyleContext> upToDateContext =
|
||||
RefPtr<ComputedStyle> upToDateContext =
|
||||
wasRestyled
|
||||
? aRestyleState.StyleSet().ResolveServoStyle(aElement)
|
||||
: oldStyleContext;
|
||||
: oldComputedStyle;
|
||||
|
||||
ServoPostTraversalFlags childrenFlags =
|
||||
wasRestyled ? ServoPostTraversalFlags::ParentWasRestyled
|
||||
: ServoPostTraversalFlags::Empty;
|
||||
|
||||
if (wasRestyled && oldStyleContext) {
|
||||
if (wasRestyled && oldComputedStyle) {
|
||||
MOZ_ASSERT(styleFrame || displayContentsStyle);
|
||||
MOZ_ASSERT(oldStyleContext->ComputedData() != upToDateContext->ComputedData());
|
||||
MOZ_ASSERT(oldComputedStyle->ComputedData() != upToDateContext->ComputedData());
|
||||
|
||||
upToDateContext->ResolveSameStructsAs(oldStyleContext);
|
||||
upToDateContext->ResolveSameStructsAs(oldComputedStyle);
|
||||
|
||||
// We want to walk all the continuations here, even the ones with different
|
||||
// styles. In practice, the only reason we get continuations with different
|
||||
|
@ -902,13 +902,13 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
// styles). But in that case, newContext is the right context for the
|
||||
// _later_ continuations anyway (the ones not affected by ::first-line), not
|
||||
// the earlier ones, so there is no point stopping right at the point when
|
||||
// we'd actually be setting the right style context.
|
||||
// we'd actually be setting the right ComputedStyle.
|
||||
//
|
||||
// This does mean that we may be setting the wrong style context on our
|
||||
// This does mean that we may be setting the wrong ComputedStyle on our
|
||||
// initial continuations; ::first-line fixes that up after the fact.
|
||||
for (nsIFrame* f = styleFrame; f; f = f->GetNextContinuation()) {
|
||||
MOZ_ASSERT_IF(f != styleFrame, !f->GetAdditionalStyleContext(0));
|
||||
f->SetStyleContext(upToDateContext);
|
||||
MOZ_ASSERT_IF(f != styleFrame, !f->GetAdditionalComputedStyle(0));
|
||||
f->SetComputedStyle(upToDateContext);
|
||||
}
|
||||
|
||||
if (MOZ_UNLIKELY(displayContentsStyle)) {
|
||||
|
@ -918,7 +918,7 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
}
|
||||
|
||||
if (styleFrame) {
|
||||
UpdateAdditionalStyleContexts(styleFrame, aRestyleState);
|
||||
UpdateAdditionalComputedStyles(styleFrame, aRestyleState);
|
||||
}
|
||||
|
||||
if (!aElement->GetParent()) {
|
||||
|
@ -944,7 +944,7 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
styleFrame, aElement, aRestyleState.ChangeList());
|
||||
|
||||
childrenFlags |= SendA11yNotifications(mPresContext, aElement,
|
||||
oldStyleContext,
|
||||
oldComputedStyle,
|
||||
upToDateContext, aFlags);
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ ServoRestyleManager::ProcessPostTraversal(
|
|||
static_cast<nsBlockFrame*>(styleFrame)->GetFirstLineFrame();
|
||||
if (firstLineFrame) {
|
||||
for (nsIFrame* kid : firstLineFrame->PrincipalChildList()) {
|
||||
ReparentStyleContext(kid);
|
||||
ReparentComputedStyle(kid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1045,7 +1045,7 @@ ServoRestyleManager::ProcessPostTraversalForText(
|
|||
ServoRestyleState::TableAwareParentFor(primaryFrame));
|
||||
}
|
||||
|
||||
nsStyleContext& newContext = aPostTraversalState.ComputeStyle(aTextNode);
|
||||
ComputedStyle& newContext = aPostTraversalState.ComputeStyle(aTextNode);
|
||||
aPostTraversalState.ComputeHintIfNeeded(aTextNode, primaryFrame, newContext);
|
||||
|
||||
// We want to walk all the continuations here, even the ones with different
|
||||
|
@ -1054,13 +1054,13 @@ ServoRestyleManager::ProcessPostTraversalForText(
|
|||
// newContext is the right context for the _later_ continuations anyway (the
|
||||
// ones not affected by ::first-line/::first-letter), not the earlier ones,
|
||||
// so there is no point stopping right at the point when we'd actually be
|
||||
// setting the right style context.
|
||||
// setting the right ComputedStyle.
|
||||
//
|
||||
// This does mean that we may be setting the wrong style context on our
|
||||
// This does mean that we may be setting the wrong ComputedStyle on our
|
||||
// initial continuations; ::first-line/::first-letter fix that up after the
|
||||
// fact.
|
||||
for (nsIFrame* f = primaryFrame; f; f = f->GetNextContinuation()) {
|
||||
f->SetStyleContext(&newContext);
|
||||
f->SetComputedStyle(&newContext);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1159,8 +1159,8 @@ ServoRestyleManager::DoProcessPendingRestyles(ServoTraversalFlags aFlags)
|
|||
nsStyleChangeList currentChanges(StyleBackendType::Servo);
|
||||
bool anyStyleChanged = false;
|
||||
|
||||
// Recreate style contexts, and queue up change hints (which also handle
|
||||
// lazy frame construction).
|
||||
// Recreate styles , and queue up change hints (which also handle lazy frame
|
||||
// construction).
|
||||
{
|
||||
AutoRestyleTimelineMarker marker(presContext->GetDocShell(), false);
|
||||
DocumentStyleRootIterator iter(doc->GetServoRestyleRoot());
|
||||
|
@ -1525,7 +1525,7 @@ ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
|||
}
|
||||
|
||||
nsresult
|
||||
ServoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
||||
ServoRestyleManager::ReparentComputedStyle(nsIFrame* aFrame)
|
||||
{
|
||||
// This is only called when moving frames in or out of the first-line
|
||||
// pseudo-element (or one of its descendants). We can't say much about
|
||||
|
@ -1545,18 +1545,18 @@ ServoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
|||
}
|
||||
#endif
|
||||
|
||||
DoReparentStyleContext(aFrame, *StyleSet());
|
||||
DoReparentComputedStyle(aFrame, *StyleSet());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
||||
ServoRestyleManager::DoReparentComputedStyle(nsIFrame* aFrame,
|
||||
ServoStyleSet& aStyleSet)
|
||||
{
|
||||
if (aFrame->IsBackdropFrame()) {
|
||||
// Style context of backdrop frame has no parent style context, and
|
||||
// thus we do not need to reparent it.
|
||||
// Style context of backdrop frame has no parent style, and thus we do not
|
||||
// need to reparent it.
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1586,22 +1586,22 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
|||
nsPlaceholderFrame::GetRealFrameForPlaceholder(aFrame);
|
||||
MOZ_ASSERT(outOfFlow, "no out-of-flow frame");
|
||||
for (; outOfFlow; outOfFlow = outOfFlow->GetNextContinuation()) {
|
||||
DoReparentStyleContext(outOfFlow, aStyleSet);
|
||||
DoReparentComputedStyle(outOfFlow, aStyleSet);
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* providerFrame;
|
||||
nsStyleContext* newParentContext =
|
||||
aFrame->GetParentStyleContext(&providerFrame);
|
||||
ComputedStyle* newParentContext =
|
||||
aFrame->GetParentComputedStyle(&providerFrame);
|
||||
// If our provider is our child, we want to reparent it first, because we
|
||||
// inherit style from it.
|
||||
bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
|
||||
nsIFrame* providerChild = nullptr;
|
||||
if (isChild) {
|
||||
DoReparentStyleContext(providerFrame, aStyleSet);
|
||||
// Get the style context again after ReparentStyleContext() which might have
|
||||
DoReparentComputedStyle(providerFrame, aStyleSet);
|
||||
// Get the style again after ReparentComputedStyle() which might have
|
||||
// changed it.
|
||||
newParentContext = providerFrame->StyleContext();
|
||||
newParentContext = providerFrame->Style();
|
||||
providerChild = providerFrame;
|
||||
MOZ_ASSERT(!providerFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW),
|
||||
"Out of flow provider?");
|
||||
|
@ -1612,7 +1612,7 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
|||
// its descendants, because those may have styles that inherit from the
|
||||
// parent of this frame (e.g. non-anonymous columns in an anonymous
|
||||
// colgroup).
|
||||
MOZ_ASSERT(aFrame->StyleContext()->IsNonInheritingAnonBox(),
|
||||
MOZ_ASSERT(aFrame->Style()->IsNonInheritingAnonBox(),
|
||||
"Why did this frame not end up with a parent context?");
|
||||
ReparentFrameDescendants(aFrame, providerChild, aStyleSet);
|
||||
return;
|
||||
|
@ -1621,23 +1621,23 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
|||
bool isElement = aFrame->GetContent()->IsElement();
|
||||
|
||||
// We probably don't want to initiate transitions from
|
||||
// ReparentStyleContext, since we call it during frame
|
||||
// ReparentComputedStyle, since we call it during frame
|
||||
// construction rather than in response to dynamic changes.
|
||||
// Also see the comment at the start of
|
||||
// nsTransitionManager::ConsiderInitiatingTransition.
|
||||
//
|
||||
// We don't try to do the fancy copying from previous continuations that
|
||||
// GeckoRestyleManager does here, because that relies on knowing the parents
|
||||
// of style contexts, and we don't know those.
|
||||
ServoStyleContext* oldContext = aFrame->StyleContext()->AsServo();
|
||||
// of ComputedStyles, and we don't know those.
|
||||
ComputedStyle* oldContext = aFrame->Style()->AsServo();
|
||||
Element* ourElement =
|
||||
oldContext->GetPseudoType() == CSSPseudoElementType::NotPseudo &&
|
||||
isElement ?
|
||||
aFrame->GetContent()->AsElement() :
|
||||
nullptr;
|
||||
ServoStyleContext* newParent = newParentContext->AsServo();
|
||||
ComputedStyle* newParent = newParentContext->AsServo();
|
||||
|
||||
ServoStyleContext* newParentIgnoringFirstLine;
|
||||
ComputedStyle* newParentIgnoringFirstLine;
|
||||
if (newParent->GetPseudoType() == CSSPseudoElementType::firstLine) {
|
||||
MOZ_ASSERT(providerFrame && providerFrame->GetParent()->
|
||||
IsFrameOfType(nsIFrame::eBlockFrame),
|
||||
|
@ -1649,7 +1649,7 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
|||
nsIFrame* blockFrame = providerFrame->GetParent();
|
||||
nsIFrame* correctedFrame =
|
||||
nsFrame::CorrectStyleParentFrame(blockFrame, oldContext->GetPseudo());
|
||||
newParentIgnoringFirstLine = correctedFrame->StyleContext()->AsServo();
|
||||
newParentIgnoringFirstLine = correctedFrame->Style()->AsServo();
|
||||
} else {
|
||||
newParentIgnoringFirstLine = newParent;
|
||||
}
|
||||
|
@ -1666,32 +1666,32 @@ ServoRestyleManager::DoReparentStyleContext(nsIFrame* aFrame,
|
|||
oldContext->GetPseudo());
|
||||
}
|
||||
}
|
||||
ServoStyleContext* layoutParent = providerFrame->StyleContext()->AsServo();
|
||||
ComputedStyle* layoutParent = providerFrame->Style()->AsServo();
|
||||
|
||||
RefPtr<ServoStyleContext> newContext =
|
||||
aStyleSet.ReparentStyleContext(oldContext,
|
||||
RefPtr<ComputedStyle> newContext =
|
||||
aStyleSet.ReparentComputedStyle(oldContext,
|
||||
newParent,
|
||||
newParentIgnoringFirstLine,
|
||||
layoutParent,
|
||||
ourElement);
|
||||
aFrame->SetStyleContext(newContext);
|
||||
aFrame->SetComputedStyle(newContext);
|
||||
|
||||
// This logic somewhat mirrors the logic in
|
||||
// ServoRestyleManager::ProcessPostTraversal.
|
||||
if (isElement) {
|
||||
// We can't use UpdateAdditionalStyleContexts as-is because it needs a
|
||||
// We can't use UpdateAdditionalComputedStyles as-is because it needs a
|
||||
// ServoRestyleState and maintaining one of those during a _frametree_
|
||||
// traversal is basically impossible.
|
||||
uint32_t index = 0;
|
||||
while (nsStyleContext* oldAdditionalContext =
|
||||
aFrame->GetAdditionalStyleContext(index)) {
|
||||
RefPtr<ServoStyleContext> newAdditionalContext =
|
||||
aStyleSet.ReparentStyleContext(oldAdditionalContext->AsServo(),
|
||||
while (ComputedStyle* oldAdditionalContext =
|
||||
aFrame->GetAdditionalComputedStyle(index)) {
|
||||
RefPtr<ComputedStyle> newAdditionalContext =
|
||||
aStyleSet.ReparentComputedStyle(oldAdditionalContext->AsServo(),
|
||||
newContext,
|
||||
newContext,
|
||||
newContext,
|
||||
nullptr);
|
||||
aFrame->SetAdditionalStyleContext(index, newAdditionalContext);
|
||||
aFrame->SetAdditionalComputedStyle(index, newAdditionalContext);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
@ -1724,7 +1724,7 @@ ServoRestyleManager::ReparentFrameDescendants(nsIFrame* aFrame,
|
|||
// only do frames that are in flow
|
||||
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
|
||||
child != aProviderChild) {
|
||||
DoReparentStyleContext(child, aStyleSet);
|
||||
DoReparentComputedStyle(child, aStyleSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ namespace mozilla {
|
|||
class ServoRestyleState
|
||||
{
|
||||
public:
|
||||
ServoRestyleState(ServoStyleSet& aStyleSet, nsStyleChangeList& aChangeList,
|
||||
ServoRestyleState(ServoStyleSet& aStyleSet,
|
||||
nsStyleChangeList& aChangeList,
|
||||
nsTArray<nsIFrame*>& aPendingWrapperRestyles)
|
||||
: mStyleSet(aStyleSet)
|
||||
, mChangeList(aChangeList)
|
||||
|
@ -228,12 +229,12 @@ public:
|
|||
|
||||
// This is only used to reparent things when moving them in/out of the
|
||||
// ::first-line. Once we get rid of the Gecko style system, we should rename
|
||||
// this method accordingly (e.g. to ReparentStyleContextForFirstLine).
|
||||
nsresult ReparentStyleContext(nsIFrame* aFrame);
|
||||
// this method accordingly (e.g. to ReparentComputedStyleForFirstLine).
|
||||
nsresult ReparentComputedStyle(nsIFrame* aFrame);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Reparent the descendants of aFrame. This is used by ReparentStyleContext
|
||||
* Reparent the descendants of aFrame. This is used by ReparentComputedStyle
|
||||
* and shouldn't be called by anyone else. aProviderChild, if non-null, is a
|
||||
* child that was the style parent for aFrame and hence shouldn't be
|
||||
* reparented.
|
||||
|
@ -292,7 +293,7 @@ private:
|
|||
* element or any descendant or sibling.
|
||||
*/
|
||||
bool ProcessPostTraversal(Element* aElement,
|
||||
ServoStyleContext* aParentContext,
|
||||
ComputedStyle* aParentContext,
|
||||
ServoRestyleState& aRestyleState,
|
||||
ServoPostTraversalFlags aFlags);
|
||||
|
||||
|
@ -319,10 +320,9 @@ private:
|
|||
|
||||
void DoProcessPendingRestyles(ServoTraversalFlags aFlags);
|
||||
|
||||
// Function to do the actual (recursive) work of ReparentStyleContext, once we
|
||||
// Function to do the actual (recursive) work of ReparentComputedStyle, once we
|
||||
// have asserted the invariants that only hold on the initial call.
|
||||
void DoReparentStyleContext(nsIFrame* aFrame,
|
||||
ServoStyleSet& aStyleSet);
|
||||
void DoReparentComputedStyle(nsIFrame* aFrame, ServoStyleSet& aStyleSet);
|
||||
|
||||
// We use a separate data structure from nsStyleChangeList because we need a
|
||||
// frame to create nsStyleChangeList entries, and the primary frame may not be
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define mozilla_UndisplayedNode_h
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace mozilla {
|
|||
*/
|
||||
struct UndisplayedNode : public LinkedListElement<UndisplayedNode>
|
||||
{
|
||||
UndisplayedNode(nsIContent* aContent, nsStyleContext* aStyle)
|
||||
UndisplayedNode(nsIContent* aContent, ComputedStyle* aStyle)
|
||||
: mContent(aContent)
|
||||
, mStyle(aStyle)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ struct UndisplayedNode : public LinkedListElement<UndisplayedNode>
|
|||
~UndisplayedNode() { MOZ_COUNT_DTOR(mozilla::UndisplayedNode); }
|
||||
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
RefPtr<nsStyleContext> mStyle;
|
||||
RefPtr<ComputedStyle> mStyle;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -74,29 +74,29 @@ IsIsolateControl(char16_t aChar)
|
|||
return aChar == kLRI || aChar == kRLI || aChar == kFSI;
|
||||
}
|
||||
|
||||
// Given a style context, return any bidi control character necessary to
|
||||
// Given a ComputedStyle, return any bidi control character necessary to
|
||||
// implement style properties that override directionality (i.e. if it has
|
||||
// unicode-bidi:bidi-override, or text-orientation:upright in vertical
|
||||
// writing mode) when applying the bidi algorithm.
|
||||
//
|
||||
// Returns 0 if no override control character is implied by this style.
|
||||
static char16_t
|
||||
GetBidiOverride(nsStyleContext* aStyleContext)
|
||||
GetBidiOverride(ComputedStyle* aComputedStyle)
|
||||
{
|
||||
const nsStyleVisibility* vis = aStyleContext->StyleVisibility();
|
||||
const nsStyleVisibility* vis = aComputedStyle->StyleVisibility();
|
||||
if ((vis->mWritingMode == NS_STYLE_WRITING_MODE_VERTICAL_RL ||
|
||||
vis->mWritingMode == NS_STYLE_WRITING_MODE_VERTICAL_LR) &&
|
||||
vis->mTextOrientation == NS_STYLE_TEXT_ORIENTATION_UPRIGHT) {
|
||||
return kLRO;
|
||||
}
|
||||
const nsStyleTextReset* text = aStyleContext->StyleTextReset();
|
||||
const nsStyleTextReset* text = aComputedStyle->StyleTextReset();
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_BIDI_OVERRIDE) {
|
||||
return NS_STYLE_DIRECTION_RTL == vis->mDirection ? kRLO : kLRO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Given a style context, return any bidi control character necessary to
|
||||
// Given a ComputedStyle, return any bidi control character necessary to
|
||||
// implement style properties that affect bidi resolution (i.e. if it
|
||||
// has unicode-bidiembed, isolate, or plaintext) when applying the bidi
|
||||
// algorithm.
|
||||
|
@ -107,10 +107,10 @@ GetBidiOverride(nsStyleContext* aStyleContext)
|
|||
// because in the case of unicode-bidi:isolate-override we need both
|
||||
// FSI and LRO/RLO.
|
||||
static char16_t
|
||||
GetBidiControl(nsStyleContext* aStyleContext)
|
||||
GetBidiControl(ComputedStyle* aComputedStyle)
|
||||
{
|
||||
const nsStyleVisibility* vis = aStyleContext->StyleVisibility();
|
||||
const nsStyleTextReset* text = aStyleContext->StyleTextReset();
|
||||
const nsStyleVisibility* vis = aComputedStyle->StyleVisibility();
|
||||
const nsStyleTextReset* text = aComputedStyle->StyleTextReset();
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_EMBED) {
|
||||
return NS_STYLE_DIRECTION_RTL == vis->mDirection ? kRLE : kLRE;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ struct MOZ_STACK_CLASS BidiParagraphData
|
|||
: mPresContext(aBlockFrame->PresContext())
|
||||
, mIsVisual(mPresContext->IsVisualMode())
|
||||
, mRequiresBidi(false)
|
||||
, mParaLevel(nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->StyleContext()))
|
||||
, mParaLevel(nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->Style()))
|
||||
, mPrevContent(nullptr)
|
||||
#ifdef DEBUG
|
||||
, mCurrentBlock(aBlockFrame)
|
||||
|
@ -710,7 +710,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
|
|||
// values of unicode-bidi property are redundant on block elements.
|
||||
// unicode-bidi:plaintext on a block element is handled by block frame
|
||||
// via using nsIFrame::GetWritingMode(nsIFrame*).
|
||||
char16_t ch = GetBidiOverride(aBlockFrame->StyleContext());
|
||||
char16_t ch = GetBidiOverride(aBlockFrame->Style());
|
||||
if (ch != 0) {
|
||||
bpd.PushBidiControl(ch);
|
||||
bpd.mRequiresBidi = true;
|
||||
|
@ -1080,13 +1080,13 @@ nsBidiPresUtils::TraverseFrames(nsBlockInFlowLineIterator* aLineIter,
|
|||
}
|
||||
}
|
||||
|
||||
auto DifferentBidiValues = [](nsStyleContext* aSC1, nsIFrame* aFrame2) {
|
||||
nsStyleContext* sc2 = aFrame2->StyleContext();
|
||||
auto DifferentBidiValues = [](ComputedStyle* aSC1, nsIFrame* aFrame2) {
|
||||
ComputedStyle* sc2 = aFrame2->Style();
|
||||
return GetBidiControl(aSC1) != GetBidiControl(sc2) ||
|
||||
GetBidiOverride(aSC1) != GetBidiOverride(sc2);
|
||||
};
|
||||
|
||||
nsStyleContext* sc = frame->StyleContext();
|
||||
ComputedStyle* sc = frame->Style();
|
||||
nsIFrame* nextContinuation = frame->GetNextContinuation();
|
||||
nsIFrame* prevContinuation = frame->GetPrevContinuation();
|
||||
bool isLastFrame = !nextContinuation ||
|
||||
|
@ -1313,7 +1313,7 @@ nsBidiPresUtils::ChildListMayRequireBidi(nsIFrame* aFirstChild,
|
|||
}
|
||||
|
||||
// If unicode-bidi properties are present, we should do bidi resolution.
|
||||
nsStyleContext* sc = frame->StyleContext();
|
||||
ComputedStyle* sc = frame->Style();
|
||||
if (GetBidiControl(sc) || GetBidiOverride(sc)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -2377,14 +2377,14 @@ nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const char16_t* a
|
|||
|
||||
/* static */
|
||||
nsBidiLevel
|
||||
nsBidiPresUtils::BidiLevelFromStyle(nsStyleContext* aStyleContext)
|
||||
nsBidiPresUtils::BidiLevelFromStyle(ComputedStyle* aComputedStyle)
|
||||
{
|
||||
if (aStyleContext->StyleTextReset()->mUnicodeBidi &
|
||||
if (aComputedStyle->StyleTextReset()->mUnicodeBidi &
|
||||
NS_STYLE_UNICODE_BIDI_PLAINTEXT) {
|
||||
return NSBIDI_DEFAULT_LTR;
|
||||
}
|
||||
|
||||
if (aStyleContext->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
if (aComputedStyle->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
|
||||
return NSBIDI_RTL;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ class nsIFrame;
|
|||
class nsBlockFrame;
|
||||
class nsPresContext;
|
||||
class nsBlockInFlowLineIterator;
|
||||
class nsStyleContext;
|
||||
struct nsSize;
|
||||
template<class T> class nsTHashtable;
|
||||
namespace mozilla {
|
||||
class WritingMode;
|
||||
class LogicalMargin;
|
||||
class ComputedStyle;
|
||||
class LogicalMargin;
|
||||
class WritingMode;
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
|
@ -371,7 +371,7 @@ public:
|
|||
* Otherwise returns NSBIDI_LTR or NSBIDI_RTL depending on the value of
|
||||
* |direction|
|
||||
*/
|
||||
static nsBidiLevel BidiLevelFromStyle(nsStyleContext* aStyleContext);
|
||||
static nsBidiLevel BidiLevelFromStyle(mozilla::ComputedStyle* aComputedStyle);
|
||||
|
||||
private:
|
||||
static nsresult
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -26,7 +26,6 @@
|
|||
#include "ScrollbarStyles.h"
|
||||
|
||||
struct nsFrameItems;
|
||||
class nsStyleContext;
|
||||
struct nsStyleDisplay;
|
||||
struct nsGenConInitializer;
|
||||
|
||||
|
@ -42,6 +41,8 @@ class nsFrameConstructorState;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class ComputedStyle;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class CharacterData;
|
||||
|
@ -53,6 +54,7 @@ class FlattenedChildIterator;
|
|||
class nsCSSFrameConstructor final : public nsFrameManager
|
||||
{
|
||||
public:
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
||||
|
@ -389,7 +391,7 @@ private:
|
|||
nsIFrame* aNewFrame,
|
||||
bool aAllowCounters = true);
|
||||
|
||||
already_AddRefed<nsStyleContext> ResolveStyleContext(nsIContent* aContent);
|
||||
already_AddRefed<ComputedStyle> ResolveComputedStyle(nsIContent* aContent);
|
||||
|
||||
// Add the frame construction items for the given aContent and aParentFrame
|
||||
// to the list. This might add more than one item in some rare cases.
|
||||
|
@ -413,7 +415,7 @@ private:
|
|||
// Make sure ShouldCreateItemsForChild() returned true before calling this.
|
||||
void DoAddFrameConstructionItems(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
bool aSuppressWhiteSpaceOptimizations,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
|
||||
|
@ -437,7 +439,7 @@ private:
|
|||
* @param aParentFrame the parent frame for the generated frame
|
||||
* @param aAttrNamespace the namespace of the attribute in question
|
||||
* @param aAttrName the localname of the attribute
|
||||
* @param aStyleContext the style context to use
|
||||
* @param aComputedStyle the style to use
|
||||
* @param aGeneratedContent the array of generated content to append the
|
||||
* created content to.
|
||||
* @param [out] aNewContent the content node we create
|
||||
|
@ -447,7 +449,7 @@ private:
|
|||
nsIFrame* aParentFrame,
|
||||
int32_t aAttrNamespace,
|
||||
nsAtom* aAttrName,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsCOMArray<nsIContent>& aGeneratedContent,
|
||||
nsIContent** aNewContent,
|
||||
nsIFrame** aNewFrame);
|
||||
|
@ -466,20 +468,19 @@ private:
|
|||
* The caller takes care of making it SetIsNativeAnonymousRoot, binding it
|
||||
* to the document, and creating frames for it.
|
||||
* @param aParentContent is the node that has the before/after style
|
||||
* @param aStyleContext is the 'before' or 'after' pseudo-element
|
||||
* style context
|
||||
* @param aComputedStyle is the 'before' or 'after' pseudo-element style.
|
||||
* @param aContentIndex is the index of the content item to create
|
||||
*/
|
||||
already_AddRefed<nsIContent> CreateGeneratedContent(nsFrameConstructorState& aState,
|
||||
mozilla::dom::Element* aParentContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
uint32_t aContentIndex);
|
||||
|
||||
// aFrame may be null; this method doesn't use it directly in any case.
|
||||
void CreateGeneratedContentItem(nsFrameConstructorState& aState,
|
||||
nsContainerFrame* aFrame,
|
||||
mozilla::dom::Element* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
CSSPseudoElementType aPseudoElement,
|
||||
FrameConstructionItemList& aItems);
|
||||
|
||||
|
@ -588,20 +589,20 @@ private:
|
|||
|
||||
@param nsIPresShell the presshell whose arena should be used to allocate
|
||||
the frame.
|
||||
@param nsStyleContext the style context to use for the frame. */
|
||||
typedef nsIFrame* (* FrameCreationFunc)(nsIPresShell*, nsStyleContext*);
|
||||
typedef nsContainerFrame* (* ContainerFrameCreationFunc)(nsIPresShell*, nsStyleContext*);
|
||||
typedef nsBlockFrame* (* BlockFrameCreationFunc)(nsIPresShell*, nsStyleContext*);
|
||||
@param ComputedStyle the style to use for the frame. */
|
||||
typedef nsIFrame* (* FrameCreationFunc)(nsIPresShell*, ComputedStyle*);
|
||||
typedef nsContainerFrame* (* ContainerFrameCreationFunc)(nsIPresShell*, ComputedStyle*);
|
||||
typedef nsBlockFrame* (* BlockFrameCreationFunc)(nsIPresShell*, ComputedStyle*);
|
||||
|
||||
/* A function that can be used to get a FrameConstructionData. Such
|
||||
a function is allowed to return null.
|
||||
|
||||
@param nsIContent the node for which the frame is being constructed.
|
||||
@param nsStyleContext the style context to be used for the frame.
|
||||
@param ComputedStyle the style to be used for the frame.
|
||||
*/
|
||||
struct FrameConstructionData;
|
||||
typedef const FrameConstructionData*
|
||||
(* FrameConstructionDataGetter)(Element*, nsStyleContext*);
|
||||
(* FrameConstructionDataGetter)(Element*, ComputedStyle*);
|
||||
|
||||
/* A constructor function that's used for complicated construction tasks.
|
||||
This is expected to create the new frame, initialize it, add whatever
|
||||
|
@ -617,7 +618,7 @@ private:
|
|||
@param aItem the frame construction item to use
|
||||
@param aParentFrame the frame to set as the parent of the
|
||||
newly-constructed frame.
|
||||
@param aStyleDisplay the display struct from aItem's mStyleContext
|
||||
@param aStyleDisplay the display struct from aItem's mComputedStyle
|
||||
@param aFrameItems the frame list to add the new frame (or its
|
||||
placeholder) to.
|
||||
@return the frame that was constructed. This frame is what the caller
|
||||
|
@ -781,7 +782,7 @@ private:
|
|||
{ _fcdata }
|
||||
#endif
|
||||
|
||||
/* Structure that has a FrameConstructionData and style context pseudo-type
|
||||
/* Structure that has a FrameConstructionData and style pseudo-type
|
||||
for a table pseudo-frame */
|
||||
struct PseudoParentData {
|
||||
const FrameConstructionData mFCData;
|
||||
|
@ -791,19 +792,19 @@ private:
|
|||
pseudo-frames as needed */
|
||||
static const PseudoParentData sPseudoParentData[eParentTypeCount];
|
||||
|
||||
/* A function that takes an integer, content, style context, and array of
|
||||
/* A function that takes an integer, content, style, and array of
|
||||
FrameConstructionDataByInts and finds the appropriate frame construction
|
||||
data to use and returns it. This can return null if none of the integers
|
||||
match or if the matching integer has a FrameConstructionDataGetter that
|
||||
returns null. */
|
||||
static const FrameConstructionData*
|
||||
FindDataByInt(int32_t aInt, Element* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
const FrameConstructionDataByInt* aDataPtr,
|
||||
uint32_t aDataLength);
|
||||
|
||||
/**
|
||||
* A function that takes a tag, content, style context, and array of
|
||||
* A function that takes a tag, content, style, and array of
|
||||
* FrameConstructionDataByTags and finds the appropriate frame construction
|
||||
* data to use and returns it.
|
||||
*
|
||||
|
@ -813,7 +814,7 @@ private:
|
|||
*/
|
||||
static const FrameConstructionData*
|
||||
FindDataByTag(nsAtom* aTag, Element* aElement,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
const FrameConstructionDataByTag* aDataPtr,
|
||||
uint32_t aDataLength,
|
||||
bool* aTagFound = nullptr);
|
||||
|
@ -858,13 +859,13 @@ private:
|
|||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
PendingBinding* aPendingBinding,
|
||||
already_AddRefed<nsStyleContext>&& aStyleContext,
|
||||
already_AddRefed<ComputedStyle>&& aComputedStyle,
|
||||
bool aSuppressWhiteSpaceOptimizations,
|
||||
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
|
||||
{
|
||||
FrameConstructionItem* item =
|
||||
new (aFCtor) FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID,
|
||||
aPendingBinding, aStyleContext,
|
||||
aPendingBinding, aComputedStyle,
|
||||
aSuppressWhiteSpaceOptimizations,
|
||||
aAnonChildren);
|
||||
mItems.insertBack(item);
|
||||
|
@ -880,13 +881,13 @@ private:
|
|||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
PendingBinding* aPendingBinding,
|
||||
already_AddRefed<nsStyleContext>&& aStyleContext,
|
||||
already_AddRefed<ComputedStyle>&& aComputedStyle,
|
||||
bool aSuppressWhiteSpaceOptimizations,
|
||||
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren)
|
||||
{
|
||||
FrameConstructionItem* item =
|
||||
new (aFCtor) FrameConstructionItem(aFCData, aContent, aTag, aNameSpaceID,
|
||||
aPendingBinding, aStyleContext,
|
||||
aPendingBinding, aComputedStyle,
|
||||
aSuppressWhiteSpaceOptimizations,
|
||||
aAnonChildren);
|
||||
mItems.insertFront(item);
|
||||
|
@ -896,8 +897,8 @@ private:
|
|||
}
|
||||
|
||||
void AppendUndisplayedItem(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext) {
|
||||
mUndisplayedItems.AppendElement(UndisplayedItem(aContent, aStyleContext));
|
||||
ComputedStyle* aComputedStyle) {
|
||||
mUndisplayedItems.AppendElement(UndisplayedItem(aContent, aComputedStyle));
|
||||
}
|
||||
|
||||
void InlineItemAdded() { ++mInlineCount; }
|
||||
|
@ -1050,7 +1051,7 @@ private:
|
|||
if (!mUndisplayedItems.IsEmpty() && mTriedConstructingFrames) {
|
||||
for (uint32_t i = 0; i < mUndisplayedItems.Length(); ++i) {
|
||||
UndisplayedItem& item = mUndisplayedItems[i];
|
||||
aFCtor->RegisterDisplayNoneStyleFor(item.mContent, item.mStyleContext);
|
||||
aFCtor->RegisterDisplayNoneStyleFor(item.mContent, item.mComputedStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1076,12 +1077,12 @@ private:
|
|||
void* operator new(size_t, void* aPtr) { return aPtr; }
|
||||
|
||||
struct UndisplayedItem {
|
||||
UndisplayedItem(nsIContent* aContent, nsStyleContext* aStyleContext) :
|
||||
mContent(aContent), mStyleContext(aStyleContext)
|
||||
UndisplayedItem(nsIContent* aContent, ComputedStyle* aComputedStyle) :
|
||||
mContent(aContent), mComputedStyle(aComputedStyle)
|
||||
{}
|
||||
|
||||
nsIContent * const mContent;
|
||||
RefPtr<nsStyleContext> mStyleContext;
|
||||
RefPtr<ComputedStyle> mComputedStyle;
|
||||
};
|
||||
|
||||
// Adjust our various counts for aItem being added or removed. aDelta
|
||||
|
@ -1135,11 +1136,11 @@ private:
|
|||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
PendingBinding* aPendingBinding,
|
||||
already_AddRefed<nsStyleContext>& aStyleContext,
|
||||
already_AddRefed<ComputedStyle>& aComputedStyle,
|
||||
bool aSuppressWhiteSpaceOptimizations,
|
||||
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren) :
|
||||
mFCData(aFCData), mContent(aContent), mTag(aTag),
|
||||
mPendingBinding(aPendingBinding), mStyleContext(aStyleContext),
|
||||
mPendingBinding(aPendingBinding), mComputedStyle(aComputedStyle),
|
||||
mNameSpaceID(aNameSpaceID),
|
||||
mSuppressWhiteSpaceOptimizations(aSuppressWhiteSpaceOptimizations),
|
||||
mIsText(false), mIsGeneratedContent(false),
|
||||
|
@ -1231,8 +1232,8 @@ private:
|
|||
// FrameConstructionItem to push its mPendingBinding as the current
|
||||
// insertion point before doing so and pop it afterward.
|
||||
PendingBinding* mPendingBinding;
|
||||
// The style context to use for creating the new frame.
|
||||
RefPtr<nsStyleContext> mStyleContext;
|
||||
// The style to use for creating the new frame.
|
||||
RefPtr<ComputedStyle> mComputedStyle;
|
||||
// The XBL-resolved namespace to use for frame construction.
|
||||
int32_t mNameSpaceID;
|
||||
// Whether optimizations to skip constructing textframes around
|
||||
|
@ -1352,7 +1353,7 @@ private:
|
|||
* a ruby base box or a ruby text box.
|
||||
*/
|
||||
void WrapItemsInPseudoRubyLeafBox(FCItemIterator& aIter,
|
||||
nsStyleContext* aParentStyle,
|
||||
ComputedStyle* aParentStyle,
|
||||
nsIContent* aParentContent);
|
||||
|
||||
/**
|
||||
|
@ -1361,7 +1362,7 @@ private:
|
|||
*/
|
||||
inline void WrapItemsInPseudoRubyLevelContainer(
|
||||
nsFrameConstructorState& aState, FCItemIterator& aIter,
|
||||
nsStyleContext* aParentStyle, nsIContent* aParentContent);
|
||||
ComputedStyle* aParentStyle, nsIContent* aParentContent);
|
||||
|
||||
/**
|
||||
* Function to trim leading and trailing whitespaces.
|
||||
|
@ -1389,7 +1390,7 @@ private:
|
|||
* Function to wrap consecutive items into a pseudo parent.
|
||||
*/
|
||||
inline void WrapItemsInPseudoParent(nsIContent* aParentContent,
|
||||
nsStyleContext* aParentStyle,
|
||||
ComputedStyle* aParentStyle,
|
||||
ParentType aWrapperType,
|
||||
FCItemIterator& aIter,
|
||||
const FCItemIterator& aEndIter);
|
||||
|
@ -1407,7 +1408,7 @@ private:
|
|||
* adjusted to point to the right parent frame.
|
||||
* @param aFCData the FrameConstructionData that would be used for frame
|
||||
* construction.
|
||||
* @param aStyleContext the style context for aChildContent
|
||||
* @param aComputedStyle the style for aChildContent
|
||||
*/
|
||||
// XXXbz this function should really go away once we rework pseudo-frame
|
||||
// handling to be better. This should simply be part of the job of
|
||||
|
@ -1415,7 +1416,7 @@ private:
|
|||
// be kept track of in the state...
|
||||
void AdjustParentFrame(nsContainerFrame** aParentFrame,
|
||||
const FrameConstructionData* aFCData,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// END TABLE SECTION
|
||||
|
||||
|
@ -1465,7 +1466,7 @@ private:
|
|||
nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
// If aPossibleTextContent is a text node and doesn't have a frame, append a
|
||||
|
@ -1491,18 +1492,18 @@ private:
|
|||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
nsIFrame* aParentFrame,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
// HTML data-finding helper functions
|
||||
static const FrameConstructionData*
|
||||
FindImgData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindImgData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindImgControlData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindImgControlData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindInputData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindInputData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindObjectData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindObjectData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindCanvasData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindCanvasData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
|
||||
/* Construct a frame from the given FrameConstructionItem. This function
|
||||
will handle adding the frame to frame lists, processing children, setting
|
||||
|
@ -1543,7 +1544,7 @@ private:
|
|||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
bool aSuppressWhiteSpaceOptimizations,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
uint32_t aFlags,
|
||||
nsTArray<nsIAnonymousContentCreator::ContentInfo>* aAnonChildren,
|
||||
FrameConstructionItemList& aItems);
|
||||
|
@ -1584,32 +1585,32 @@ private:
|
|||
static const FrameConstructionData* FindMathMLData(Element* aElement,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// Function to find FrameConstructionData for aContent. Will return
|
||||
// null if aContent is not XUL.
|
||||
static const FrameConstructionData* FindXULTagData(Element* aElement,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
// XUL data-finding helper functions and structures
|
||||
#ifdef MOZ_XUL
|
||||
static const FrameConstructionData*
|
||||
FindPopupGroupData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindPopupGroupData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
// sXULTextBoxData used for both labels and descriptions
|
||||
static const FrameConstructionData sXULTextBoxData;
|
||||
static const FrameConstructionData*
|
||||
FindXULLabelData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindXULLabelData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindXULDescriptionData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindXULDescriptionData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
#ifdef XP_MACOSX
|
||||
static const FrameConstructionData*
|
||||
FindXULMenubarData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindXULMenubarData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
#endif /* XP_MACOSX */
|
||||
static const FrameConstructionData*
|
||||
FindXULListBoxBodyData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindXULListBoxBodyData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindXULListItemData(Element* aElement, nsStyleContext* aStyleContext);
|
||||
FindXULListItemData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
#endif /* MOZ_XUL */
|
||||
|
||||
// Function to find FrameConstructionData for aContent using one of the XUL
|
||||
|
@ -1620,7 +1621,7 @@ private:
|
|||
static const FrameConstructionData*
|
||||
FindXULDisplayData(const nsStyleDisplay* aDisplay,
|
||||
Element* aElement,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
/**
|
||||
* Constructs an outer frame, an anonymous child that wraps its real
|
||||
|
@ -1662,13 +1663,13 @@ private:
|
|||
nsIFrame* aParentFrame,
|
||||
bool aIsWithinSVGText,
|
||||
bool aAllowsTextPathChild,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
/* Not static because it does PropagateScrollToViewport. If this
|
||||
changes, make this static */
|
||||
const FrameConstructionData*
|
||||
FindDisplayData(const nsStyleDisplay* aDisplay, Element* aElement,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
/**
|
||||
* Construct a scrollable block frame
|
||||
|
@ -1737,13 +1738,13 @@ private:
|
|||
*
|
||||
* @param aState the frame construction state
|
||||
* @param aContent the content node whose children need frames
|
||||
* @param aStyleContext the style context for aContent
|
||||
* @param aComputedStyle the style for aContent
|
||||
* @param aParentFrame the frame to use as the parent frame for the new in-flow
|
||||
* kids. Note that this must be its own content insertion frame, but
|
||||
* need not be be the primary frame for aContent. This frame will be
|
||||
* pushed as the float containing block, as needed. aFrame is also
|
||||
* used to find the parent style context for the kids' style contexts
|
||||
* (not necessary aFrame's style context).
|
||||
* used to find the parent style for the kids' style
|
||||
* (not necessary aFrame's style).
|
||||
* @param aCanHaveGeneratedContent Whether to allow :before and
|
||||
* :after styles on the parent.
|
||||
* @param aFrameItems the list in which we should place the in-flow children
|
||||
|
@ -1757,7 +1758,7 @@ private:
|
|||
*/
|
||||
void ProcessChildren(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsContainerFrame* aParentFrame,
|
||||
const bool aCanHaveGeneratedContent,
|
||||
nsFrameItems& aFrameItems,
|
||||
|
@ -1790,16 +1791,16 @@ private:
|
|||
void
|
||||
BuildScrollFrame(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aContentStyle,
|
||||
ComputedStyle* aContentStyle,
|
||||
nsIFrame* aScrolledFrame,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsContainerFrame*& aNewFrame);
|
||||
|
||||
// Builds the initial ScrollFrame
|
||||
already_AddRefed<nsStyleContext>
|
||||
already_AddRefed<ComputedStyle>
|
||||
BeginBuildingScrollFrame(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aContentStyle,
|
||||
ComputedStyle* aContentStyle,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsAtom* aScrolledPseudo,
|
||||
bool aIsRoot,
|
||||
|
@ -1820,7 +1821,7 @@ private:
|
|||
nsContainerFrame* aScrolledFrame,
|
||||
nsIContent* aContent,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
bool aBuildCombobox,
|
||||
PendingBinding* aPendingBinding,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
@ -1852,38 +1853,36 @@ private:
|
|||
nsIFrame* aFrame,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
nsIFrame* CreateContinuingTableFrame(nsIPresShell* aPresShell,
|
||||
nsIFrame* aFrame,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
// Methods support creating block frames and their children
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
GetFirstLetterStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
already_AddRefed<ComputedStyle>
|
||||
GetFirstLetterStyle(nsIContent* aContent, ComputedStyle* aComputedStyle);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
GetFirstLineStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
already_AddRefed<ComputedStyle>
|
||||
GetFirstLineStyle(nsIContent* aContent, ComputedStyle* aComputedStyle);
|
||||
|
||||
bool ShouldHaveFirstLetterStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// Check whether a given block has first-letter style. Make sure to
|
||||
// only pass in blocks! And don't pass in null either.
|
||||
bool HasFirstLetterStyle(nsIFrame* aBlockFrame);
|
||||
|
||||
bool ShouldHaveFirstLineStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
void ShouldHaveSpecialBlockStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
bool* aHaveFirstLetterStyle,
|
||||
bool* aHaveFirstLineStyle);
|
||||
|
||||
|
@ -1907,7 +1906,7 @@ private:
|
|||
nsIContent* aContent,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsContainerFrame* aContentParentFrame,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsContainerFrame** aNewFrame,
|
||||
nsFrameItems& aFrameItems,
|
||||
nsIFrame* aPositionedFrameForAbsPosContainer,
|
||||
|
@ -1980,8 +1979,8 @@ private:
|
|||
nsIContent* aTextContent,
|
||||
nsIFrame* aTextFrame,
|
||||
nsContainerFrame* aParentFrame,
|
||||
nsStyleContext* aParentStyleContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aParentComputedStyle,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsFrameItems& aResult);
|
||||
|
||||
void CreateLetterFrame(nsContainerFrame* aBlockFrame,
|
||||
|
@ -2161,16 +2160,15 @@ private:
|
|||
void CountersDirty();
|
||||
|
||||
/**
|
||||
* Add the pair (aContent, aStyleContext) to the undisplayed items
|
||||
* Add the pair (aContent, aComputedStyle) to the undisplayed items
|
||||
* in aList as needed. This method enforces the invariant that all
|
||||
* style contexts in the undisplayed content map must be non-pseudo
|
||||
* contexts and also handles unbinding undisplayed generated content
|
||||
* as needed.
|
||||
* styles in the undisplayed content map must be non-pseudo contexts and also
|
||||
* handles unbinding undisplayed generated content as needed.
|
||||
*/
|
||||
void SetAsUndisplayedContent(nsFrameConstructorState& aState,
|
||||
FrameConstructionItemList& aList,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
bool aIsGeneratedContent);
|
||||
// Create touch caret frame.
|
||||
void ConstructAnonymousContentForCanvas(nsFrameConstructorState& aState,
|
||||
|
|
|
@ -136,7 +136,7 @@ enum nsChangeHint : uint32_t {
|
|||
* has changed whether the frame is a container for fixed-pos or abs-pos
|
||||
* elements, but reframing is otherwise not needed.
|
||||
*
|
||||
* Note that nsStyleContext::CalcStyleDifference adjusts results
|
||||
* Note that ComputedStyle::CalcStyleDifference adjusts results
|
||||
* returned by style struct CalcDifference methods to return this hint
|
||||
* only if there was a change to whether the element's overall style
|
||||
* indicates that it establishes a containing block.
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
#include "nscore.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "plhash.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsILayoutHistoryState.h"
|
||||
#include "nsPresState.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/UndisplayedNode.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -41,10 +41,10 @@ using namespace mozilla::dom;
|
|||
|
||||
/**
|
||||
* The undisplayed map is a class that maps a parent content node to the
|
||||
* undisplayed content children, and their style contexts.
|
||||
* undisplayed content children, and their ComputedStyles.
|
||||
*
|
||||
* The linked list of nodes holds strong references to the style contexts and
|
||||
* the content.
|
||||
* The linked list of nodes holds strong references to the ComputedStyle and the
|
||||
* content.
|
||||
*/
|
||||
class nsFrameManager::UndisplayedMap :
|
||||
private nsClassHashtable<nsPtrHashKey<nsIContent>,
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
void AddNodeFor(nsIContent* aParentContent,
|
||||
nsIContent* aChild,
|
||||
nsStyleContext* aStyle);
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
void RemoveNodeFor(nsIContent* aParentContent, UndisplayedNode* aNode);
|
||||
|
||||
|
@ -135,8 +135,8 @@ nsFrameManager::ParentForUndisplayedMap(const nsIContent* aContent)
|
|||
return parent;
|
||||
}
|
||||
|
||||
/* static */ nsStyleContext*
|
||||
nsFrameManager::GetStyleContextInMap(UndisplayedMap* aMap,
|
||||
/* static */ ComputedStyle*
|
||||
nsFrameManager::GetComputedStyleInMap(UndisplayedMap* aMap,
|
||||
const nsIContent* aContent)
|
||||
{
|
||||
UndisplayedNode* node = GetUndisplayedNodeInMapFor(aMap, aContent);
|
||||
|
@ -181,19 +181,19 @@ nsFrameManager::GetAllRegisteredDisplayNoneStylesIn(nsIContent* aParentContent)
|
|||
}
|
||||
|
||||
/* static */ void
|
||||
nsFrameManager::SetStyleContextInMap(UndisplayedMap* aMap,
|
||||
nsFrameManager::SetComputedStyleInMap(UndisplayedMap* aMap,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(!aStyleContext->GetPseudo(),
|
||||
MOZ_ASSERT(!aComputedStyle->GetPseudo(),
|
||||
"Should only have actual elements here");
|
||||
|
||||
#if defined(DEBUG_UNDISPLAYED_MAP) || defined(DEBUG_DISPLAY_BOX_CONTENTS_MAP)
|
||||
static int i = 0;
|
||||
printf("SetStyleContextInMap(%d): p=%p \n", i++, (void *)aContent);
|
||||
printf("SetComputedStyleInMap(%d): p=%p \n", i++, (void *)aContent);
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(!GetStyleContextInMap(aMap, aContent),
|
||||
MOZ_ASSERT(!GetComputedStyleInMap(aMap, aContent),
|
||||
"Already have an entry for aContent");
|
||||
|
||||
// This function is an entry point into UndisplayedMap handling code, so the
|
||||
|
@ -204,7 +204,7 @@ nsFrameManager::SetStyleContextInMap(UndisplayedMap* aMap,
|
|||
MOZ_ASSERT(parent || !aContent->GetParent(), "no non-elements");
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIPresShell* shell = aStyleContext->PresContext()->PresShell();
|
||||
nsIPresShell* shell = aComputedStyle->PresContext()->PresShell();
|
||||
NS_ASSERTION(parent || (shell && shell->GetDocument() &&
|
||||
shell->GetDocument()->GetRootElement() == aContent),
|
||||
"undisplayed content must have a parent, unless it's the root "
|
||||
|
@ -220,29 +220,29 @@ nsFrameManager::SetStyleContextInMap(UndisplayedMap* aMap,
|
|||
parent->SetMayHaveChildrenWithLayoutBoxesDisabled();
|
||||
}
|
||||
|
||||
aMap->AddNodeFor(parent, aContent, aStyleContext);
|
||||
aMap->AddNodeFor(parent, aContent, aComputedStyle);
|
||||
}
|
||||
|
||||
void
|
||||
nsFrameManager::RegisterDisplayNoneStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
if (!mDisplayNoneMap) {
|
||||
mDisplayNoneMap = new UndisplayedMap;
|
||||
}
|
||||
SetStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);
|
||||
SetComputedStyleInMap(mDisplayNoneMap, aContent, aComputedStyle);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsFrameManager::ChangeStyleContextInMap(UndisplayedMap* aMap,
|
||||
nsFrameManager::ChangeComputedStyleInMap(UndisplayedMap* aMap,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aMap, "expecting a map");
|
||||
|
||||
#if defined(DEBUG_UNDISPLAYED_MAP) || defined(DEBUG_DISPLAY_BOX_CONTENTS_MAP)
|
||||
static int i = 0;
|
||||
printf("ChangeStyleContextInMap(%d): p=%p \n", i++, (void *)aContent);
|
||||
printf("ChangeComputedStyleInMap(%d): p=%p \n", i++, (void *)aContent);
|
||||
#endif
|
||||
|
||||
// This function is an entry point into UndisplayedMap handling code, so the
|
||||
|
@ -255,7 +255,7 @@ nsFrameManager::ChangeStyleContextInMap(UndisplayedMap* aMap,
|
|||
for (UndisplayedNode* node = aMap->GetFirstNode(parent);
|
||||
node; node = node->getNext()) {
|
||||
if (node->mContent == aContent) {
|
||||
node->mStyle = aStyleContext;
|
||||
node->mStyle = aComputedStyle;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -385,12 +385,12 @@ nsFrameManager::ClearAllMapsFor(nsIContent* aParentContent)
|
|||
|
||||
void
|
||||
nsFrameManager::RegisterDisplayContentsStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
if (!mDisplayContentsMap) {
|
||||
mDisplayContentsMap = new UndisplayedMap;
|
||||
}
|
||||
SetStyleContextInMap(mDisplayContentsMap, aContent, aStyleContext);
|
||||
SetComputedStyleInMap(mDisplayContentsMap, aContent, aComputedStyle);
|
||||
}
|
||||
|
||||
UndisplayedNode*
|
||||
|
@ -797,7 +797,7 @@ nsFrameManager::UndisplayedMap::AppendNodeFor(UndisplayedNode* aNode,
|
|||
void
|
||||
nsFrameManager::UndisplayedMap::AddNodeFor(nsIContent* aParentContent,
|
||||
nsIContent* aChild,
|
||||
nsStyleContext* aStyle)
|
||||
ComputedStyle* aStyle)
|
||||
{
|
||||
UndisplayedNode* node = new UndisplayedNode(aChild, aStyle);
|
||||
AppendNodeFor(node, aParentContent);
|
||||
|
@ -855,7 +855,7 @@ AddSizeOfIncludingThis(nsWindowSizes& aSizes, bool aIsServo) const
|
|||
}
|
||||
for (const UndisplayedNode* node = list->getFirst();
|
||||
node; node = node->getNext()) {
|
||||
ServoStyleContext* sc = node->mStyle->AsServo();
|
||||
ComputedStyle* sc = node->mStyle->AsServo();
|
||||
if (!aSizes.mState.HaveSeenPtr(sc)) {
|
||||
sc->AddSizeOfIncludingThis(
|
||||
staleSizes, &aSizes.mLayoutComputedValuesStale);
|
||||
|
|
|
@ -18,9 +18,9 @@ class nsIFrame;
|
|||
class nsILayoutHistoryState;
|
||||
class nsIPresShell;
|
||||
class nsPlaceholderFrame;
|
||||
class nsStyleContext;
|
||||
class nsWindowSizes;
|
||||
namespace mozilla {
|
||||
class ComputedStyle;
|
||||
struct UndisplayedNode;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ struct UndisplayedNode;
|
|||
*/
|
||||
class nsFrameManager
|
||||
{
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
typedef mozilla::layout::FrameChildListID ChildListID;
|
||||
typedef mozilla::UndisplayedNode UndisplayedNode;
|
||||
|
||||
|
@ -73,72 +74,73 @@ public:
|
|||
|
||||
|
||||
// display:none and display:contents content does not get an nsIFrame. To
|
||||
// enable the style context for such content to be obtained we store the
|
||||
// contexts in a couple of hash tables. The following methods provide the
|
||||
// API that's used to set, reset, obtain and clear these style contexts.
|
||||
// enable the style for such content to be obtained we store them in a
|
||||
// couple of hash tables. The following methods provide the API that's used
|
||||
// to set, reset, obtain and clear these styles.
|
||||
//
|
||||
// FIXME(stylo-everywhere): This should go away now.
|
||||
|
||||
/**
|
||||
* Register the style context for the display:none content, aContent.
|
||||
* Register the style for the display:none content, aContent.
|
||||
*/
|
||||
void RegisterDisplayNoneStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
/**
|
||||
* Register the style context for the display:contents content, aContent.
|
||||
* Register the style for the display:contents content, aContent.
|
||||
*/
|
||||
void RegisterDisplayContentsStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
/**
|
||||
* Change the style context for the display:none content, aContent.
|
||||
* Change the style for the display:none content, aContent.
|
||||
*/
|
||||
void ChangeRegisteredDisplayNoneStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
ChangeStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);
|
||||
ChangeComputedStyleInMap(mDisplayNoneMap, aContent, aComputedStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the style context for the display:contents content, aContent.
|
||||
* Change the style for the display:contents content, aContent.
|
||||
*/
|
||||
void ChangeRegisteredDisplayContentsStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext)
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
ChangeStyleContextInMap(mDisplayContentsMap, aContent, aStyleContext);
|
||||
ChangeComputedStyleInMap(mDisplayContentsMap, aContent, aComputedStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style context for the display:none content, aContent, if any.
|
||||
* Get the style for the display:none content, aContent, if any.
|
||||
*/
|
||||
nsStyleContext* GetDisplayNoneStyleFor(const nsIContent* aContent)
|
||||
ComputedStyle* GetDisplayNoneStyleFor(const nsIContent* aContent)
|
||||
{
|
||||
if (!mDisplayNoneMap) {
|
||||
return nullptr;
|
||||
}
|
||||
return GetStyleContextInMap(mDisplayNoneMap, aContent);
|
||||
return GetComputedStyleInMap(mDisplayNoneMap, aContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the style context for the display:contents content, aContent, if any.
|
||||
* Get the style for the display:contents content, aContent, if any.
|
||||
*/
|
||||
nsStyleContext* GetDisplayContentsStyleFor(const nsIContent* aContent)
|
||||
ComputedStyle* GetDisplayContentsStyleFor(const nsIContent* aContent)
|
||||
{
|
||||
if (!mDisplayContentsMap) {
|
||||
return nullptr;
|
||||
}
|
||||
return GetStyleContextInMap(mDisplayContentsMap, aContent);
|
||||
return GetComputedStyleInMap(mDisplayContentsMap, aContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the linked list of UndisplayedNodes that contain the style contexts
|
||||
* that have been registered for the display:none children of
|
||||
* aParentContent.
|
||||
* Return the linked list of UndisplayedNodes that contain the styles that
|
||||
* been registered for the display:none children of aParentContent.
|
||||
*/
|
||||
UndisplayedNode*
|
||||
GetAllRegisteredDisplayNoneStylesIn(nsIContent* aParentContent);
|
||||
|
||||
/**
|
||||
* Return the linked list of UndisplayedNodes that contain the style contexts
|
||||
* Return the linked list of UndisplayedNodes that contain the styles
|
||||
* that have been registered for the display:contents children of
|
||||
* aParentContent.
|
||||
*/
|
||||
|
@ -146,17 +148,17 @@ public:
|
|||
GetAllRegisteredDisplayContentsStylesIn(nsIContent* aParentContent);
|
||||
|
||||
/**
|
||||
* Unregister the style context for the display:none content, aContent,
|
||||
* if any. If found, then this method also unregisters the style contexts
|
||||
* for any display:contents and display:none descendants of aContent.
|
||||
* Unregister the style for the display:none content, aContent, if
|
||||
* any. If found, then this method also unregisters the styles for any
|
||||
* display:contents and display:none descendants of aContent.
|
||||
*/
|
||||
void UnregisterDisplayNoneStyleFor(nsIContent* aContent,
|
||||
nsIContent* aParentContent);
|
||||
|
||||
/**
|
||||
* Unregister the style context for the display:contents content, aContent,
|
||||
* if any. If found, then this method also unregisters the style contexts
|
||||
* for any display:contents and display:none descendants of aContent.
|
||||
* Unregister the style for the display:contents content, aContent, if any.
|
||||
* If found, then this method also unregisters the style for any
|
||||
* display:contents and display:none descendants of aContent.
|
||||
*/
|
||||
void UnregisterDisplayContentsStyleFor(nsIContent* aContent,
|
||||
nsIContent* aParentContent);
|
||||
|
@ -211,18 +213,21 @@ protected:
|
|||
|
||||
void ClearAllMapsFor(nsIContent* aParentContent);
|
||||
|
||||
static nsStyleContext* GetStyleContextInMap(UndisplayedMap* aMap,
|
||||
static ComputedStyle* GetComputedStyleInMap(UndisplayedMap* aMap,
|
||||
const nsIContent* aContent);
|
||||
static UndisplayedNode* GetUndisplayedNodeInMapFor(UndisplayedMap* aMap,
|
||||
const nsIContent* aContent);
|
||||
static UndisplayedNode* GetAllUndisplayedNodesInMapFor(UndisplayedMap* aMap,
|
||||
nsIContent* aParentContent);
|
||||
static void SetStyleContextInMap(UndisplayedMap* aMap,
|
||||
static void SetComputedStyleInMap(
|
||||
UndisplayedMap* aMap,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
static void ChangeStyleContextInMap(UndisplayedMap* aMap,
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
static void ChangeComputedStyleInMap(
|
||||
UndisplayedMap* aMap,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext);
|
||||
ComputedStyle* aComputedStyle);
|
||||
|
||||
// weak link, because the pres shell owns us
|
||||
nsIPresShell* MOZ_NON_OWNING_REF mPresShell;
|
||||
|
|
|
@ -58,7 +58,7 @@ nsGenConList::DestroyNodesFor(nsIFrame* aFrame)
|
|||
*/
|
||||
inline int32_t PseudoCompareType(nsIFrame* aFrame, nsIContent** aContent)
|
||||
{
|
||||
nsAtom *pseudo = aFrame->StyleContext()->GetPseudo();
|
||||
nsAtom *pseudo = aFrame->Style()->GetPseudo();
|
||||
if (pseudo == nsCSSPseudoElements::before) {
|
||||
*aContent = aFrame->GetContent()->GetParent();
|
||||
return -1;
|
||||
|
|
|
@ -70,9 +70,9 @@ protected:
|
|||
// 'counter-increment'.
|
||||
|
||||
NS_ASSERTION(mContentIndex < 0 ||
|
||||
mPseudoFrame->StyleContext()->GetPseudo() ==
|
||||
mPseudoFrame->Style()->GetPseudo() ==
|
||||
nsCSSPseudoElements::before ||
|
||||
mPseudoFrame->StyleContext()->GetPseudo() ==
|
||||
mPseudoFrame->Style()->GetPseudo() ==
|
||||
nsCSSPseudoElements::after,
|
||||
"not :before/:after generated content and not counter change");
|
||||
NS_ASSERTION(mContentIndex < 0 ||
|
||||
|
|
|
@ -1052,7 +1052,7 @@ public:
|
|||
|
||||
#ifdef DEBUG
|
||||
// Debugging hooks
|
||||
virtual void ListStyleContexts(FILE *out, int32_t aIndent = 0) = 0;
|
||||
virtual void ListComputedStyles(FILE *out, int32_t aIndent = 0) = 0;
|
||||
|
||||
virtual void ListStyleSheets(FILE *out, int32_t aIndent = 0) = 0;
|
||||
virtual void VerifyStyleTree() = 0;
|
||||
|
|
|
@ -2264,17 +2264,17 @@ nsLayoutUtils::GetScrolledRect(nsIFrame* aScrolledFrame,
|
|||
//static
|
||||
bool
|
||||
nsLayoutUtils::HasPseudoStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
CSSPseudoElementType aPseudoElement,
|
||||
nsPresContext* aPresContext)
|
||||
{
|
||||
NS_PRECONDITION(aPresContext, "Must have a prescontext");
|
||||
|
||||
RefPtr<nsStyleContext> pseudoContext;
|
||||
RefPtr<ComputedStyle> pseudoContext;
|
||||
if (aContent) {
|
||||
pseudoContext = aPresContext->StyleSet()->
|
||||
ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
|
||||
aStyleContext);
|
||||
aComputedStyle);
|
||||
}
|
||||
return pseudoContext != nullptr;
|
||||
}
|
||||
|
@ -4205,7 +4205,7 @@ void
|
|||
nsLayoutUtils::AddBoxesForFrame(nsIFrame* aFrame,
|
||||
nsLayoutUtils::BoxCallback* aCallback)
|
||||
{
|
||||
nsAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
|
||||
nsAtom* pseudoType = aFrame->Style()->GetPseudo();
|
||||
|
||||
if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
|
||||
AddBoxesForFrame(aFrame->PrincipalChildList().FirstChild(), aCallback);
|
||||
|
@ -4239,7 +4239,7 @@ nsIFrame*
|
|||
nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame)
|
||||
{
|
||||
while (aFrame) {
|
||||
nsAtom* pseudoType = aFrame->StyleContext()->GetPseudo();
|
||||
nsAtom* pseudoType = aFrame->Style()->GetPseudo();
|
||||
|
||||
if (pseudoType == nsCSSAnonBoxes::tableWrapper) {
|
||||
nsIFrame* f = GetFirstNonAnonymousFrame(aFrame->PrincipalChildList().FirstChild());
|
||||
|
@ -4684,7 +4684,7 @@ nsLayoutUtils::ComputeObjectDestRect(const nsRect& aConstraintRect,
|
|||
already_AddRefed<nsFontMetrics>
|
||||
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame, float aInflation)
|
||||
{
|
||||
nsStyleContext* styleContext = aFrame->StyleContext();
|
||||
ComputedStyle* styleContext = aFrame->Style();
|
||||
uint8_t variantWidth = NS_FONT_VARIANT_WIDTH_NORMAL;
|
||||
if (styleContext->IsTextCombined()) {
|
||||
MOZ_ASSERT(aFrame->IsTextFrame());
|
||||
|
@ -4698,18 +4698,18 @@ nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame, float aInflation)
|
|||
variantWidth = NS_FONT_VARIANT_WIDTH_QUARTER;
|
||||
}
|
||||
}
|
||||
return GetFontMetricsForStyleContext(styleContext, aInflation, variantWidth);
|
||||
return GetFontMetricsForComputedStyle(styleContext, aInflation, variantWidth);
|
||||
}
|
||||
|
||||
already_AddRefed<nsFontMetrics>
|
||||
nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
|
||||
nsLayoutUtils::GetFontMetricsForComputedStyle(ComputedStyle* aComputedStyle,
|
||||
float aInflation,
|
||||
uint8_t aVariantWidth)
|
||||
{
|
||||
nsPresContext* pc = aStyleContext->PresContext();
|
||||
nsPresContext* pc = aComputedStyle->PresContext();
|
||||
|
||||
WritingMode wm(aStyleContext);
|
||||
const nsStyleFont* styleFont = aStyleContext->StyleFont();
|
||||
WritingMode wm(aComputedStyle);
|
||||
const nsStyleFont* styleFont = aComputedStyle->StyleFont();
|
||||
nsFontMetrics::Params params;
|
||||
params.language = styleFont->mLanguage;
|
||||
params.explicitLanguage = styleFont->mExplicitLanguage;
|
||||
|
@ -6128,7 +6128,7 @@ nsLayoutUtils::AppUnitWidthOfStringBidi(const char16_t* aString,
|
|||
nsPresContext* presContext = aFrame->PresContext();
|
||||
if (presContext->BidiEnabled()) {
|
||||
nsBidiLevel level =
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aFrame->StyleContext());
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aFrame->Style());
|
||||
return nsBidiPresUtils::MeasureTextWidth(aString, aLength, level,
|
||||
presContext, aContext,
|
||||
aFontMetrics);
|
||||
|
@ -6196,29 +6196,29 @@ nsLayoutUtils::DrawString(const nsIFrame* aFrame,
|
|||
const char16_t* aString,
|
||||
int32_t aLength,
|
||||
nsPoint aPoint,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
DrawStringFlags aFlags)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// If caller didn't pass a style context, use the frame's.
|
||||
if (!aStyleContext) {
|
||||
aStyleContext = aFrame->StyleContext();
|
||||
// If caller didn't pass a style, use the frame's.
|
||||
if (!aComputedStyle) {
|
||||
aComputedStyle = aFrame->Style();
|
||||
}
|
||||
|
||||
if (aFlags & DrawStringFlags::eForceHorizontal) {
|
||||
aFontMetrics.SetVertical(false);
|
||||
} else {
|
||||
aFontMetrics.SetVertical(WritingMode(aStyleContext).IsVertical());
|
||||
aFontMetrics.SetVertical(WritingMode(aComputedStyle).IsVertical());
|
||||
}
|
||||
|
||||
aFontMetrics.SetTextOrientation(
|
||||
aStyleContext->StyleVisibility()->mTextOrientation);
|
||||
aComputedStyle->StyleVisibility()->mTextOrientation);
|
||||
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
if (presContext->BidiEnabled()) {
|
||||
nsBidiLevel level =
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aStyleContext);
|
||||
nsBidiPresUtils::BidiLevelFromStyle(aComputedStyle);
|
||||
rv = nsBidiPresUtils::RenderText(aString, aLength, level,
|
||||
presContext, *aContext,
|
||||
aContext->GetDrawTarget(), aFontMetrics,
|
||||
|
@ -6590,11 +6590,11 @@ SamplingFilter
|
|||
nsLayoutUtils::GetSamplingFilterForFrame(nsIFrame* aForFrame)
|
||||
{
|
||||
SamplingFilter defaultFilter = SamplingFilter::GOOD;
|
||||
nsStyleContext *sc;
|
||||
ComputedStyle *sc;
|
||||
if (nsCSSRendering::IsCanvasFrame(aForFrame)) {
|
||||
nsCSSRendering::FindBackground(aForFrame, &sc);
|
||||
} else {
|
||||
sc = aForFrame->StyleContext();
|
||||
sc = aForFrame->Style();
|
||||
}
|
||||
|
||||
switch (sc->StyleVisibility()->mImageRendering) {
|
||||
|
@ -7301,7 +7301,7 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
|
|||
|
||||
/* static */ ImgDrawResult
|
||||
nsLayoutUtils::DrawImage(gfxContext& aContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsPresContext* aPresContext,
|
||||
imgIContainer* aImage,
|
||||
const SamplingFilter aSamplingFilter,
|
||||
|
@ -7313,7 +7313,7 @@ nsLayoutUtils::DrawImage(gfxContext& aContext,
|
|||
float aOpacity)
|
||||
{
|
||||
Maybe<SVGImageContext> svgContext;
|
||||
SVGImageContext::MaybeStoreContextPaint(svgContext, aStyleContext, aImage);
|
||||
SVGImageContext::MaybeStoreContextPaint(svgContext, aComputedStyle, aImage);
|
||||
|
||||
return DrawImageInternal(aContext, aPresContext, aImage,
|
||||
aSamplingFilter, aDest, aFill, aAnchor,
|
||||
|
@ -7445,7 +7445,7 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
|||
return eTransparencyOpaque;
|
||||
}
|
||||
|
||||
nsStyleContext* bgSC;
|
||||
ComputedStyle* bgSC;
|
||||
if (!nsCSSRendering::FindBackground(aBackgroundFrame, &bgSC)) {
|
||||
return eTransparencyTransparent;
|
||||
}
|
||||
|
@ -7522,7 +7522,7 @@ nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame)
|
|||
}
|
||||
|
||||
/* static */ gfx::ShapedTextFlags
|
||||
nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||
nsLayoutUtils::GetTextRunFlagsForStyle(ComputedStyle* aComputedStyle,
|
||||
const nsStyleFont* aStyleFont,
|
||||
const nsStyleText* aStyleText,
|
||||
nscoord aLetterSpacing)
|
||||
|
@ -7535,33 +7535,33 @@ nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
|||
if (aStyleText->mControlCharacterVisibility == NS_STYLE_CONTROL_CHARACTER_VISIBILITY_HIDDEN) {
|
||||
result |= gfx::ShapedTextFlags::TEXT_HIDE_CONTROL_CHARACTERS;
|
||||
}
|
||||
switch (aStyleContext->StyleText()->mTextRendering) {
|
||||
switch (aComputedStyle->StyleText()->mTextRendering) {
|
||||
case NS_STYLE_TEXT_RENDERING_OPTIMIZESPEED:
|
||||
result |= gfx::ShapedTextFlags::TEXT_OPTIMIZE_SPEED;
|
||||
break;
|
||||
case NS_STYLE_TEXT_RENDERING_AUTO:
|
||||
if (aStyleFont->mFont.size <
|
||||
aStyleContext->PresContext()->GetAutoQualityMinFontSize()) {
|
||||
aComputedStyle->PresContext()->GetAutoQualityMinFontSize()) {
|
||||
result |= gfx::ShapedTextFlags::TEXT_OPTIMIZE_SPEED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result | GetTextRunOrientFlagsForStyle(aStyleContext);
|
||||
return result | GetTextRunOrientFlagsForStyle(aComputedStyle);
|
||||
}
|
||||
|
||||
/* static */ gfx::ShapedTextFlags
|
||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext)
|
||||
nsLayoutUtils::GetTextRunOrientFlagsForStyle(ComputedStyle* aComputedStyle)
|
||||
{
|
||||
uint8_t writingMode = aStyleContext->StyleVisibility()->mWritingMode;
|
||||
uint8_t writingMode = aComputedStyle->StyleVisibility()->mWritingMode;
|
||||
switch (writingMode) {
|
||||
case NS_STYLE_WRITING_MODE_HORIZONTAL_TB:
|
||||
return gfx::ShapedTextFlags::TEXT_ORIENT_HORIZONTAL;
|
||||
|
||||
case NS_STYLE_WRITING_MODE_VERTICAL_LR:
|
||||
case NS_STYLE_WRITING_MODE_VERTICAL_RL:
|
||||
switch (aStyleContext->StyleVisibility()->mTextOrientation) {
|
||||
switch (aComputedStyle->StyleVisibility()->mTextOrientation) {
|
||||
case NS_STYLE_TEXT_ORIENTATION_MIXED:
|
||||
return gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED;
|
||||
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
|
||||
|
@ -9478,7 +9478,7 @@ nsLayoutUtils::ComputeScrollMetadata(nsIFrame* aForFrame,
|
|||
metadata.SetBackgroundColor(Color::FromABGR(
|
||||
presShell->GetCanvasBackground()));
|
||||
} else {
|
||||
nsStyleContext* backgroundStyle;
|
||||
ComputedStyle* backgroundStyle;
|
||||
if (nsCSSRendering::FindBackground(aScrollFrame, &backgroundStyle)) {
|
||||
nscolor backgroundColor = backgroundStyle->
|
||||
StyleBackground()->BackgroundColor(backgroundStyle);
|
||||
|
|
|
@ -51,7 +51,6 @@ class nsDisplayItem;
|
|||
class nsFontMetrics;
|
||||
class nsFontFaceList;
|
||||
class nsIImageLoadingContent;
|
||||
class nsStyleContext;
|
||||
class nsBlockFrame;
|
||||
class nsContainerFrame;
|
||||
class nsView;
|
||||
|
@ -66,6 +65,7 @@ struct nsStyleImageOrientation;
|
|||
struct nsOverflowAreas;
|
||||
|
||||
namespace mozilla {
|
||||
class ComputedStyle;
|
||||
enum class CSSPseudoElementType : uint8_t;
|
||||
class EventListenerManager;
|
||||
enum class LayoutFrameType : uint8_t;
|
||||
|
@ -140,6 +140,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DrawStringFlags)
|
|||
*/
|
||||
class nsLayoutUtils
|
||||
{
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
typedef mozilla::dom::DOMRectList DOMRectList;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
typedef mozilla::layers::StackingContextHelper StackingContextHelper;
|
||||
|
@ -672,17 +673,17 @@ public:
|
|||
|
||||
/**
|
||||
* HasPseudoStyle returns true if aContent (whose primary style
|
||||
* context is aStyleContext) has the aPseudoElement pseudo-style
|
||||
* context is aComputedStyle) has the aPseudoElement pseudo-style
|
||||
* attached to it; returns false otherwise.
|
||||
*
|
||||
* @param aContent the content node we're looking at
|
||||
* @param aStyleContext aContent's style context
|
||||
* @param aComputedStyle aContent's style context
|
||||
* @param aPseudoElement the id of the pseudo style we care about
|
||||
* @param aPresContext the presentation context
|
||||
* @return whether aContent has aPseudoElement style attached to it
|
||||
*/
|
||||
static bool HasPseudoStyle(nsIContent* aContent,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
mozilla::CSSPseudoElementType aPseudoElement,
|
||||
nsPresContext* aPresContext);
|
||||
|
||||
|
@ -1297,24 +1298,26 @@ public:
|
|||
|
||||
/**
|
||||
* Get the font metrics corresponding to the given style data.
|
||||
* @param aStyleContext the style data
|
||||
* @param aComputedStyle the style data
|
||||
* @param aSizeInflation number to multiply font size by
|
||||
*/
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsForStyleContext(
|
||||
nsStyleContext* aStyleContext, float aSizeInflation = 1.0f,
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsForComputedStyle(
|
||||
ComputedStyle* aComputedStyle,
|
||||
float aSizeInflation = 1.0f,
|
||||
uint8_t aVariantWidth = NS_FONT_VARIANT_WIDTH_NORMAL);
|
||||
|
||||
/**
|
||||
* Get the font metrics of emphasis marks corresponding to the given
|
||||
* style data. The result is same as GetFontMetricsForStyleContext
|
||||
* style data. The result is same as GetFontMetricsForComputedStyle
|
||||
* except that the font size is scaled down to 50%.
|
||||
* @param aStyleContext the style data
|
||||
* @param aComputedStyle the style data
|
||||
* @param aInflation number to multiple font size by
|
||||
*/
|
||||
static already_AddRefed<nsFontMetrics> GetFontMetricsOfEmphasisMarks(
|
||||
nsStyleContext* aStyleContext, float aInflation)
|
||||
ComputedStyle* aComputedStyle,
|
||||
float aInflation)
|
||||
{
|
||||
return GetFontMetricsForStyleContext(aStyleContext, aInflation * 0.5f);
|
||||
return GetFontMetricsForComputedStyle(aComputedStyle, aInflation * 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1635,7 +1638,7 @@ public:
|
|||
const char16_t* aString,
|
||||
int32_t aLength,
|
||||
nsPoint aPoint,
|
||||
nsStyleContext* aStyleContext = nullptr,
|
||||
ComputedStyle* aComputedStyle = nullptr,
|
||||
DrawStringFlags aFlags = DrawStringFlags::eDefault);
|
||||
|
||||
static nsPoint GetBackgroundFirstTilePos(const nsPoint& aDest,
|
||||
|
@ -1832,7 +1835,7 @@ public:
|
|||
* @param aRenderingContext Where to draw the image, set up with an
|
||||
* appropriate scale and transform for drawing in
|
||||
* app units.
|
||||
* @param aStyleContext The style context of the nsIFrame (or
|
||||
* @param aComputedStyle The style context of the nsIFrame (or
|
||||
* pseudo-element) for which this image is being
|
||||
* drawn.
|
||||
* @param aImage The image.
|
||||
|
@ -1845,7 +1848,7 @@ public:
|
|||
* @param aImageFlags Image flags of the imgIContainer::FLAG_* variety
|
||||
*/
|
||||
static ImgDrawResult DrawImage(gfxContext& aContext,
|
||||
nsStyleContext* aStyleContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
nsPresContext* aPresContext,
|
||||
imgIContainer* aImage,
|
||||
const SamplingFilter aSamplingFilter,
|
||||
|
@ -2053,7 +2056,7 @@ public:
|
|||
* and prefs indicate we should be optimizing for speed over quality
|
||||
*/
|
||||
static mozilla::gfx::ShapedTextFlags
|
||||
GetTextRunFlagsForStyle(nsStyleContext* aStyleContext,
|
||||
GetTextRunFlagsForStyle(ComputedStyle* aComputedStyle,
|
||||
const nsStyleFont* aStyleFont,
|
||||
const nsStyleText* aStyleText,
|
||||
nscoord aLetterSpacing);
|
||||
|
@ -2062,7 +2065,7 @@ public:
|
|||
* Get orientation flags for textrun construction.
|
||||
*/
|
||||
static mozilla::gfx::ShapedTextFlags
|
||||
GetTextRunOrientFlagsForStyle(nsStyleContext* aStyleContext);
|
||||
GetTextRunOrientFlagsForStyle(ComputedStyle* aComputedStyle);
|
||||
|
||||
/**
|
||||
* Takes two rectangles whose origins must be the same, and computes
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleContextInlines.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "nsWindowSizes.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
@ -47,11 +47,11 @@ nsPresArena::ClearArenaRefPtrWithoutDeregistering(void* aPtr,
|
|||
ArenaObjectID aObjectID)
|
||||
{
|
||||
switch (aObjectID) {
|
||||
// We use ArenaRefPtr<nsStyleContext>, which can be ServoStyleContext
|
||||
// or GeckoStyleContext. GeckoStyleContext is actually arena managed,
|
||||
// but ServoStyleContext isn't.
|
||||
case eArenaObjectID_GeckoStyleContext:
|
||||
static_cast<ArenaRefPtr<nsStyleContext>*>(aPtr)->ClearWithoutDeregistering();
|
||||
// We use ArenaRefPtr<ComputedStyle>, which can be ComputedStyle
|
||||
// or GeckoComputedStyle. GeckoComputedStyle is actually arena managed,
|
||||
// but ComputedStyle isn't.
|
||||
case eArenaObjectID_GeckoComputedStyle:
|
||||
static_cast<ArenaRefPtr<ComputedStyle>*>(aPtr)->ClearWithoutDeregistering();
|
||||
return;
|
||||
default:
|
||||
MOZ_ASSERT(false, "unexpected ArenaObjectID value");
|
||||
|
@ -206,8 +206,8 @@ nsPresArena::AddSizeOfExcludingThis(nsWindowSizes& aSizes) const
|
|||
case eArenaObjectID_nsRuleNode:
|
||||
aSizes.mArenaSizes.mRuleNodes += totalSize;
|
||||
break;
|
||||
case eArenaObjectID_GeckoStyleContext:
|
||||
aSizes.mArenaSizes.mStyleContexts += totalSize;
|
||||
case eArenaObjectID_GeckoComputedStyle:
|
||||
aSizes.mArenaSizes.mComputedStyles += totalSize;
|
||||
break;
|
||||
#define STYLE_STRUCT(name_, cb_) \
|
||||
case eArenaObjectID_nsStyle##name_: \
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
* Clears all currently registered ArenaRefPtrs for the given ArenaObjectID.
|
||||
* This is called when we reconstruct the rule tree so that style contexts
|
||||
* pointing into the old rule tree aren't released afterwards, triggering an
|
||||
* assertion in ~nsStyleContext.
|
||||
* assertion in ~ComputedStyle.
|
||||
*/
|
||||
void ClearArenaRefPtrs(mozilla::ArenaObjectID aObjectID);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
// These are objects that can be stored in the pres arena
|
||||
|
||||
PRES_ARENA_OBJECT(GeckoStyleContext)
|
||||
PRES_ARENA_OBJECT(GeckoComputedStyle)
|
||||
|
||||
PRES_ARENA_OBJECT(nsLineBox)
|
||||
PRES_ARENA_OBJECT(nsRuleNode)
|
||||
|
|
|
@ -1478,7 +1478,7 @@ GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
|
|||
|
||||
// Check the style on the document root element
|
||||
StyleSetHandle styleSet = aPresContext->StyleSet();
|
||||
RefPtr<nsStyleContext> rootStyle =
|
||||
RefPtr<ComputedStyle> rootStyle =
|
||||
styleSet->ResolveStyleFor(docElement, nullptr, LazyComputeBehavior::Allow);
|
||||
if (CheckOverflow(rootStyle->StyleDisplay(), aStyles)) {
|
||||
// tell caller we stole the overflow style from the root element
|
||||
|
@ -1505,7 +1505,7 @@ GetPropagatedScrollbarStylesForViewport(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT(bodyElement->IsHTMLElement(nsGkAtoms::body),
|
||||
"GetBodyElement returned something bogus");
|
||||
|
||||
RefPtr<nsStyleContext> bodyStyle =
|
||||
RefPtr<ComputedStyle> bodyStyle =
|
||||
styleSet->ResolveStyleFor(bodyElement, rootStyle,
|
||||
LazyComputeBehavior::Allow);
|
||||
|
||||
|
@ -2014,9 +2014,6 @@ nsPresContext::RebuildAllStyleData(nsChangeHint aExtraHint,
|
|||
// here if there's no restyle hint? That looks pretty bogus.
|
||||
mUsesRootEMUnits = false;
|
||||
mUsesExChUnits = false;
|
||||
if (mShell->StyleSet()->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
|
||||
// TODO(emilio): It's unclear to me why would these three calls below be
|
||||
// needed. In particular, RebuildAllStyleData doesn't rebuild rules or
|
||||
|
@ -2210,9 +2207,6 @@ bool
|
|||
nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
|
||||
uint32_t aRuleTypeMask) const
|
||||
{
|
||||
if (aFrame->StyleContext()->IsGecko()) {
|
||||
MOZ_CRASH("old style system disabled");
|
||||
}
|
||||
Element* elem = aFrame->GetContent()->AsElement();
|
||||
|
||||
// We need to handle non-generated content pseudos too, so we use
|
||||
|
@ -2226,7 +2220,7 @@ nsPresContext::HasAuthorSpecifiedRules(const nsIFrame* aFrame,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsStyleContext* styleContext = aFrame->StyleContext();
|
||||
ComputedStyle* styleContext = aFrame->Style();
|
||||
CSSPseudoElementType pseudoType = styleContext->GetPseudoType();
|
||||
// Anonymous boxes are more complicated, and we just assume that they
|
||||
// cannot have any author-specified rules here.
|
||||
|
|
|
@ -339,7 +339,7 @@ Container Frame.<br>
|
|||
<h3>Space Manager<br>
|
||||
</h3>
|
||||
<h3>StyleSet</h3>
|
||||
<h3>StyleContext</h3>
|
||||
<h3>ComputedStyle</h3>
|
||||
<br>
|
||||
<br>
|
||||
<hr width="100%" size="2"><br>
|
||||
|
|
|
@ -83,9 +83,9 @@ able to hold the property and its value(s)</li>
|
|||
<li><a href="#Parser">CSS Parser</a>: the parser must be able to parse the
|
||||
property name, validate the values, and provide a declaration for the property
|
||||
and value</li>
|
||||
<li><a href="#StyleContext">Style Context</a>: the StyleContext must be able
|
||||
<li><a href="#ComputedStyle">Style Context</a>: the ComputedStyle must be able
|
||||
to hold the resolved value of the property, and provide a means to retrieve the
|
||||
property value. Additionally, the StyleContext has to know what kind of impact a
|
||||
property value. Additionally, the ComputedStyle has to know what kind of impact a
|
||||
change to this property causes.</li>
|
||||
<li><a href="#RuleNode">Rule Nodes</a>: the RuleNodes need to know how the
|
||||
property is inherited and how it is shared by other elements.</li>
|
||||
|
@ -277,7 +277,7 @@ variant flag</a>
|
|||
<pre> return ParsePositiveVariant(aErrorCode, aValue, VARIANT_INTEGER, nullptr);</pre>
|
||||
This will parse the value as a positive integer value, which is what we want.<br>
|
||||
<br>
|
||||
<h3><a name="StyleContext">Style Context</a></h3>
|
||||
<h3><a name="ComputedStyle">Style Context</a></h3>
|
||||
Having implemented support for the new property in the CSS Parser and CSS
|
||||
Declaration classes in the content module, it is now time to provide support
|
||||
for the new property in layout. The Style Context must be given a new data
|
||||
|
@ -290,7 +290,7 @@ nsStyleStruct.h</a>
|
|||
data on. In this example, we want to put it on the nsStyleUserInterface struct,
|
||||
however there is also a class nsStyleUIReset that holds the non-inherited
|
||||
values, so we will use that one (remember, our property is not inherited).
|
||||
Add a <a href="#StyleContextMember">data member</a>
|
||||
Add a <a href="#ComputedStyleMember">data member</a>
|
||||
to hold the value:
|
||||
<pre>struct nsStyleUIReset {
|
||||
nsStyleUIReset(void);
|
||||
|
@ -312,11 +312,11 @@ Add a <a href="#StyleContextMember">data member</a>
|
|||
uint8_t mUserSelect; // [reset] (selection-style)
|
||||
PRUnichar mKeyEquivalent; // [reset] XXX what type should this be?
|
||||
uint8_t mResizer; // [reset]
|
||||
<b><a name="StyleContextMember"></a>uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)</b>
|
||||
<b><a name="ComputedStyleMember"></a>uint8_t mForceBrokenImageIcon; // [reset] (0 if not forcing, otherwise forcing)</b>
|
||||
};
|
||||
</pre>
|
||||
In the implementation file <a href="http://lxr.mozilla.org/seamonkey/source/content/shared/src/nsStyleStruct.cpp">
|
||||
nsStyleContext.cpp </a>
|
||||
ComputedStyle.cpp </a>
|
||||
add the new data member to the constructors of the style struct and the CalcDifference
|
||||
method, which must return the correct style-change hint when a change to
|
||||
your new property is detected. The constructor changes are obvious, but here
|
||||
|
|
|
@ -139,7 +139,7 @@ has been added or removed or that style has changed.</Body>
|
|||
|
||||
<Body>The first step is to resolve style information for the content element.
|
||||
This process creates a style context that is stored in the frame (see
|
||||
nsIStyleContext).</Body>
|
||||
nsIComputedStyle).</Body>
|
||||
|
||||
<Body>Once style is resolved construction rules are used to decide the type of
|
||||
frame to create. First we look at the element's tag and special case some
|
||||
|
|
|
@ -38,12 +38,6 @@ nsButtonFrameRenderer::nsButtonFrameRenderer()
|
|||
nsButtonFrameRenderer::~nsButtonFrameRenderer()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsButtonFrameRenderer);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mInnerFocusStyle) {
|
||||
mInnerFocusStyle->FrameRelease();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -287,7 +281,7 @@ nsDisplayButtonBorder::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder&
|
|||
mFrame,
|
||||
nsRect(),
|
||||
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||
mFrame->StyleContext(),
|
||||
mFrame->Style(),
|
||||
&borderIsEmpty,
|
||||
mFrame->GetSkipSides());
|
||||
if (!br) {
|
||||
|
@ -541,7 +535,7 @@ nsButtonFrameRenderer::PaintBorder(
|
|||
{
|
||||
// get the button rect this is inside the focus and outline rects
|
||||
nsRect buttonRect = aRect;
|
||||
nsStyleContext* context = mFrame->StyleContext();
|
||||
ComputedStyle* context = mFrame->Style();
|
||||
|
||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
||||
|
@ -564,30 +558,18 @@ void
|
|||
nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
|
||||
{
|
||||
// get all the styles
|
||||
nsStyleContext* context = mFrame->StyleContext();
|
||||
ComputedStyle* context = mFrame->Style();
|
||||
StyleSetHandle styleSet = aPresContext->StyleSet();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mInnerFocusStyle) {
|
||||
mInnerFocusStyle->FrameRelease();
|
||||
}
|
||||
#endif
|
||||
|
||||
// get styles assigned to -moz-inner-focus (ie dotted border on Windows)
|
||||
mInnerFocusStyle =
|
||||
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
||||
CSSPseudoElementType::mozFocusInner,
|
||||
context);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mInnerFocusStyle) {
|
||||
mInnerFocusStyle->FrameAddRef();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
nsButtonFrameRenderer::GetStyleContext(int32_t aIndex) const
|
||||
ComputedStyle*
|
||||
nsButtonFrameRenderer::GetComputedStyle(int32_t aIndex) const
|
||||
{
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
|
@ -598,19 +580,11 @@ nsButtonFrameRenderer::GetStyleContext(int32_t aIndex) const
|
|||
}
|
||||
|
||||
void
|
||||
nsButtonFrameRenderer::SetStyleContext(int32_t aIndex, nsStyleContext* aStyleContext)
|
||||
nsButtonFrameRenderer::SetComputedStyle(int32_t aIndex, ComputedStyle* aComputedStyle)
|
||||
{
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
#ifdef DEBUG
|
||||
if (mInnerFocusStyle) {
|
||||
mInnerFocusStyle->FrameRelease();
|
||||
}
|
||||
#endif
|
||||
mInnerFocusStyle = aStyleContext;
|
||||
mInnerFocusStyle = aComputedStyle;
|
||||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
aStyleContext->FrameAddRef();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ class nsDisplayList;
|
|||
class nsDisplayListBuilder;
|
||||
class nsPresContext;
|
||||
struct nsRect;
|
||||
class nsStyleContext;
|
||||
|
||||
|
||||
#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
|
||||
|
@ -26,6 +25,7 @@ class nsStyleContext;
|
|||
|
||||
class nsButtonFrameRenderer {
|
||||
typedef mozilla::image::ImgDrawResult ImgDrawResult;
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -67,18 +67,16 @@ public:
|
|||
|
||||
void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
|
||||
|
||||
nsStyleContext* GetStyleContext(int32_t aIndex) const;
|
||||
void SetStyleContext(int32_t aIndex, nsStyleContext* aStyleContext);
|
||||
ComputedStyle* GetComputedStyle(int32_t aIndex) const;
|
||||
void SetComputedStyle(int32_t aIndex, ComputedStyle* aComputedStyle);
|
||||
void ReResolveStyles(nsPresContext* aPresContext);
|
||||
|
||||
nsIFrame* GetFrame();
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
// cached style for optional inner focus outline (used on Windows).
|
||||
RefPtr<nsStyleContext> mInnerFocusStyle;
|
||||
RefPtr<ComputedStyle> mInnerFocusStyle;
|
||||
|
||||
nsFrame* mFrame;
|
||||
};
|
||||
|
|
|
@ -21,13 +21,13 @@ using mozilla::dom::HTMLInputElement;
|
|||
//#define FCF_NOISY
|
||||
|
||||
nsCheckboxRadioFrame*
|
||||
NS_NewCheckboxRadioFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewCheckboxRadioFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsCheckboxRadioFrame(aContext);
|
||||
return new (aPresShell) nsCheckboxRadioFrame(aStyle);
|
||||
}
|
||||
|
||||
nsCheckboxRadioFrame::nsCheckboxRadioFrame(nsStyleContext* aContext)
|
||||
: nsAtomicContainerFrame(aContext, kClassID)
|
||||
nsCheckboxRadioFrame::nsCheckboxRadioFrame(ComputedStyle* aStyle)
|
||||
: nsAtomicContainerFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsCheckboxRadioFrame)
|
||||
|
||||
explicit nsCheckboxRadioFrame(nsStyleContext* aContext);
|
||||
explicit nsCheckboxRadioFrame(ComputedStyle* aStyle);
|
||||
|
||||
// nsIFrame replacements
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||
|
|
|
@ -22,15 +22,15 @@ using mozilla::dom::Element;
|
|||
using mozilla::dom::HTMLInputElement;
|
||||
using mozilla::dom::CallerType;
|
||||
|
||||
nsColorControlFrame::nsColorControlFrame(nsStyleContext* aContext)
|
||||
: nsHTMLButtonControlFrame(aContext, kClassID)
|
||||
nsColorControlFrame::nsColorControlFrame(ComputedStyle* aStyle)
|
||||
: nsHTMLButtonControlFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
NS_NewColorControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewColorControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsColorControlFrame(aContext);
|
||||
return new (aPresShell) nsColorControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsColorControlFrame)
|
||||
|
|
|
@ -25,7 +25,7 @@ class nsColorControlFrame final : public nsHTMLButtonControlFrame,
|
|||
|
||||
public:
|
||||
friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
nsresult UpdateColor();
|
||||
|
||||
private:
|
||||
explicit nsColorControlFrame(nsStyleContext* aContext);
|
||||
explicit nsColorControlFrame(ComputedStyle* aStyle);
|
||||
|
||||
nsCOMPtr<Element> mColorContent;
|
||||
};
|
||||
|
|
|
@ -119,9 +119,9 @@ NS_IMPL_ISUPPORTS(nsComboButtonListener,
|
|||
nsComboboxControlFrame* nsComboboxControlFrame::sFocused = nullptr;
|
||||
|
||||
nsComboboxControlFrame*
|
||||
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, nsFrameState aStateFlags)
|
||||
NS_NewComboboxControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle, nsFrameState aStateFlags)
|
||||
{
|
||||
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aContext);
|
||||
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aStyle);
|
||||
|
||||
if (it) {
|
||||
// set the state flags (if any are provided)
|
||||
|
@ -224,8 +224,8 @@ static int32_t gReflowInx = -1;
|
|||
//-- Done with macros
|
||||
//------------------------------------------------------
|
||||
|
||||
nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext)
|
||||
: nsBlockFrame(aContext, kClassID)
|
||||
nsComboboxControlFrame::nsComboboxControlFrame(ComputedStyle* aStyle)
|
||||
: nsBlockFrame(aStyle, kClassID)
|
||||
, mDisplayFrame(nullptr)
|
||||
, mButtonFrame(nullptr)
|
||||
, mDropdownFrame(nullptr)
|
||||
|
@ -1303,9 +1303,9 @@ class nsComboboxDisplayFrame : public nsBlockFrame {
|
|||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsComboboxDisplayFrame)
|
||||
|
||||
nsComboboxDisplayFrame(nsStyleContext* aContext,
|
||||
nsComboboxDisplayFrame(ComputedStyle* aStyle,
|
||||
nsComboboxControlFrame* aComboBox)
|
||||
: nsBlockFrame(aContext, kClassID)
|
||||
: nsBlockFrame(aStyle, kClassID)
|
||||
, mComboBox(aComboBox)
|
||||
{}
|
||||
|
||||
|
@ -1387,21 +1387,21 @@ nsComboboxControlFrame::CreateFrameForDisplayNode()
|
|||
StyleSetHandle styleSet = shell->StyleSet();
|
||||
|
||||
// create the style contexts for the anonymous block frame and text frame
|
||||
RefPtr<nsStyleContext> styleContext;
|
||||
RefPtr<ComputedStyle> styleContext;
|
||||
styleContext = styleSet->
|
||||
ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
mComputedStyle);
|
||||
|
||||
RefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext =
|
||||
styleSet->ResolveStyleForText(mDisplayContent, mStyleContext);
|
||||
RefPtr<ComputedStyle> textComputedStyle;
|
||||
textComputedStyle =
|
||||
styleSet->ResolveStyleForText(mDisplayContent, mComputedStyle);
|
||||
|
||||
// Start by creating our anonymous block frame
|
||||
mDisplayFrame = new (shell) nsComboboxDisplayFrame(styleContext, this);
|
||||
mDisplayFrame->Init(mContent, this, nullptr);
|
||||
|
||||
// Create a text frame and put it inside the block frame
|
||||
nsIFrame* textFrame = NS_NewTextFrame(shell, textStyleContext);
|
||||
nsIFrame* textFrame = NS_NewTextFrame(shell, textComputedStyle);
|
||||
|
||||
// initialize the text frame
|
||||
textFrame->Init(mDisplayContent, mDisplayFrame, nullptr);
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "nsIStatefulFrame.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
class nsStyleContext;
|
||||
class nsIListControlFrame;
|
||||
class nsComboboxDisplayFrame;
|
||||
class nsIDOMEventListener;
|
||||
|
@ -56,11 +55,11 @@ class nsComboboxControlFrame final : public nsBlockFrame,
|
|||
|
||||
public:
|
||||
friend nsComboboxControlFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext,
|
||||
ComputedStyle* aStyle,
|
||||
nsFrameState aFlags);
|
||||
friend class nsComboboxDisplayFrame;
|
||||
|
||||
explicit nsComboboxControlFrame(nsStyleContext* aContext);
|
||||
explicit nsComboboxControlFrame(ComputedStyle* aStyle);
|
||||
~nsComboboxControlFrame();
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
|
|
|
@ -29,9 +29,9 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewDateTimeControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewDateTimeControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsDateTimeControlFrame(aContext);
|
||||
return new (aPresShell) nsDateTimeControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsDateTimeControlFrame)
|
||||
|
@ -41,8 +41,8 @@ NS_QUERYFRAME_HEAD(nsDateTimeControlFrame)
|
|||
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
nsDateTimeControlFrame::nsDateTimeControlFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsDateTimeControlFrame::nsDateTimeControlFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,11 +32,11 @@ class nsDateTimeControlFrame final : public nsContainerFrame,
|
|||
{
|
||||
typedef mozilla::dom::DateTimeValue DateTimeValue;
|
||||
|
||||
explicit nsDateTimeControlFrame(nsStyleContext* aContext);
|
||||
explicit nsDateTimeControlFrame(ComputedStyle* aStyle);
|
||||
|
||||
public:
|
||||
friend nsIFrame* NS_NewDateTimeControlFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
void ContentStatesChanged(mozilla::EventStates aStates) override;
|
||||
void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
|
|
@ -25,15 +25,15 @@ using namespace mozilla::gfx;
|
|||
using namespace mozilla::layout;
|
||||
|
||||
nsContainerFrame*
|
||||
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewFieldSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsFieldSetFrame(aContext);
|
||||
return new (aPresShell) nsFieldSetFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsFieldSetFrame)
|
||||
|
||||
nsFieldSetFrame::nsFieldSetFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsFieldSetFrame::nsFieldSetFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
, mLegendRect(GetWritingMode())
|
||||
{
|
||||
mLegendSpace = 0;
|
||||
|
@ -60,7 +60,7 @@ nsFieldSetFrame::GetInner() const
|
|||
{
|
||||
nsIFrame* last = mFrames.LastChild();
|
||||
if (last &&
|
||||
last->StyleContext()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent) {
|
||||
last->Style()->GetPseudo() == nsCSSAnonBoxes::fieldsetContent) {
|
||||
return last;
|
||||
}
|
||||
MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
|
||||
|
@ -298,13 +298,13 @@ nsFieldSetFrame::PaintBorder(
|
|||
aRenderingContext.Clip(clipPath);
|
||||
result &=
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, mStyleContext, borderFlags);
|
||||
aDirtyRect, rect, mComputedStyle, borderFlags);
|
||||
aRenderingContext.Restore();
|
||||
} else {
|
||||
result &=
|
||||
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
|
||||
aDirtyRect, nsRect(aPt, mRect.Size()),
|
||||
mStyleContext, borderFlags);
|
||||
mComputedStyle, borderFlags);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -18,7 +18,7 @@ class nsFieldSetFrame final : public nsContainerFrame
|
|||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsFieldSetFrame)
|
||||
|
||||
explicit nsFieldSetFrame(nsStyleContext* aContext);
|
||||
explicit nsFieldSetFrame(ComputedStyle* aStyle);
|
||||
|
||||
nscoord
|
||||
GetIntrinsicISize(gfxContext* aRenderingContext,
|
||||
|
|
|
@ -31,15 +31,15 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewFileControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewFileControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsFileControlFrame(aContext);
|
||||
return new (aPresShell) nsFileControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsFileControlFrame)
|
||||
|
||||
nsFileControlFrame::nsFileControlFrame(nsStyleContext* aContext)
|
||||
: nsBlockFrame(aContext, kClassID)
|
||||
nsFileControlFrame::nsFileControlFrame(ComputedStyle* aStyle)
|
||||
: nsBlockFrame(aStyle, kClassID)
|
||||
{
|
||||
AddStateBits(NS_BLOCK_FLOAT_MGR);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class nsFileControlFrame : public nsBlockFrame,
|
|||
public nsIAnonymousContentCreator
|
||||
{
|
||||
public:
|
||||
explicit nsFileControlFrame(nsStyleContext* aContext);
|
||||
explicit nsFileControlFrame(ComputedStyle* aStyle);
|
||||
|
||||
virtual void Init(nsIContent* aContent,
|
||||
nsContainerFrame* aParent,
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
|
||||
using namespace mozilla;
|
||||
|
||||
nsGfxButtonControlFrame::nsGfxButtonControlFrame(nsStyleContext* aContext)
|
||||
: nsHTMLButtonControlFrame(aContext, kClassID)
|
||||
nsGfxButtonControlFrame::nsGfxButtonControlFrame(ComputedStyle* aStyle)
|
||||
: nsHTMLButtonControlFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
nsContainerFrame*
|
||||
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewGfxButtonControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsGfxButtonControlFrame(aContext);
|
||||
return new (aPresShell) nsGfxButtonControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsGfxButtonControlFrame)
|
||||
|
|
|
@ -24,7 +24,7 @@ class nsGfxButtonControlFrame final
|
|||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsGfxButtonControlFrame)
|
||||
|
||||
explicit nsGfxButtonControlFrame(nsStyleContext* aContext);
|
||||
explicit nsGfxButtonControlFrame(ComputedStyle* aStyle);
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
using namespace mozilla;
|
||||
|
||||
nsContainerFrame*
|
||||
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewHTMLButtonControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsHTMLButtonControlFrame(aContext);
|
||||
return new (aPresShell) nsHTMLButtonControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsHTMLButtonControlFrame)
|
||||
|
||||
nsHTMLButtonControlFrame::nsHTMLButtonControlFrame(nsStyleContext* aContext,
|
||||
nsHTMLButtonControlFrame::nsHTMLButtonControlFrame(ComputedStyle* aStyle,
|
||||
nsIFrame::ClassID aID)
|
||||
: nsContainerFrame(aContext, aID)
|
||||
: nsContainerFrame(aStyle, aID)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
MOZ_ASSERT(firstKid, "Button should have a child frame for its contents");
|
||||
MOZ_ASSERT(!firstKid->GetNextSibling(),
|
||||
"Button should have exactly one child frame");
|
||||
MOZ_ASSERT(firstKid->StyleContext()->GetPseudo() ==
|
||||
MOZ_ASSERT(firstKid->Style()->GetPseudo() ==
|
||||
nsCSSAnonBoxes::buttonContent,
|
||||
"Button's child frame has unexpected pseudo type!");
|
||||
|
||||
|
@ -382,17 +382,17 @@ nsresult nsHTMLButtonControlFrame::SetFormProperty(nsAtom* aName, const nsAStrin
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
nsHTMLButtonControlFrame::GetAdditionalStyleContext(int32_t aIndex) const
|
||||
ComputedStyle*
|
||||
nsHTMLButtonControlFrame::GetAdditionalComputedStyle(int32_t aIndex) const
|
||||
{
|
||||
return mRenderer.GetStyleContext(aIndex);
|
||||
return mRenderer.GetComputedStyle(aIndex);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLButtonControlFrame::SetAdditionalStyleContext(int32_t aIndex,
|
||||
nsStyleContext* aStyleContext)
|
||||
nsHTMLButtonControlFrame::SetAdditionalComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
mRenderer.SetStyleContext(aIndex, aStyleContext);
|
||||
mRenderer.SetComputedStyle(aIndex, aComputedStyle);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -19,8 +19,8 @@ class nsHTMLButtonControlFrame : public nsContainerFrame,
|
|||
public nsIFormControlFrame
|
||||
{
|
||||
public:
|
||||
explicit nsHTMLButtonControlFrame(nsStyleContext* aContext)
|
||||
: nsHTMLButtonControlFrame(aContext, kClassID)
|
||||
explicit nsHTMLButtonControlFrame(ComputedStyle* aStyle)
|
||||
: nsHTMLButtonControlFrame(aStyle, kClassID)
|
||||
{}
|
||||
|
||||
~nsHTMLButtonControlFrame();
|
||||
|
@ -57,9 +57,9 @@ public:
|
|||
nsContainerFrame* aParent,
|
||||
nsIFrame* aPrevInFlow) override;
|
||||
|
||||
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const override;
|
||||
virtual void SetAdditionalStyleContext(int32_t aIndex,
|
||||
nsStyleContext* aStyleContext) override;
|
||||
ComputedStyle* GetAdditionalComputedStyle(int32_t aIndex) const override;
|
||||
void SetAdditionalComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle) override;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void AppendFrames(ChildListID aListID,
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
|
||||
|
||||
protected:
|
||||
nsHTMLButtonControlFrame(nsStyleContext* aContext, nsIFrame::ClassID aID);
|
||||
nsHTMLButtonControlFrame(ComputedStyle* aStyle, nsIFrame::ClassID aID);
|
||||
|
||||
virtual bool IsInput() { return false; }
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class nsImageControlFrame : public nsImageFrame,
|
|||
public nsIFormControlFrame
|
||||
{
|
||||
public:
|
||||
explicit nsImageControlFrame(nsStyleContext* aContext);
|
||||
explicit nsImageControlFrame(ComputedStyle* aStyle);
|
||||
~nsImageControlFrame();
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
const nsAString& aValue) override;
|
||||
};
|
||||
|
||||
nsImageControlFrame::nsImageControlFrame(nsStyleContext* aContext)
|
||||
: nsImageFrame(aContext, kClassID)
|
||||
nsImageControlFrame::nsImageControlFrame(ComputedStyle* aStyle)
|
||||
: nsImageFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -77,9 +77,9 @@ nsImageControlFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPost
|
|||
}
|
||||
|
||||
nsIFrame*
|
||||
NS_NewImageControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewImageControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsImageControlFrame(aContext);
|
||||
return new (aPresShell) nsImageControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsImageControlFrame)
|
||||
|
|
|
@ -14,15 +14,15 @@
|
|||
#include "nsCheckboxRadioFrame.h"
|
||||
|
||||
nsIFrame*
|
||||
NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewLegendFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
const nsStyleDisplay* disp = aContext->StyleDisplay();
|
||||
const nsStyleDisplay* disp = aStyle->StyleDisplay();
|
||||
NS_ASSERTION(!disp->IsAbsolutelyPositionedStyle() && !disp->IsFloatingStyle(),
|
||||
"Legends should not be positioned and should not float");
|
||||
#endif
|
||||
|
||||
nsIFrame* f = new (aPresShell) nsLegendFrame(aContext);
|
||||
nsIFrame* f = new (aPresShell) nsLegendFrame(aStyle);
|
||||
f->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
|
||||
return f;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ public:
|
|||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsLegendFrame)
|
||||
|
||||
explicit nsLegendFrame(nsStyleContext* aContext)
|
||||
: nsBlockFrame(aContext, kClassID)
|
||||
explicit nsLegendFrame(ComputedStyle* aStyle)
|
||||
: nsBlockFrame(aStyle, kClassID)
|
||||
{}
|
||||
|
||||
virtual void Reflow(nsPresContext* aPresContext,
|
||||
|
|
|
@ -78,10 +78,10 @@ private:
|
|||
|
||||
//---------------------------------------------------------
|
||||
nsContainerFrame*
|
||||
NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewListControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
nsListControlFrame* it =
|
||||
new (aPresShell) nsListControlFrame(aContext);
|
||||
new (aPresShell) nsListControlFrame(aStyle);
|
||||
|
||||
it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION);
|
||||
|
||||
|
@ -91,8 +91,8 @@ NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
NS_IMPL_FRAMEARENA_HELPERS(nsListControlFrame)
|
||||
|
||||
//---------------------------------------------------------
|
||||
nsListControlFrame::nsListControlFrame(nsStyleContext* aContext)
|
||||
: nsHTMLScrollFrame(aContext, kClassID, false)
|
||||
nsListControlFrame::nsListControlFrame(ComputedStyle* aStyle)
|
||||
: nsHTMLScrollFrame(aStyle, kClassID, false)
|
||||
, mView(nullptr)
|
||||
, mMightNeedSecondPass(false)
|
||||
, mHasPendingInterruptAtStartOfReflow(false)
|
||||
|
@ -1463,7 +1463,7 @@ nsListControlFrame::AboutToDropDown()
|
|||
nsIFrame* ancestor = comboboxFrame->GetParent();
|
||||
mLastDropdownBackstopColor = NS_RGBA(0,0,0,0);
|
||||
while (NS_GET_A(mLastDropdownBackstopColor) < 255 && ancestor) {
|
||||
nsStyleContext* context = ancestor->StyleContext();
|
||||
ComputedStyle* context = ancestor->Style();
|
||||
mLastDropdownBackstopColor =
|
||||
NS_ComposeColors(context->StyleBackground()->BackgroundColor(context),
|
||||
mLastDropdownBackstopColor);
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
typedef mozilla::dom::HTMLOptionElement HTMLOptionElement;
|
||||
|
||||
friend nsContainerFrame* NS_NewListControlFrame(nsIPresShell* aPresShell,
|
||||
nsStyleContext* aContext);
|
||||
ComputedStyle* aStyle);
|
||||
|
||||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsListControlFrame)
|
||||
|
@ -310,7 +310,7 @@ protected:
|
|||
*/
|
||||
virtual void ResetList(bool aAllowScrolling);
|
||||
|
||||
explicit nsListControlFrame(nsStyleContext* aContext);
|
||||
explicit nsListControlFrame(ComputedStyle* aStyle);
|
||||
virtual ~nsListControlFrame();
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,15 +30,15 @@ using mozilla::dom::Element;
|
|||
using mozilla::dom::HTMLMeterElement;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewMeterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewMeterFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsMeterFrame(aContext);
|
||||
return new (aPresShell) nsMeterFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsMeterFrame)
|
||||
|
||||
nsMeterFrame::nsMeterFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsMeterFrame::nsMeterFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
, mBarDiv(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsMeterFrame)
|
||||
|
||||
explicit nsMeterFrame(nsStyleContext* aContext);
|
||||
explicit nsMeterFrame(ComputedStyle* aStyle);
|
||||
virtual ~nsMeterFrame();
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
|
|
@ -35,9 +35,9 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewNumberControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsNumberControlFrame(aContext);
|
||||
return new (aPresShell) nsNumberControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsNumberControlFrame)
|
||||
|
@ -48,8 +48,8 @@ NS_QUERYFRAME_HEAD(nsNumberControlFrame)
|
|||
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
nsNumberControlFrame::nsNumberControlFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsNumberControlFrame::nsNumberControlFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
, mHandlingInputEvent(false)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class nsNumberControlFrame final : public nsContainerFrame
|
|||
, public nsIFormControlFrame
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
NS_NewNumberControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
||||
|
||||
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
|
||||
typedef mozilla::dom::Element Element;
|
||||
|
@ -41,7 +41,7 @@ class nsNumberControlFrame final : public nsContainerFrame
|
|||
typedef mozilla::WidgetEvent WidgetEvent;
|
||||
typedef mozilla::WidgetGUIEvent WidgetGUIEvent;
|
||||
|
||||
explicit nsNumberControlFrame(nsStyleContext* aContext);
|
||||
explicit nsNumberControlFrame(ComputedStyle* aStyle);
|
||||
|
||||
public:
|
||||
NS_DECL_QUERYFRAME
|
||||
|
|
|
@ -29,15 +29,15 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewProgressFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewProgressFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsProgressFrame(aContext);
|
||||
return new (aPresShell) nsProgressFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsProgressFrame)
|
||||
|
||||
nsProgressFrame::nsProgressFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsProgressFrame::nsProgressFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
, mBarDiv(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsProgressFrame)
|
||||
|
||||
explicit nsProgressFrame(nsStyleContext* aContext);
|
||||
explicit nsProgressFrame(ComputedStyle* aStyle);
|
||||
virtual ~nsProgressFrame();
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
|
|
@ -41,23 +41,18 @@ using namespace mozilla::image;
|
|||
NS_IMPL_ISUPPORTS(nsRangeFrame::DummyTouchListener, nsIDOMEventListener)
|
||||
|
||||
nsIFrame*
|
||||
NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewRangeFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsRangeFrame(aContext);
|
||||
return new (aPresShell) nsRangeFrame(aStyle);
|
||||
}
|
||||
|
||||
nsRangeFrame::nsRangeFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsRangeFrame::nsRangeFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
{
|
||||
}
|
||||
|
||||
nsRangeFrame::~nsRangeFrame()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (mOuterFocusStyle) {
|
||||
mOuterFocusStyle->FrameRelease();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsRangeFrame)
|
||||
|
@ -89,7 +84,7 @@ nsRangeFrame::Init(nsIContent* aContent,
|
|||
mOuterFocusStyle =
|
||||
styleSet->ProbePseudoElementStyle(aContent->AsElement(),
|
||||
CSSPseudoElementType::mozFocusOuter,
|
||||
StyleContext());
|
||||
Style());
|
||||
|
||||
return nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
}
|
||||
|
@ -225,7 +220,7 @@ nsDisplayRangeFocusRing::GetBounds(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
// We want to paint as if specifying a border for ::-moz-focus-outer
|
||||
// specifies an outline for our frame, so inflate by the border widths:
|
||||
nsStyleContext* styleContext =
|
||||
ComputedStyle* styleContext =
|
||||
static_cast<nsRangeFrame*>(mFrame)->mOuterFocusStyle;
|
||||
MOZ_ASSERT(styleContext, "We only exist if mOuterFocusStyle is non-null");
|
||||
rect.Inflate(styleContext->StyleBorder()->GetComputedBorder());
|
||||
|
@ -238,7 +233,7 @@ nsDisplayRangeFocusRing::Paint(nsDisplayListBuilder* aBuilder,
|
|||
gfxContext* aCtx)
|
||||
{
|
||||
bool unused;
|
||||
nsStyleContext* styleContext =
|
||||
ComputedStyle* styleContext =
|
||||
static_cast<nsRangeFrame*>(mFrame)->mOuterFocusStyle;
|
||||
MOZ_ASSERT(styleContext, "We only exist if mOuterFocusStyle is non-null");
|
||||
|
||||
|
@ -912,10 +907,10 @@ nsRangeFrame::GetPseudoElement(CSSPseudoElementType aType)
|
|||
return nsContainerFrame::GetPseudoElement(aType);
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
nsRangeFrame::GetAdditionalStyleContext(int32_t aIndex) const
|
||||
ComputedStyle*
|
||||
nsRangeFrame::GetAdditionalComputedStyle(int32_t aIndex) const
|
||||
{
|
||||
// We only implement this so that SetAdditionalStyleContext will be
|
||||
// We only implement this so that SetAdditionalComputedStyle will be
|
||||
// called if style changes that would change the -moz-focus-outer
|
||||
// pseudo-element have occurred.
|
||||
if (aIndex != 0) {
|
||||
|
@ -925,24 +920,12 @@ nsRangeFrame::GetAdditionalStyleContext(int32_t aIndex) const
|
|||
}
|
||||
|
||||
void
|
||||
nsRangeFrame::SetAdditionalStyleContext(int32_t aIndex,
|
||||
nsStyleContext* aStyleContext)
|
||||
nsRangeFrame::SetAdditionalComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle)
|
||||
{
|
||||
MOZ_ASSERT(aIndex == 0,
|
||||
"GetAdditionalStyleContext is handling other indexes?");
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mOuterFocusStyle) {
|
||||
mOuterFocusStyle->FrameRelease();
|
||||
}
|
||||
#endif
|
||||
"GetAdditionalComputedStyle is handling other indexes?");
|
||||
|
||||
// The -moz-focus-outer pseudo-element's style has changed.
|
||||
mOuterFocusStyle = aStyleContext;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mOuterFocusStyle) {
|
||||
mOuterFocusStyle->FrameAddRef();
|
||||
}
|
||||
#endif
|
||||
mOuterFocusStyle = aComputedStyle;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ class nsRangeFrame final : public nsContainerFrame,
|
|||
public nsIAnonymousContentCreator
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
NS_NewRangeFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
||||
|
||||
friend class nsDisplayRangeFocusRing;
|
||||
|
||||
explicit nsRangeFrame(nsStyleContext* aContext);
|
||||
explicit nsRangeFrame(ComputedStyle* aStyle);
|
||||
virtual ~nsRangeFrame();
|
||||
|
||||
typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
|
||||
|
@ -88,9 +88,9 @@ public:
|
|||
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
||||
}
|
||||
|
||||
nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const override;
|
||||
void SetAdditionalStyleContext(int32_t aIndex,
|
||||
nsStyleContext* aStyleContext) override;
|
||||
ComputedStyle* GetAdditionalComputedStyle(int32_t aIndex) const override;
|
||||
void SetAdditionalComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle) override;
|
||||
|
||||
/**
|
||||
* Returns true if the slider's thumb moves horizontally, or else false if it
|
||||
|
@ -185,7 +185,7 @@ private:
|
|||
/**
|
||||
* Cached style context for -moz-focus-outer CSS pseudo-element style.
|
||||
*/
|
||||
RefPtr<nsStyleContext> mOuterFocusStyle;
|
||||
RefPtr<ComputedStyle> mOuterFocusStyle;
|
||||
|
||||
class DummyTouchListener final : public nsIDOMEventListener
|
||||
{
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
using namespace mozilla;
|
||||
|
||||
nsContainerFrame*
|
||||
NS_NewSelectsAreaFrame(nsIPresShell* aShell, nsStyleContext* aContext, nsFrameState aFlags)
|
||||
NS_NewSelectsAreaFrame(nsIPresShell* aShell, ComputedStyle* aStyle, nsFrameState aFlags)
|
||||
{
|
||||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame(aContext);
|
||||
nsSelectsAreaFrame* it = new (aShell) nsSelectsAreaFrame(aStyle);
|
||||
|
||||
// We need NS_BLOCK_FLOAT_MGR to ensure that the options inside the select
|
||||
// aren't expanded by right floats outside the select.
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
NS_DECL_FRAMEARENA_HELPERS(nsSelectsAreaFrame)
|
||||
|
||||
friend nsContainerFrame* NS_NewSelectsAreaFrame(nsIPresShell* aShell,
|
||||
nsStyleContext* aContext,
|
||||
ComputedStyle* aStyle,
|
||||
nsFrameState aFlags);
|
||||
|
||||
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -32,8 +32,8 @@ public:
|
|||
nscoord BSizeOfARow() const { return mBSizeOfARow; }
|
||||
|
||||
protected:
|
||||
explicit nsSelectsAreaFrame(nsStyleContext* aContext) :
|
||||
nsBlockFrame(aContext, kClassID),
|
||||
explicit nsSelectsAreaFrame(ComputedStyle* aStyle) :
|
||||
nsBlockFrame(aStyle, kClassID),
|
||||
// initialize to wacky value so first call of
|
||||
// nsSelectsAreaFrame::Reflow will always invalidate
|
||||
mBSizeOfARow(nscoord_MIN)
|
||||
|
|
|
@ -54,9 +54,9 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewTextControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsTextControlFrame(aContext);
|
||||
return new (aPresShell) nsTextControlFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsTextControlFrame)
|
||||
|
@ -117,8 +117,8 @@ private:
|
|||
nsTextControlFrame& mFrame;
|
||||
};
|
||||
|
||||
nsTextControlFrame::nsTextControlFrame(nsStyleContext* aContext)
|
||||
: nsContainerFrame(aContext, kClassID)
|
||||
nsTextControlFrame::nsTextControlFrame(ComputedStyle* aStyle)
|
||||
: nsContainerFrame(aStyle, kClassID)
|
||||
, mFirstBaseline(NS_INTRINSIC_WIDTH_UNKNOWN)
|
||||
, mEditorHasBeenInitialized(false)
|
||||
, mIsProcessing(false)
|
||||
|
@ -176,7 +176,7 @@ nsTextControlFrame::CalcIntrinsicSize(gfxContext* aRenderingContext,
|
|||
nsLayoutUtils::GetFontMetricsForFrame(this, aFontSizeInflation);
|
||||
|
||||
lineHeight =
|
||||
ReflowInput::CalcLineHeight(GetContent(), StyleContext(),
|
||||
ReflowInput::CalcLineHeight(GetContent(), Style(),
|
||||
NS_AUTOHEIGHT, aFontSizeInflation);
|
||||
charWidth = fontMet->AveCharWidth();
|
||||
charMaxAdvance = fontMet->MaxAdvance();
|
||||
|
@ -634,7 +634,7 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
nscoord lineHeight = aReflowInput.ComputedBSize();
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
if (!IsSingleLineTextControl()) {
|
||||
lineHeight = ReflowInput::CalcLineHeight(GetContent(), StyleContext(),
|
||||
lineHeight = ReflowInput::CalcLineHeight(GetContent(), Style(),
|
||||
NS_AUTOHEIGHT, inflation);
|
||||
}
|
||||
RefPtr<nsFontMetrics> fontMet =
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
NS_DECLARE_FRAME_PROPERTY_DELETABLE(ContentScrollPos, nsPoint)
|
||||
|
||||
explicit nsTextControlFrame(nsStyleContext* aContext);
|
||||
explicit nsTextControlFrame(ComputedStyle* aStyle);
|
||||
virtual ~nsTextControlFrame();
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override;
|
||||
|
|
|
@ -30,7 +30,7 @@ class BRFrame final : public nsFrame
|
|||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS(BRFrame)
|
||||
|
||||
friend nsIFrame* ::NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
friend nsIFrame* ::NS_NewBRFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
||||
|
||||
ContentOffsets CalcContentOffsetsFromFramePoint(const nsPoint& aPoint) override;
|
||||
|
||||
|
@ -66,8 +66,8 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
explicit BRFrame(nsStyleContext* aContext)
|
||||
: nsFrame(aContext, kClassID)
|
||||
explicit BRFrame(ComputedStyle* aStyle)
|
||||
: nsFrame(aStyle, kClassID)
|
||||
, mAscent(NS_INTRINSIC_WIDTH_UNKNOWN)
|
||||
{}
|
||||
|
||||
|
@ -79,9 +79,9 @@ protected:
|
|||
} // namespace mozilla
|
||||
|
||||
nsIFrame*
|
||||
NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
NS_NewBRFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) BRFrame(aContext);
|
||||
return new (aPresShell) BRFrame(aStyle);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(BRFrame)
|
||||
|
@ -116,7 +116,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
// own, because we may have custom "display" value that makes our
|
||||
// ShouldSuppressLineBreak() return false.
|
||||
nsLineLayout* ll = aReflowInput.mLineLayout;
|
||||
if (ll && !GetParent()->StyleContext()->ShouldSuppressLineBreak()) {
|
||||
if (ll && !GetParent()->Style()->ShouldSuppressLineBreak()) {
|
||||
// Note that the compatibility mode check excludes AlmostStandards
|
||||
// mode, since this is the inline box model. See bug 161691.
|
||||
if ( ll->LineIsEmpty() ||
|
||||
|
@ -179,7 +179,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
BRFrame::AddInlineMinISize(gfxContext *aRenderingContext,
|
||||
nsIFrame::InlineMinISizeData *aData)
|
||||
{
|
||||
if (!GetParent()->StyleContext()->ShouldSuppressLineBreak()) {
|
||||
if (!GetParent()->Style()->ShouldSuppressLineBreak()) {
|
||||
aData->ForceBreak();
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ BRFrame::AddInlineMinISize(gfxContext *aRenderingContext,
|
|||
BRFrame::AddInlinePrefISize(gfxContext *aRenderingContext,
|
||||
nsIFrame::InlinePrefISizeData *aData)
|
||||
{
|
||||
if (!GetParent()->StyleContext()->ShouldSuppressLineBreak()) {
|
||||
if (!GetParent()->Style()->ShouldSuppressLineBreak()) {
|
||||
// Match the 1 appunit width assigned in the Reflow method above
|
||||
aData->mCurrentLine += 1;
|
||||
aData->ForceBreak();
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче