зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1684214 - Change GetComputedStyleNoFlush to take a const element parameter r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D100463
This commit is contained in:
Родитель
2aea8e093c
Коммит
9b4eed42cb
|
@ -1098,7 +1098,7 @@ void ServoStyleSet::ClearNonInheritingComputedStyles() {
|
|||
}
|
||||
|
||||
already_AddRefed<ComputedStyle> ServoStyleSet::ResolveStyleLazily(
|
||||
Element& aElement, PseudoStyleType aPseudoType,
|
||||
const Element& aElement, PseudoStyleType aPseudoType,
|
||||
StyleRuleInclusion aRuleInclusion) {
|
||||
PreTraverseSync();
|
||||
MOZ_ASSERT(GetPresContext(),
|
||||
|
@ -1118,7 +1118,7 @@ already_AddRefed<ComputedStyle> ServoStyleSet::ResolveStyleLazily(
|
|||
* getComputedStyle, the only API where this can be observed, to look at the
|
||||
* style of the pseudo-element if it exists instead.
|
||||
*/
|
||||
Element* elementForStyleResolution = &aElement;
|
||||
const Element* elementForStyleResolution = &aElement;
|
||||
PseudoStyleType pseudoTypeForStyleResolution = aPseudoType;
|
||||
if (aPseudoType == PseudoStyleType::before) {
|
||||
if (Element* pseudo = nsLayoutUtils::GetBeforePseudo(&aElement)) {
|
||||
|
|
|
@ -210,10 +210,8 @@ class ServoStyleSet {
|
|||
// style has been resolved. If the element was unstyled and a new style
|
||||
// was resolved, it is not stored in the DOM. (That is, the element remains
|
||||
// unstyled.)
|
||||
//
|
||||
// TODO(emilio): Element argument should be `const`.
|
||||
already_AddRefed<ComputedStyle> ResolveStyleLazily(
|
||||
dom::Element&, PseudoStyleType = PseudoStyleType::NotPseudo,
|
||||
const dom::Element&, PseudoStyleType = PseudoStyleType::NotPseudo,
|
||||
StyleRuleInclusion = StyleRuleInclusion::All);
|
||||
|
||||
// Get a ComputedStyle for an anonymous box. The pseudo type must be an
|
||||
|
|
|
@ -84,7 +84,8 @@ static nsDOMCSSValueList* GetROCSSValueList(bool aCommaDelimited) {
|
|||
return new nsDOMCSSValueList(aCommaDelimited);
|
||||
}
|
||||
|
||||
static Element* GetRenderedElement(Element* aElement, nsAtom* aPseudo) {
|
||||
static const Element* GetRenderedElement(const Element* aElement,
|
||||
nsAtom* aPseudo) {
|
||||
if (aPseudo == nsCSSPseudoElements::before()) {
|
||||
return nsLayoutUtils::GetBeforePseudo(aElement);
|
||||
}
|
||||
|
@ -170,7 +171,7 @@ static bool ElementNeedsRestyle(Element* aElement, nsAtom* aPseudo,
|
|||
|
||||
// If there's a pseudo, we need to prefer that element, as the pseudo itself
|
||||
// may have explicit restyles.
|
||||
Element* styledElement = GetRenderedElement(aElement, aPseudo);
|
||||
const Element* styledElement = GetRenderedElement(aElement, aPseudo);
|
||||
// Try to skip the restyle otherwise.
|
||||
return Servo_HasPendingRestyleAncestor(
|
||||
styledElement ? styledElement : aElement, aMayNeedToFlushLayout);
|
||||
|
@ -497,7 +498,7 @@ static inline PseudoStyleType GetPseudoType(nsAtom* aPseudo) {
|
|||
}
|
||||
|
||||
already_AddRefed<ComputedStyle> nsComputedDOMStyle::DoGetComputedStyleNoFlush(
|
||||
Element* aElement, nsAtom* aPseudo, PresShell* aPresShell,
|
||||
const Element* aElement, nsAtom* aPseudo, PresShell* aPresShell,
|
||||
StyleType aStyleType) {
|
||||
MOZ_ASSERT(aElement, "NULL element");
|
||||
|
||||
|
@ -535,7 +536,7 @@ already_AddRefed<ComputedStyle> nsComputedDOMStyle::DoGetComputedStyleNoFlush(
|
|||
// mPrimaryFrame). Remove it once that's fixed.
|
||||
if (inDocWithShell && aStyleType == eAll &&
|
||||
!aElement->IsHTMLElement(nsGkAtoms::area)) {
|
||||
if (Element* element = GetRenderedElement(aElement, aPseudo)) {
|
||||
if (const Element* element = GetRenderedElement(aElement, aPseudo)) {
|
||||
if (nsIFrame* styleFrame = nsLayoutUtils::GetStyleFrame(element)) {
|
||||
ComputedStyle* result = styleFrame->Style();
|
||||
// Don't use the style if it was influenced by pseudo-elements,
|
||||
|
|
|
@ -92,7 +92,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
|
|||
Element* aElement, nsAtom* aPseudo, StyleType aStyleType = eAll);
|
||||
|
||||
static already_AddRefed<ComputedStyle> GetComputedStyleNoFlush(
|
||||
Element* aElement, nsAtom* aPseudo, StyleType aStyleType = eAll) {
|
||||
const Element* aElement, nsAtom* aPseudo, StyleType aStyleType = eAll) {
|
||||
return DoGetComputedStyleNoFlush(
|
||||
aElement, aPseudo, nsContentUtils::GetPresShellForContent(aElement),
|
||||
aStyleType);
|
||||
|
@ -158,7 +158,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
|
|||
void SetFrameComputedStyle(ComputedStyle* aStyle, uint64_t aGeneration);
|
||||
|
||||
static already_AddRefed<ComputedStyle> DoGetComputedStyleNoFlush(
|
||||
Element* aElement, nsAtom* aPseudo, mozilla::PresShell* aPresShell,
|
||||
const Element* aElement, nsAtom* aPseudo, mozilla::PresShell* aPresShell,
|
||||
StyleType aStyleType);
|
||||
|
||||
#define STYLE_STRUCT(name_) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче