forked from mirrors/gecko-dev
Bug 1478069: Trivial frame constructor cleanup. r=TYLin
Using references helps to see when stuff can and cannot be null. I removed useless aTag / aNamespaceId arguments which are useless now that XBL can't override them (bug 1450617), so FindXULData is the only one that keeps them alive. Also, I took the liberty of renaming a few fooComputedStyle variables to just fooStyle, and clarify naming in some pseudo-element-related functions to say originating element (the spec term) and avoid confusing it with the generated _moz_generated_content_before / _moz_generated_content_after element. Note that this is a partial state, more stuff will come in the future. Differential Revision: https://phabricator.services.mozilla.com/D2326 MozReview-Commit-ID: 39B30doREUH
This commit is contained in:
parent
f06ddb0760
commit
26b508d03c
16 changed files with 367 additions and 375 deletions
|
|
@ -2352,7 +2352,7 @@ private:
|
|||
ComputedStyle& ParentStyle() {
|
||||
if (!mParentContext) {
|
||||
mLazilyResolvedParentContext =
|
||||
mParentRestyleState.StyleSet().ResolveServoStyle(&mParentElement);
|
||||
mParentRestyleState.StyleSet().ResolveServoStyle(mParentElement);
|
||||
mParentContext = mLazilyResolvedParentContext;
|
||||
}
|
||||
return *mParentContext;
|
||||
|
|
@ -2675,7 +2675,7 @@ RestyleManager::ProcessPostTraversal(
|
|||
Servo_Element_IsDisplayContents(aElement);
|
||||
if (isDisplayContents) {
|
||||
oldOrDisplayContentsStyle =
|
||||
aRestyleState.StyleSet().ResolveServoStyle(aElement);
|
||||
aRestyleState.StyleSet().ResolveServoStyle(*aElement);
|
||||
}
|
||||
|
||||
Maybe<ServoRestyleState> thisFrameRestyleState;
|
||||
|
|
@ -2694,7 +2694,7 @@ RestyleManager::ProcessPostTraversal(
|
|||
|
||||
RefPtr<ComputedStyle> upToDateContext =
|
||||
wasRestyled
|
||||
? aRestyleState.StyleSet().ResolveServoStyle(aElement)
|
||||
? aRestyleState.StyleSet().ResolveServoStyle(*aElement)
|
||||
: oldOrDisplayContentsStyle;
|
||||
|
||||
ServoPostTraversalFlags childrenFlags =
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -67,7 +67,7 @@ public:
|
|||
}
|
||||
|
||||
// get the alternate text for a content node
|
||||
static void GetAlternateTextFor(mozilla::dom::Element* aContent,
|
||||
static void GetAlternateTextFor(Element* aContent,
|
||||
nsAtom* aTag, // content object's tag
|
||||
nsAString& aAltText);
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ public:
|
|||
*
|
||||
* Returns whether a reconstruct was posted for any ancestor.
|
||||
*/
|
||||
bool DestroyFramesFor(mozilla::dom::Element* aElement);
|
||||
bool DestroyFramesFor(Element* aElement);
|
||||
|
||||
// Request to create a continuing frame. This method never returns null.
|
||||
nsIFrame* CreateContinuingFrame(nsPresContext* aPresContext,
|
||||
|
|
@ -423,7 +423,8 @@ private:
|
|||
* CreateAttributeContent creates a single content/frame combination for an
|
||||
* |attr(foo)| generated content.
|
||||
*
|
||||
* @param aParentContent the parent content for the generated content
|
||||
* @param aParentContent the parent content for the generated content (that
|
||||
* is, the originating element).
|
||||
* @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
|
||||
|
|
@ -433,7 +434,7 @@ private:
|
|||
* @param [out] aNewContent the content node we create
|
||||
* @param [out] aNewFrame the new frame we create
|
||||
*/
|
||||
void CreateAttributeContent(mozilla::dom::Element* aParentContent,
|
||||
void CreateAttributeContent(const Element& aParentContent,
|
||||
nsIFrame* aParentFrame,
|
||||
int32_t aAttrNamespace,
|
||||
nsAtom* aAttrName,
|
||||
|
|
@ -455,21 +456,21 @@ private:
|
|||
* Create a content node for the given generated content style.
|
||||
* 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 aOriginatingElement is the node that has the before/after style.
|
||||
* @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,
|
||||
ComputedStyle* aComputedStyle,
|
||||
uint32_t aContentIndex);
|
||||
const Element& aOriginatingElement,
|
||||
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,
|
||||
ComputedStyle* aComputedStyle,
|
||||
CSSPseudoElementType aPseudoElement,
|
||||
// aParentFrame may be null; this method doesn't use it directly in any case.
|
||||
void CreateGeneratedContentItem(nsFrameConstructorState& aState,
|
||||
nsContainerFrame* aParentFrame,
|
||||
Element& aOriginatingElement,
|
||||
ComputedStyle&,
|
||||
CSSPseudoElementType aPseudoElement,
|
||||
FrameConstructionItemList& aItems);
|
||||
|
||||
// This method can change aFrameList: it can chop off the beginning and put
|
||||
|
|
@ -590,7 +591,7 @@ private:
|
|||
*/
|
||||
struct FrameConstructionData;
|
||||
typedef const FrameConstructionData*
|
||||
(* FrameConstructionDataGetter)(Element*, ComputedStyle*);
|
||||
(* FrameConstructionDataGetter)(const Element&, ComputedStyle&);
|
||||
|
||||
/* A constructor function that's used for complicated construction tasks.
|
||||
This is expected to create the new frame, initialize it, add whatever
|
||||
|
|
@ -786,8 +787,9 @@ private:
|
|||
match or if the matching integer has a FrameConstructionDataGetter that
|
||||
returns null. */
|
||||
static const FrameConstructionData*
|
||||
FindDataByInt(int32_t aInt, Element* aElement,
|
||||
ComputedStyle* aComputedStyle,
|
||||
FindDataByInt(int32_t aInt,
|
||||
const Element&,
|
||||
ComputedStyle&,
|
||||
const FrameConstructionDataByInt* aDataPtr,
|
||||
uint32_t aDataLength);
|
||||
|
||||
|
|
@ -801,8 +803,9 @@ private:
|
|||
* actually match, aTagFound will be true, even if the return value is null.
|
||||
*/
|
||||
static const FrameConstructionData*
|
||||
FindDataByTag(nsAtom* aTag, Element* aElement,
|
||||
ComputedStyle* aComputedStyle,
|
||||
FindDataByTag(nsAtom* aTag,
|
||||
const Element& aElement,
|
||||
ComputedStyle& aComputedStyle,
|
||||
const FrameConstructionDataByTag* aDataPtr,
|
||||
uint32_t aDataLength);
|
||||
|
||||
|
|
@ -1444,20 +1447,16 @@ private:
|
|||
// null if aElement is not HTML.
|
||||
// aParentFrame might be null. If it is, that means it was an
|
||||
// inline frame.
|
||||
static const FrameConstructionData* FindHTMLData(Element* aContent,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
static const FrameConstructionData* FindHTMLData(const Element&,
|
||||
nsIFrame* aParentFrame,
|
||||
ComputedStyle* aComputedStyle);
|
||||
ComputedStyle&);
|
||||
// HTML data-finding helper functions
|
||||
static const FrameConstructionData* FindImgData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindGeneratedImageData(Element*,
|
||||
ComputedStyle*);
|
||||
static const FrameConstructionData* FindImgControlData(Element*,
|
||||
ComputedStyle*);
|
||||
static const FrameConstructionData* FindInputData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindObjectData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindCanvasData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindImgData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindGeneratedImageData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindImgControlData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindInputData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindObjectData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindCanvasData(const Element&, ComputedStyle&);
|
||||
|
||||
/* Construct a frame from the given FrameConstructionItem. This function
|
||||
will handle adding the frame to frame lists, processing children, setting
|
||||
|
|
@ -1532,44 +1531,38 @@ private:
|
|||
nsFrameItems& aBlockItems,
|
||||
nsFrameItems& aNewItems);
|
||||
|
||||
// Function to find FrameConstructionData for aContent. Will return
|
||||
// null if aContent is not MathML.
|
||||
static const FrameConstructionData* FindMathMLData(Element* aElement,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
ComputedStyle* aComputedStyle);
|
||||
// Function to find FrameConstructionData for an element. Will return
|
||||
// null if the element is not MathML.
|
||||
static const FrameConstructionData* FindMathMLData(const Element&, ComputedStyle&);
|
||||
|
||||
// Function to find FrameConstructionData for aContent. Will return
|
||||
// null if aContent is not XUL.
|
||||
static const FrameConstructionData* FindXULTagData(Element* aElement,
|
||||
// Function to find FrameConstructionData for an element. Will return
|
||||
// null if the element is not XUL.
|
||||
//
|
||||
// NOTE(emilio): This gets the overloaded tag and namespace id since they can
|
||||
// be overriden by extends="" in XBL.
|
||||
static const FrameConstructionData* FindXULTagData(const Element&,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
ComputedStyle* aComputedStyle);
|
||||
ComputedStyle&);
|
||||
// XUL data-finding helper functions and structures
|
||||
#ifdef MOZ_XUL
|
||||
static const FrameConstructionData*
|
||||
FindPopupGroupData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData* FindPopupGroupData(const Element&, ComputedStyle&);
|
||||
// sXULTextBoxData used for both labels and descriptions
|
||||
static const FrameConstructionData sXULTextBoxData;
|
||||
static const FrameConstructionData*
|
||||
FindXULLabelData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindXULDescriptionData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData* FindXULLabelData(const Element&, ComputedStyle&);
|
||||
static const FrameConstructionData* FindXULDescriptionData(const Element&, ComputedStyle&);
|
||||
#ifdef XP_MACOSX
|
||||
static const FrameConstructionData*
|
||||
FindXULMenubarData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData* FindXULMenubarData(const Element&, ComputedStyle&);
|
||||
#endif /* XP_MACOSX */
|
||||
#endif /* MOZ_XUL */
|
||||
|
||||
// Function to find FrameConstructionData for aContent using one of the XUL
|
||||
// display types. Will return null if aDisplay doesn't have a XUL display
|
||||
// Function to find FrameConstructionData for an element using one of the XUL
|
||||
// display types. Will return null if the style doesn't have a XUL display
|
||||
// type. This function performs no other checks, so should only be called if
|
||||
// we know for sure that the content is not something that should get a frame
|
||||
// we know for sure that the element is not something that should get a frame
|
||||
// constructed by tag.
|
||||
static const FrameConstructionData*
|
||||
FindXULDisplayData(const nsStyleDisplay* aDisplay,
|
||||
Element* aElement,
|
||||
ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData* FindXULDisplayData(const nsStyleDisplay&,
|
||||
const Element&);
|
||||
|
||||
/**
|
||||
* Constructs an outer frame, an anonymous child that wraps its real
|
||||
|
|
@ -1605,19 +1598,16 @@ private:
|
|||
const nsStyleDisplay* aDisplay,
|
||||
nsFrameItems& aFrameItems);
|
||||
|
||||
static const FrameConstructionData* FindSVGData(Element* aElement,
|
||||
nsAtom* aTag,
|
||||
int32_t aNameSpaceID,
|
||||
static const FrameConstructionData* FindSVGData(const Element&,
|
||||
nsIFrame* aParentFrame,
|
||||
bool aIsWithinSVGText,
|
||||
bool aAllowsTextPathChild,
|
||||
ComputedStyle* aComputedStyle);
|
||||
ComputedStyle&);
|
||||
|
||||
/* Not static because it does PropagateScrollToViewport. If this
|
||||
changes, make this static */
|
||||
const FrameConstructionData*
|
||||
FindDisplayData(const nsStyleDisplay* aDisplay, Element* aElement,
|
||||
ComputedStyle* aComputedStyle);
|
||||
// Not static because it does PropagateScrollToViewport. If this
|
||||
// changes, make this static.
|
||||
const FrameConstructionData* FindDisplayData(const nsStyleDisplay&,
|
||||
const Element&);
|
||||
|
||||
/**
|
||||
* Construct a scrollable block frame
|
||||
|
|
|
|||
|
|
@ -2090,7 +2090,7 @@ nsLayoutUtils::HasPseudoStyle(nsIContent* aContent,
|
|||
RefPtr<ComputedStyle> pseudoContext;
|
||||
if (aContent) {
|
||||
pseudoContext = aPresContext->StyleSet()->
|
||||
ProbePseudoElementStyle(aContent->AsElement(), aPseudoElement,
|
||||
ProbePseudoElementStyle(*aContent->AsElement(), aPseudoElement,
|
||||
aComputedStyle);
|
||||
}
|
||||
return pseudoContext != nullptr;
|
||||
|
|
@ -10264,7 +10264,7 @@ nsLayoutUtils::StyleForScrollbar(nsIFrame* aScrollbarPart)
|
|||
"Root element is the only case for this fallback "
|
||||
"path to be triggered");
|
||||
RefPtr<ComputedStyle> style =
|
||||
pc->StyleSet()->ResolveServoStyle(content->AsElement());
|
||||
pc->StyleSet()->ResolveServoStyle(*content->AsElement());
|
||||
// Dropping the strong reference is fine because the style should be
|
||||
// held strongly by the element.
|
||||
return style.get();
|
||||
|
|
|
|||
|
|
@ -1439,10 +1439,10 @@ nsPresContext::UpdateViewportScrollbarStylesOverride()
|
|||
}
|
||||
|
||||
bool
|
||||
nsPresContext::ElementWouldPropagateScrollbarStyles(Element* aElement)
|
||||
nsPresContext::ElementWouldPropagateScrollbarStyles(const Element& aElement)
|
||||
{
|
||||
MOZ_ASSERT(IsPaginated(), "Should only be called on paginated contexts");
|
||||
if (aElement->GetParent() && !aElement->IsHTMLElement(nsGkAtoms::body)) {
|
||||
if (aElement.GetParent() && !aElement.IsHTMLElement(nsGkAtoms::body)) {
|
||||
// We certainly won't be propagating from this element.
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1453,7 +1453,7 @@ nsPresContext::ElementWouldPropagateScrollbarStyles(Element* aElement)
|
|||
// in practice we will make this call quite rarely, because we checked for all
|
||||
// the common cases above.
|
||||
ScrollbarStyles dummy(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO);
|
||||
return GetPropagatedScrollbarStylesForViewport(this, &dummy) == aElement;
|
||||
return GetPropagatedScrollbarStylesForViewport(this, &dummy) == &aElement;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -775,7 +775,7 @@ public:
|
|||
* Check whether the given element would propagate its scrollbar styles to the
|
||||
* viewport in non-paginated mode. Must only be called if IsPaginated().
|
||||
*/
|
||||
bool ElementWouldPropagateScrollbarStyles(mozilla::dom::Element* aElement);
|
||||
bool ElementWouldPropagateScrollbarStyles(const mozilla::dom::Element&);
|
||||
|
||||
/**
|
||||
* Set and get methods for controlling the background drawing
|
||||
|
|
|
|||
|
|
@ -575,7 +575,7 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
|
|||
|
||||
// get styles assigned to -moz-focus-inner (ie dotted border on Windows)
|
||||
mInnerFocusStyle =
|
||||
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
|
||||
styleSet->ProbePseudoElementStyle(*mFrame->GetContent()->AsElement(),
|
||||
CSSPseudoElementType::mozFocusInner,
|
||||
context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ nsRangeFrame::Init(nsIContent* aContent,
|
|||
ServoStyleSet* styleSet = PresContext()->StyleSet();
|
||||
|
||||
mOuterFocusStyle =
|
||||
styleSet->ProbePseudoElementStyle(aContent->AsElement(),
|
||||
styleSet->ProbePseudoElementStyle(*aContent->AsElement(),
|
||||
CSSPseudoElementType::mozFocusOuter,
|
||||
Style());
|
||||
|
||||
|
|
|
|||
|
|
@ -7844,8 +7844,8 @@ already_AddRefed<ComputedStyle>
|
|||
nsBlockFrame::GetFirstLetterStyle(nsPresContext* aPresContext)
|
||||
{
|
||||
return aPresContext->StyleSet()->
|
||||
ProbePseudoElementStyle(mContent->AsElement(),
|
||||
ProbePseudoElementStyle(*mContent->AsElement(),
|
||||
CSSPseudoElementType::firstLetter,
|
||||
mComputedStyle);
|
||||
Style());
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -2298,7 +2298,7 @@ nsIFrame::ComputeSelectionStyle() const
|
|||
}
|
||||
RefPtr<ComputedStyle> sc =
|
||||
PresContext()->StyleSet()->ProbePseudoElementStyle(
|
||||
element, CSSPseudoElementType::selection, Style());
|
||||
*element, CSSPseudoElementType::selection, Style());
|
||||
return sc.forget();
|
||||
}
|
||||
|
||||
|
|
@ -9874,7 +9874,7 @@ nsFrame::DoGetParentComputedStyle(nsIFrame** aProviderFrame) const
|
|||
pseudo == nsCSSAnonBoxes::tableWrapper) {
|
||||
if (Servo_Element_IsDisplayContents(parentElement)) {
|
||||
RefPtr<ComputedStyle> style =
|
||||
PresShell()->StyleSet()->ResolveServoStyle(parentElement);
|
||||
PresShell()->StyleSet()->ResolveServoStyle(*parentElement);
|
||||
// NOTE(emilio): we return a weak reference because the element also
|
||||
// holds the style context alive. This is a bit silly (we could've
|
||||
// returned a weak ref directly), but it's probably not worth
|
||||
|
|
|
|||
|
|
@ -581,12 +581,11 @@ nsImageFrame::SourceRectToDest(const nsIntRect& aRect)
|
|||
|
||||
/* static */
|
||||
bool
|
||||
nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
|
||||
ComputedStyle* aComputedStyle)
|
||||
nsImageFrame::ShouldCreateImageFrameFor(const Element& aElement,
|
||||
ComputedStyle& aStyle)
|
||||
{
|
||||
EventStates state = aElement->State();
|
||||
if (IMAGE_OK(state,
|
||||
HaveSpecifiedSize(aComputedStyle->StylePosition()))) {
|
||||
EventStates state = aElement.State();
|
||||
if (IMAGE_OK(state, HaveSpecifiedSize(aStyle.StylePosition()))) {
|
||||
// Image is fine; do the image frame thing
|
||||
return true;
|
||||
}
|
||||
|
|
@ -604,28 +603,28 @@ nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
|
|||
// - otherwise, skip the icon
|
||||
bool useSizedBox;
|
||||
|
||||
if (aComputedStyle->StyleUIReset()->mForceBrokenImageIcon) {
|
||||
if (aStyle.StyleUIReset()->mForceBrokenImageIcon) {
|
||||
useSizedBox = true;
|
||||
}
|
||||
else if (gIconLoad && gIconLoad->mPrefForceInlineAltText) {
|
||||
useSizedBox = false;
|
||||
}
|
||||
else if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||
!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::alt) &&
|
||||
!aElement->IsHTMLElement(nsGkAtoms::object) &&
|
||||
!aElement->IsHTMLElement(nsGkAtoms::input)) {
|
||||
else if (aElement.HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||
!aElement.HasAttr(kNameSpaceID_None, nsGkAtoms::alt) &&
|
||||
!aElement.IsHTMLElement(nsGkAtoms::object) &&
|
||||
!aElement.IsHTMLElement(nsGkAtoms::input)) {
|
||||
// Use a sized box if we have no alt text. This means no alt attribute
|
||||
// and the node is not an object or an input (since those always have alt
|
||||
// text).
|
||||
useSizedBox = true;
|
||||
}
|
||||
else if (aElement->OwnerDoc()->GetCompatibilityMode() !=
|
||||
else if (aElement.OwnerDoc()->GetCompatibilityMode() !=
|
||||
eCompatibility_NavQuirks) {
|
||||
useSizedBox = false;
|
||||
}
|
||||
else {
|
||||
// check whether we have specified size
|
||||
useSizedBox = HaveSpecifiedSize(aComputedStyle->StylePosition());
|
||||
useSizedBox = HaveSpecifiedSize(aStyle.StylePosition());
|
||||
}
|
||||
|
||||
return useSizedBox;
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ public:
|
|||
* should get an image frame. Note that this method is only used by the
|
||||
* frame constructor; it's only here because it uses gIconLoad for now.
|
||||
*/
|
||||
static bool ShouldCreateImageFrameFor(mozilla::dom::Element* aElement,
|
||||
ComputedStyle* aComputedStyle);
|
||||
static bool ShouldCreateImageFrameFor(const mozilla::dom::Element& aElement,
|
||||
ComputedStyle& aStyle);
|
||||
|
||||
ImgDrawResult DisplayAltFeedback(gfxContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ nsPlaceholderFrame::GetParentComputedStyleForOutOfFlow(nsIFrame** aProviderFrame
|
|||
mContent ? mContent->GetFlattenedTreeParentElement() : nullptr;
|
||||
if (parentElement && Servo_Element_IsDisplayContents(parentElement)) {
|
||||
RefPtr<ComputedStyle> style =
|
||||
PresShell()->StyleSet()->ResolveServoStyle(parentElement);
|
||||
PresShell()->StyleSet()->ResolveServoStyle(*parentElement);
|
||||
*aProviderFrame = nullptr;
|
||||
// See the comment in GetParentComputedStyle to see why returning this as a
|
||||
// weak ref is fine.
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ ServoStyleSet::ResolveStyleFor(Element* aElement,
|
|||
aElement, CSSPseudoElementType::NotPseudo);
|
||||
}
|
||||
|
||||
return ResolveServoStyle(aElement);
|
||||
return ResolveServoStyle(*aElement);
|
||||
}
|
||||
|
||||
const ServoElementSnapshotTable&
|
||||
|
|
@ -533,13 +533,13 @@ ServoStyleSet::ResolveStyleForPlaceholder()
|
|||
|
||||
static inline bool
|
||||
LazyPseudoIsCacheable(CSSPseudoElementType aType,
|
||||
Element* aOriginatingElement,
|
||||
const Element& aOriginatingElement,
|
||||
ComputedStyle* aParentContext)
|
||||
{
|
||||
return aParentContext &&
|
||||
!nsCSSPseudoElements::IsEagerlyCascadedInServo(aType) &&
|
||||
aOriginatingElement->HasServoData() &&
|
||||
!Servo_Element_IsPrimaryStyleReusedViaRuleNode(aOriginatingElement);
|
||||
aOriginatingElement.HasServoData() &&
|
||||
!Servo_Element_IsPrimaryStyleReusedViaRuleNode(&aOriginatingElement);
|
||||
}
|
||||
|
||||
already_AddRefed<ComputedStyle>
|
||||
|
|
@ -561,7 +561,7 @@ ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
|
|||
Servo_ResolveStyle(aPseudoElement, mRawSet.get()).Consume();
|
||||
} else {
|
||||
bool cacheable =
|
||||
LazyPseudoIsCacheable(aType, aOriginatingElement, aParentContext);
|
||||
LazyPseudoIsCacheable(aType, *aOriginatingElement, aParentContext);
|
||||
computedValues =
|
||||
cacheable ? aParentContext->GetCachedLazyPseudoStyle(aType) : nullptr;
|
||||
|
||||
|
|
@ -903,7 +903,7 @@ ServoStyleSet::AddDocStyleSheet(StyleSheet* aSheet, nsIDocument* aDocument)
|
|||
}
|
||||
|
||||
already_AddRefed<ComputedStyle>
|
||||
ServoStyleSet::ProbePseudoElementStyle(Element* aOriginatingElement,
|
||||
ServoStyleSet::ProbePseudoElementStyle(const Element& aOriginatingElement,
|
||||
CSSPseudoElementType aType,
|
||||
ComputedStyle* aParentContext)
|
||||
{
|
||||
|
|
@ -923,7 +923,8 @@ ServoStyleSet::ProbePseudoElementStyle(Element* aOriginatingElement,
|
|||
RefPtr<ComputedStyle> computedValues =
|
||||
cacheable ? aParentContext->GetCachedLazyPseudoStyle(aType) : nullptr;
|
||||
if (!computedValues) {
|
||||
computedValues = Servo_ResolvePseudoStyle(aOriginatingElement, aType,
|
||||
computedValues = Servo_ResolvePseudoStyle(&aOriginatingElement,
|
||||
aType,
|
||||
/* is_probe = */ true,
|
||||
nullptr,
|
||||
mRawSet.get()).Consume();
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@ public:
|
|||
|
||||
void SetAuthorStyleDisabled(bool aStyleDisabled);
|
||||
|
||||
// FIXME(emilio): All the callers pass Allow here, and aParentContext isn't
|
||||
// used...
|
||||
already_AddRefed<ComputedStyle>
|
||||
ResolveStyleFor(dom::Element* aElement,
|
||||
ComputedStyle* aParentContext,
|
||||
|
|
@ -253,9 +255,9 @@ public:
|
|||
|
||||
// check whether there is ::before/::after style for an element
|
||||
already_AddRefed<ComputedStyle>
|
||||
ProbePseudoElementStyle(dom::Element* aOriginatingElement,
|
||||
ProbePseudoElementStyle(const dom::Element& aOriginatingElement,
|
||||
CSSPseudoElementType aType,
|
||||
ComputedStyle* aParentContext);
|
||||
ComputedStyle* aParentStyle);
|
||||
|
||||
/**
|
||||
* Performs a Servo traversal to compute style for all dirty nodes in the
|
||||
|
|
@ -333,8 +335,7 @@ public:
|
|||
*
|
||||
* FIXME(emilio): Is there a point in this after bug 1367904?
|
||||
*/
|
||||
inline already_AddRefed<ComputedStyle>
|
||||
ResolveServoStyle(dom::Element* aElement);
|
||||
inline already_AddRefed<ComputedStyle> ResolveServoStyle(const dom::Element&);
|
||||
|
||||
bool GetKeyframesForName(const dom::Element&,
|
||||
const ComputedStyle&,
|
||||
|
|
@ -345,7 +346,7 @@ public:
|
|||
nsTArray<ComputedKeyframeValues>
|
||||
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
|
||||
dom::Element* aElement,
|
||||
const mozilla::ComputedStyle* aStyle);
|
||||
const ComputedStyle* aStyle);
|
||||
|
||||
void
|
||||
GetAnimationValues(RawServoDeclarationBlock* aDeclarations,
|
||||
|
|
@ -428,8 +429,7 @@ public:
|
|||
* the modified attribute doesn't appear in an attribute selector in
|
||||
* a style sheet.
|
||||
*/
|
||||
bool MightHaveAttributeDependency(const dom::Element& aElement,
|
||||
nsAtom* aAttribute) const;
|
||||
bool MightHaveAttributeDependency(const dom::Element&, nsAtom* aAttribute) const;
|
||||
|
||||
/**
|
||||
* Returns true if a change in event state on an element might require
|
||||
|
|
@ -439,8 +439,7 @@ public:
|
|||
* the changed state isn't depended upon by any pseudo-class selectors
|
||||
* in a style sheet.
|
||||
*/
|
||||
bool HasStateDependency(const dom::Element& aElement,
|
||||
EventStates aState) const;
|
||||
bool HasStateDependency(const dom::Element&, EventStates) const;
|
||||
|
||||
/**
|
||||
* Returns true if a change in document state might require us to restyle the
|
||||
|
|
|
|||
|
|
@ -20,9 +20,10 @@ ServoStyleSet::EvaluateSourceSizeList(
|
|||
}
|
||||
|
||||
already_AddRefed<ComputedStyle>
|
||||
ServoStyleSet::ResolveServoStyle(dom::Element* aElement)
|
||||
ServoStyleSet::ResolveServoStyle(const dom::Element& aElement)
|
||||
{
|
||||
return Servo_ResolveStyle(aElement, mRawSet.get()).Consume();
|
||||
// TODO(emilio): mRawSet isn't used by this function, remove.
|
||||
return Servo_ResolveStyle(&aElement, mRawSet.get()).Consume();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
Loading…
Reference in a new issue