Bug 1568536 - Simplify some style system APIs. r=heycam
Return a raw pointer instead of a strong reference to a ComputedStyle, and handle the case of the style not being present by returning null rather than requiring an extra function to check it and crashing if the precondition is not met. Also, name them so that it's clear they just return outdated styles and don't make any extra effort. This is just cleanup that makes the next patch easier / more obvious. Differential Revision: https://phabricator.services.mozilla.com/D40080
This commit is contained in:
@@ -4723,12 +4723,15 @@ already_AddRefed<ComputedStyle> nsCSSFrameConstructor::ResolveComputedStyle(
|
||||
// can go. Note that this is not a correctness issue, since we'll restyle
|
||||
// later in any case.
|
||||
//
|
||||
// Also, this probably doesn't need to be a strong ref...
|
||||
//
|
||||
// Do NOT add new callers to this function in this file, ever, or I'll find
|
||||
// out.
|
||||
RefPtr<ComputedStyle> parentStyle =
|
||||
Servo_Element_GetPrimaryComputedValues(parent).Consume();
|
||||
//
|
||||
// FIXME(emilio): The const_cast is unfortunate, but it's not worse than what
|
||||
// we did before.
|
||||
auto* parentStyle =
|
||||
const_cast<ComputedStyle*>(Servo_Element_GetMaybeOutOfDateStyle(parent));
|
||||
MOZ_ASSERT(parentStyle,
|
||||
"How are we inserting text frames in an unstyled element?");
|
||||
return mPresShell->StyleSet()->ResolveStyleForText(aContent, parentStyle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user