--- a/accessible/base/StyleInfo.cpp
+++ b/accessible/base/StyleInfo.cpp
@@ -13,19 +13,17 @@
using namespace mozilla;
using namespace mozilla::a11y;
StyleInfo::StyleInfo(dom::Element* aElement, nsIPresShell* aPresShell) :
mElement(aElement)
{
mStyleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
- nullptr,
- aPresShell);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, aPresShell);
}
void
StyleInfo::Display(nsAString& aValue)
{
aValue.Truncate();
AppendASCIItoUTF16(
nsCSSProps::ValueToKeyword(mStyleContext->StyleDisplay()->mDisplay,
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -64,17 +64,17 @@ public:
ErrorResult& aRv);
void NotifySpecifiedTimingUpdated();
// This method calls GetTargetStyleContext 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
// that to update the properties rather than calling
- // GetStyleContextForElement.
+ // GetStyleContext.
void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
void GetSpacing(nsString& aRetVal, CallerType aCallerType)
{
KeyframeEffectReadOnly::GetSpacing(aRetVal);
}
void SetSpacing(JSContext* aCx, const nsAString& aSpacing,
CallerType aCallerType, ErrorResult& aRv);
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -17,17 +17,17 @@
#include "mozilla/EffectSet.h"
#include "mozilla/FloatingPoint.h" // For IsFinite
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TypeTraits.h"
#include "Layers.h" // For Layer
-#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
+#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContext
#include "nsContentUtils.h" // nsContentUtils::ReportToConsole
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsIPresShell.h"
#include "nsIScriptError.h"
namespace mozilla {
@@ -1045,19 +1045,17 @@ KeyframeEffectReadOnly::GetTargetStyleCo
MOZ_ASSERT(mTarget,
"Should only have a presshell when we have a target element");
nsIAtom* pseudo = mTarget->mPseudoType < CSSPseudoElementType::Count
? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
: nullptr;
- return nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
- pseudo,
- shell);
+ return nsComputedDOMStyle::GetStyleContext(mTarget->mElement, pseudo, shell);
}
#ifdef DEBUG
void
DumpAnimationProperties(nsTArray<AnimationProperty>& aAnimationProperties)
{
for (auto& p : aAnimationProperties) {
printf("%s\n", nsCSSProps::GetStringValue(p.mProperty).get());
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -379,19 +379,19 @@ protected:
// Update the associated frame state bits so that, if necessary, a stacking
// context will be created and the effect sent to the compositor. We
// typically need to do this when the properties referenced by the keyframe
// have changed, or when the target frame might have changed.
void MaybeUpdateFrameForCompositor();
// 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 GetStyleContextForElement when we are in
- // the process of building a style context may trigger various forms of
- // infinite recursion.
+ // context. That's because calling GetStyleContext when we are in the process
+ // of building a style context may trigger various forms of infinite
+ // recursion.
already_AddRefed<nsStyleContext> GetTargetStyleContext();
// A wrapper for marking cascade update according to the current
// target and its effectSet.
void MarkCascadeNeedsUpdate();
// Composites |aValueToComposite| using |aCompositeOperation| onto the value
// for |aProperty| in |aAnimationRule|, or, if there is no suitable value in
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -453,17 +453,17 @@ Element::GetBindingURL(nsIDocument *aDoc
nsCOMPtr<nsIPresShell> shell = aDocument->GetShell();
if (!shell || GetPrimaryFrame() || !isXULorPluginElement) {
*aResult = nullptr;
return true;
}
// Get the computed -moz-binding directly from the style context
RefPtr<nsStyleContext> sc =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, shell);
+ nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr, shell);
NS_ENSURE_TRUE(sc, false);
NS_IF_ADDREF(*aResult = sc->StyleDisplay()->mBinding);
return true;
}
JSObject*
Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2437,17 +2437,17 @@ ComputeAnimationValue(nsCSSPropertyID aP
{
nsIDocument* doc = aElement->GetUncomposedDoc();
nsIPresShell* shell = doc->GetShell();
if (!shell) {
return false;
}
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElement(aElement, nullptr, shell);
+ nsComputedDOMStyle::GetStyleContext(aElement, nullptr, shell);
if (!StyleAnimationValue::ComputeValue(aProperty, aElement, styleContext,
aInput, false, aOutput)) {
return false;
}
return true;
}
@@ -2727,17 +2727,17 @@ nsDOMWindowUtils::ComputeAnimationDistan
if (property == eCSSProperty_UNKNOWN ||
!ComputeAnimationValue(property, element, aValue1, v1) ||
!ComputeAnimationValue(property, element, aValue2, v2)) {
return NS_ERROR_ILLEGAL_VALUE;
}
nsIPresShell* shell = element->GetUncomposedDoc()->GetShell();
RefPtr<nsStyleContext> styleContext = shell
- ? nsComputedDOMStyle::GetStyleContextForElement(element, nullptr, shell)
+ ? nsComputedDOMStyle::GetStyleContext(element, nullptr, shell)
: nullptr;
if (!StyleAnimationValue::ComputeDistance(property, v1, v2, styleContext,
*aResult)) {
return NS_ERROR_FAILURE;
}
return NS_OK;
}
--- a/dom/base/nsPlainTextSerializer.cpp
+++ b/dom/base/nsPlainTextSerializer.cpp
@@ -1811,32 +1811,30 @@ nsPlainTextSerializer::IsInPre()
{
return !mPreformatStack.empty() && mPreformatStack.top();
}
bool
nsPlainTextSerializer::IsElementPreformatted(Element* aElement)
{
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
- nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
// Fall back to looking at the tag, in case there is no style information.
return GetIdForContent(aElement) == nsGkAtoms::pre;
}
bool
nsPlainTextSerializer::IsElementBlock(Element* aElement)
{
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
- nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
if (styleContext) {
const nsStyleDisplay* displayStyle = styleContext->StyleDisplay();
return displayStyle->IsBlockOutsideStyle();
}
// Fall back to looking at the tag, in case there is no style information.
return nsContentUtils::IsHTMLBlock(aElement);
}
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3462,18 +3462,17 @@ IsVisibleAndNotInReplacedElement(nsIFram
static bool
ElementIsVisibleNoFlush(Element* aElement)
{
if (!aElement) {
return false;
}
RefPtr<nsStyleContext> sc =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
- nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
return sc && sc->StyleVisibility()->IsVisible();
}
static void
AppendTransformedText(InnerTextAccumulator& aResult,
nsGenericDOMDataNode* aTextNode,
int32_t aStart, int32_t aEnd)
{
--- a/dom/base/nsXHTMLContentSerializer.cpp
+++ b/dom/base/nsXHTMLContentSerializer.cpp
@@ -812,18 +812,18 @@ bool
nsXHTMLContentSerializer::IsElementPreformatted(nsIContent* aNode)
{
MOZ_ASSERT(ShouldMaintainPreLevel(), "We should not be calling this needlessly");
if (!aNode->IsElement()) {
return false;
}
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aNode->AsElement(),
- nullptr, nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aNode->AsElement(),
+ nullptr, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
return textStyle->WhiteSpaceOrNewlineIsSignificant();
}
return false;
}
bool
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -1141,18 +1141,19 @@ CanvasRenderingContext2D::ParseColor(con
// if we already have a color we can just use it directly
*aColor = value.GetColorValue();
} else {
// otherwise resolve it
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
RefPtr<nsStyleContext> parentContext;
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
// Inherit from the canvas element.
- parentContext = nsComputedDOMStyle::GetStyleContextForElement(
- mCanvasElement, nullptr, presShell);
+ parentContext = nsComputedDOMStyle::GetStyleContext(mCanvasElement,
+ nullptr,
+ presShell);
}
Unused << nsRuleNode::ComputeColor(
value, presShell ? presShell->GetPresContext() : nullptr, parentContext,
*aColor);
}
return true;
}
@@ -1934,19 +1935,17 @@ CanvasRenderingContext2D::ClearTarget()
// For vertical writing-mode, unless text-orientation is sideways,
// we'll modify the initial value of textBaseline to 'middle'.
RefPtr<nsStyleContext> canvasStyle;
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (presShell) {
canvasStyle =
- nsComputedDOMStyle::GetStyleContextForElement(mCanvasElement,
- nullptr,
- presShell);
+ nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr, presShell);
if (canvasStyle) {
WritingMode wm(canvasStyle);
if (wm.IsVertical() && !wm.IsSideways()) {
CurrentState().textBaseline = TextBaseline::MIDDLE;
}
}
}
}
@@ -2644,18 +2643,17 @@ CreateFontDeclaration(const nsAString& a
static already_AddRefed<nsStyleContext>
GetFontParentStyleContext(Element* aElement, nsIPresShell* aPresShell,
ErrorResult& aError)
{
if (aElement && aElement->IsInUncomposedDoc()) {
// Inherit from the canvas element.
RefPtr<nsStyleContext> result =
- nsComputedDOMStyle::GetStyleContextForElement(aElement, nullptr,
- aPresShell);
+ nsComputedDOMStyle::GetStyleContext(aElement, nullptr, aPresShell);
if (!result) {
aError.Throw(NS_ERROR_FAILURE);
return nullptr;
}
return result.forget();
}
// otherwise inherit from default (10px sans-serif)
@@ -4197,19 +4195,17 @@ CanvasRenderingContext2D::DrawOrMeasureT
// for now, default to ltr if not in doc
bool isRTL = false;
RefPtr<nsStyleContext> canvasStyle;
if (mCanvasElement && mCanvasElement->IsInUncomposedDoc()) {
// try to find the closest context
canvasStyle =
- nsComputedDOMStyle::GetStyleContextForElement(mCanvasElement,
- nullptr,
- presShell);
+ nsComputedDOMStyle::GetStyleContext(mCanvasElement, nullptr, presShell);
if (!canvasStyle) {
return NS_ERROR_FAILURE;
}
isRTL = canvasStyle->StyleVisibility()->mDirection ==
NS_STYLE_DIRECTION_RTL;
} else {
isRTL = GET_BIDI_OPTION_DIRECTION(document->GetBidiOptions()) == IBMBIDI_TEXTDIRECTION_RTL;
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -2945,18 +2945,18 @@ IsOrHasAncestorWithDisplayNone(Element*
// XXXbholley: This could be done more directly with Servo's style system.
StyleSetHandle styleSet = aPresShell->StyleSet();
RefPtr<nsStyleContext> sc;
for (int32_t i = elementsToCheck.Length() - 1; i >= 0; --i) {
if (sc) {
sc = styleSet->ResolveStyleFor(elementsToCheck[i], sc, LazyComputeBehavior::Assert);
} else {
- sc = nsComputedDOMStyle::GetStyleContextForElementNoFlush(elementsToCheck[i],
- nullptr, aPresShell);
+ sc = nsComputedDOMStyle::GetStyleContextNoFlush(elementsToCheck[i],
+ nullptr, aPresShell);
}
if (sc->StyleDisplay()->mDisplay == StyleDisplay::None) {
return true;
}
}
return false;
}
--- a/dom/smil/nsSMILCSSValueType.cpp
+++ b/dom/smil/nsSMILCSSValueType.cpp
@@ -356,18 +356,18 @@ ValueFromStringHelper(nsCSSPropertyID aP
if (aPropID != eCSSProperty_stroke_dasharray) {
int32_t absValuePos = nsSMILParserUtils::CheckForNegativeNumber(aString);
if (absValuePos > 0) {
isNegative = true;
subStringBegin = (uint32_t)absValuePos; // Start parsing after '-' sign
}
}
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElement(aTargetElement, nullptr,
- aPresContext->PresShell());
+ nsComputedDOMStyle::GetStyleContext(aTargetElement, nullptr,
+ aPresContext->PresShell());
if (!styleContext) {
return false;
}
nsDependentSubstring subString(aString, subStringBegin);
if (!StyleAnimationValue::ComputeValue(aPropID, aTargetElement, styleContext,
subString, true, aStyleAnimValue,
aIsContextSensitive)) {
return false;
--- a/dom/svg/SVGContentUtils.cpp
+++ b/dom/svg/SVGContentUtils.cpp
@@ -174,18 +174,17 @@ SVGContentUtils::GetStrokeOptions(AutoSt
SVGContextPaint* aContextPaint,
StrokeOptionFlags aFlags)
{
RefPtr<nsStyleContext> styleContext;
if (aStyleContext) {
styleContext = aStyleContext;
} else {
styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
- nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
}
if (!styleContext) {
return;
}
const nsStyleSVG* styleSVG = styleContext->StyleSVG();
@@ -248,18 +247,17 @@ SVGContentUtils::GetStrokeWidth(nsSVGEle
nsStyleContext* aStyleContext,
SVGContextPaint* aContextPaint)
{
RefPtr<nsStyleContext> styleContext;
if (aStyleContext) {
styleContext = aStyleContext;
} else {
styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement, nullptr,
- nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
}
if (!styleContext) {
return 0.0f;
}
const nsStyleSVG* styleSVG = styleContext->StyleSVG();
@@ -271,19 +269,18 @@ SVGContentUtils::GetStrokeWidth(nsSVGEle
}
float
SVGContentUtils::GetFontSize(Element *aElement)
{
if (!aElement)
return 1.0f;
- RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
- nullptr, nullptr);
+ RefPtr<nsStyleContext> styleContext =
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
if (!styleContext) {
// ReportToConsole
NS_WARNING("Couldn't get style context for content in GetFontStyle");
return 1.0f;
}
return GetFontSize(styleContext);
}
@@ -309,28 +306,27 @@ SVGContentUtils::GetFontSize(nsStyleCont
}
float
SVGContentUtils::GetFontXHeight(Element *aElement)
{
if (!aElement)
return 1.0f;
- RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
- nullptr, nullptr);
+ RefPtr<nsStyleContext> styleContext =
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
if (!styleContext) {
// ReportToConsole
NS_WARNING("Couldn't get style context for content in GetFontStyle");
return 1.0f;
}
return GetFontXHeight(styleContext);
}
-
+
float
SVGContentUtils::GetFontXHeight(nsIFrame *aFrame)
{
MOZ_ASSERT(aFrame, "NULL frame in GetFontXHeight");
return GetFontXHeight(aFrame->StyleContext());
}
float
--- a/dom/svg/SVGGeometryElement.cpp
+++ b/dom/svg/SVGGeometryElement.cpp
@@ -122,19 +122,18 @@ SVGGeometryElement::GetOrBuildPathForMea
}
FillRule
SVGGeometryElement::GetFillRule()
{
FillRule fillRule = FillRule::FILL_WINDING; // Equivalent to StyleFillRule::Nonzero
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr,
- nullptr);
-
+ nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr, nullptr);
+
if (styleContext) {
MOZ_ASSERT(styleContext->StyleSVG()->mFillRule == StyleFillRule::Nonzero ||
styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd);
if (styleContext->StyleSVG()->mFillRule == StyleFillRule::Evenodd) {
fillRule = FillRule::FILL_EVEN_ODD;
}
} else {
--- a/dom/svg/SVGPathElement.cpp
+++ b/dom/svg/SVGPathElement.cpp
@@ -323,17 +323,17 @@ SVGPathElement::BuildPath(PathBuilder* a
// SVGPathData needs to know our stroke-linecap style and, if "square", then
// also our stroke width. See the comment for
// ApproximateZeroLengthSubpathSquareCaps for more info.
uint8_t strokeLineCap = NS_STYLE_STROKE_LINECAP_BUTT;
Float strokeWidth = 0;
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(this, nullptr, nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(this, nullptr, nullptr);
if (styleContext) {
const nsStyleSVG* style = styleContext->StyleSVG();
// Note: the path that we return may be used for hit-testing, and SVG
// exposes hit-testing of strokes that are not actually painted. For that
// reason we do not check for eStyleSVGPaintType_None or check the stroke
// opacity here.
if (style->mStrokeLinecap != NS_STYLE_STROKE_LINECAP_BUTT) {
strokeLineCap = style->mStrokeLinecap;
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -3530,18 +3530,17 @@ IsElementVisible(Element* aElement)
}
}
// Now it might be that we have no frame because we're in a
// display:none subtree, or it might be that we're just dealing with
// lazy frame construction and it hasn't happened yet. Check which
// one it is.
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
- nullptr, nullptr);
+ nsComputedDOMStyle::GetStyleContextNoFlush(aElement, nullptr, nullptr);
if (styleContext) {
return styleContext->StyleDisplay()->mDisplay != StyleDisplay::None;
}
return false;
}
bool
EditorBase::IsEditable(nsIDOMNode* aNode)
@@ -3862,19 +3861,19 @@ EditorBase::IsPreformatted(nsIDOMNode* a
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;
if (!content->IsElement()) {
content = content->GetParent();
}
if (content && content->IsElement()) {
- elementStyle = nsComputedDOMStyle::GetStyleContextForElementNoFlush(content->AsElement(),
- nullptr,
- ps);
+ elementStyle =
+ nsComputedDOMStyle::GetStyleContextNoFlush(content->AsElement(),
+ nullptr, ps);
}
if (!elementStyle) {
// Consider nodes without a style context to be NOT preformatted:
// For instance, this is true of JS tags inside the body (which show
// up as #text nodes but have no style context).
*aResult = false;
return NS_OK;
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -1169,17 +1169,17 @@ inDOMUtils::GetCleanStyleContextForEleme
nsPresContext *presContext = presShell->GetPresContext();
if (!presContext) {
return nullptr;
}
presContext->EnsureSafeToHandOutCSSRules();
RefPtr<nsStyleContext> styleContext =
- nsComputedDOMStyle::GetStyleContextForElement(aElement, aPseudo, presShell);
+ nsComputedDOMStyle::GetStyleContext(aElement, aPseudo, presShell);
return styleContext.forget();
}
NS_IMETHODIMP
inDOMUtils::GetUsedFontFaces(nsIDOMRange* aRange,
nsIDOMFontFaceList** aFontFaceList)
{
return static_cast<nsRange*>(aRange)->GetUsedFontFaces(aFontFaceList);
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -422,37 +422,36 @@ nsComputedDOMStyle::GetAuthoredPropertyV
{
// Authored style doesn't make sense to return from computed DOM style,
// so just return whatever GetPropertyValue() returns.
return GetPropertyValue(aPropertyName, aReturn);
}
/* static */
already_AddRefed<nsStyleContext>
-nsComputedDOMStyle::GetStyleContextForElement(Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType)
+nsComputedDOMStyle::GetStyleContext(Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType)
{
// If the content has a pres shell, we must use it. Otherwise we'd
// potentially mix rule trees by using the wrong pres shell's style
// set. Using the pres shell from the content also means that any
// content that's actually *in* a document will get the style from the
// correct document.
nsCOMPtr<nsIPresShell> presShell = GetPresShellForContent(aElement);
if (!presShell) {
presShell = aPresShell;
if (!presShell)
return nullptr;
}
presShell->FlushPendingNotifications(FlushType::Style);
- return GetStyleContextForElementNoFlush(aElement, aPseudo, presShell,
- aStyleType);
+ return GetStyleContextNoFlush(aElement, aPseudo, presShell, aStyleType);
}
namespace {
class MOZ_STACK_CLASS StyleResolver final
{
public:
StyleResolver(nsPresContext* aPresContext,
nsComputedDOMStyle::AnimationFlag aAnimationFlag)
@@ -569,22 +568,21 @@ public:
private:
GeckoRestyleManager* mRestyleManager = nullptr;
bool mOldSkipAnimationRules = false;
nsComputedDOMStyle::AnimationFlag mAnimationFlag;
};
}
already_AddRefed<nsStyleContext>
-nsComputedDOMStyle::DoGetStyleContextForElementNoFlush(
- Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType,
- AnimationFlag aAnimationFlag)
+nsComputedDOMStyle::DoGetStyleContextNoFlush(Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType,
+ AnimationFlag aAnimationFlag)
{
MOZ_ASSERT(aElement, "NULL element");
// If the content has a pres shell, we must use it. Otherwise we'd
// potentially mix rule trees by using the wrong pres shell's style
// set. Using the pres shell from the content also means that any
// content that's actually *in* a document will get the style from the
// correct document.
nsIPresShell *presShell = GetPresShellForContent(aElement);
@@ -642,19 +640,18 @@ nsComputedDOMStyle::DoGetStyleContextFor
}
return servoSet->ResolveTransientStyle(aElement, type);
}
RefPtr<nsStyleContext> parentContext;
nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
// Don't resolve parent context for document fragments.
if (parent && parent->IsElement()) {
- parentContext = GetStyleContextForElementNoFlush(parent->AsElement(),
- nullptr, aPresShell,
- aStyleType);
+ parentContext = GetStyleContextNoFlush(parent->AsElement(), nullptr,
+ aPresShell, aStyleType);
}
StyleResolver styleResolver(presContext, aAnimationFlag);
if (aAnimationFlag == eWithAnimation) {
return styleResolver.ResolveWithAnimation(styleSet,
aElement, type,
parentContext,
@@ -666,54 +663,53 @@ nsComputedDOMStyle::DoGetStyleContextFor
aElement, type,
parentContext,
inDocWithShell);
}
/* static */
already_AddRefed<nsStyleContext>
-nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType)
-{
- return DoGetStyleContextForElementNoFlush(aElement,
- aPseudo,
- aPresShell,
- aStyleType,
- eWithAnimation);
+nsComputedDOMStyle::GetStyleContextNoFlush(Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType)
+{
+ return DoGetStyleContextNoFlush(aElement,
+ aPseudo,
+ aPresShell,
+ aStyleType,
+ eWithAnimation);
}
/* static */
already_AddRefed<nsStyleContext>
-nsComputedDOMStyle::GetStyleContextForElementWithoutAnimation(
- Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell)
+nsComputedDOMStyle::GetStyleContextWithoutAnimation(Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell)
{
// If the content has a pres shell, we must use it. Otherwise we'd
// potentially mix rule trees by using the wrong pres shell's style
// set. Using the pres shell from the content also means that any
// content that's actually *in* a document will get the style from the
// correct document.
nsCOMPtr<nsIPresShell> presShell = GetPresShellForContent(aElement);
if (!presShell) {
presShell = aPresShell;
if (!presShell)
return nullptr;
}
presShell->FlushPendingNotifications(FlushType::Style);
- return DoGetStyleContextForElementNoFlush(aElement,
- aPseudo,
- presShell,
- eAll,
- eWithoutAnimation);
+ return DoGetStyleContextNoFlush(aElement,
+ aPseudo,
+ presShell,
+ eAll,
+ eWithoutAnimation);
}
nsMargin
nsComputedDOMStyle::GetAdjustedValuesForBoxSizing()
{
// We want the width/height of whatever parts 'width' or 'height' controls,
// which can be different depending on the value of the 'box-sizing' property.
const nsStylePosition* stylePos = StylePosition();
@@ -881,26 +877,26 @@ nsComputedDOMStyle::UpdateCurrentStyleSo
assertMsg.Append(')');
NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(pseudo) ||
mContent->IsNativeAnonymous(),
NS_LossyConvertUTF16toASCII(assertMsg).get());
}
#endif
// Need to resolve a style context
RefPtr<nsStyleContext> resolvedStyleContext =
- nsComputedDOMStyle::GetStyleContextForElement(mContent->AsElement(),
- mPseudo,
- mPresShell,
- mStyleType);
+ nsComputedDOMStyle::GetStyleContext(mContent->AsElement(),
+ mPseudo,
+ mPresShell,
+ mStyleType);
if (!resolvedStyleContext) {
ClearStyleContext();
return;
}
- // No need to re-get the generation, even though GetStyleContextForElement
+ // No need to re-get the generation, even though GetStyleContext
// will flush, since we flushed style at the top of this function.
NS_ASSERTION(mPresShell &&
currentGeneration ==
mPresShell->GetPresContext()->GetRestyleGeneration(),
"why should we have flushed style again?");
SetResolvedStyleContext(Move(resolvedStyleContext));
NS_ASSERTION(mPseudo || !mStyleContext->HasPseudoElementData(),
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -80,35 +80,35 @@ public:
StyleType aStyleType);
virtual nsINode *GetParentObject() override
{
return mContent;
}
static already_AddRefed<nsStyleContext>
- GetStyleContextForElement(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType = eAll);
+ GetStyleContext(mozilla::dom::Element* aElement, nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType = eAll);
enum AnimationFlag {
eWithAnimation,
eWithoutAnimation,
};
// Similar to the above but ignoring animation rules and with StyleType::eAll.
static already_AddRefed<nsStyleContext>
- GetStyleContextForElementWithoutAnimation(mozilla::dom::Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell);
+ GetStyleContextWithoutAnimation(mozilla::dom::Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell);
static already_AddRefed<nsStyleContext>
- GetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType = eAll);
+ GetStyleContextNoFlush(mozilla::dom::Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType = eAll);
static nsIPresShell*
GetPresShellForContent(nsIContent* aContent);
// Helper for nsDOMWindowUtils::GetVisitedDependentComputedStyle
void SetExposeVisitedStyle(bool aExpose) {
NS_ASSERTION(aExpose != mExposeVisitedStyle, "should always be changing");
mExposeVisitedStyle = aExpose;
@@ -150,21 +150,21 @@ private:
void ClearCurrentStyleSources();
// Helper functions called by UpdateCurrentStyleSources.
void ClearStyleContext();
void SetResolvedStyleContext(RefPtr<nsStyleContext>&& aContext);
void SetFrameStyleContext(nsStyleContext* aContext);
static already_AddRefed<nsStyleContext>
- DoGetStyleContextForElementNoFlush(mozilla::dom::Element* aElement,
- nsIAtom* aPseudo,
- nsIPresShell* aPresShell,
- StyleType aStyleType,
- AnimationFlag aAnimationFlag);
+ DoGetStyleContextNoFlush(mozilla::dom::Element* aElement,
+ nsIAtom* aPseudo,
+ nsIPresShell* aPresShell,
+ StyleType aStyleType,
+ AnimationFlag aAnimationFlag);
#define STYLE_STRUCT(name_, checkdata_cb_) \
const nsStyle##name_ * Style##name_() { \
return mStyleContext->Style##name_(); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT