Bug 1440384 - Rename FinishStyle to TriggerImageLoads. r=boris

That's all it does now. This will prevent other misuse and make it clearer.

Differential Revision: https://phabricator.services.mozilla.com/D18568
This commit is contained in:
Emilio Cobos Álvarez 2019-02-04 17:03:25 +01:00
Родитель 38e4d112d2
Коммит 8b10ad2988
4 изменённых файлов: 77 добавлений и 74 удалений

Просмотреть файл

@ -2793,8 +2793,9 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement,
MOZ_ASSERT(styleFrame || isDisplayContents);
// Note that upToDateContext could be the same as oldOrDisplayContentsStyle,
// but it doesn't matter, since the only point of it is calling FinishStyle
// on the relevant structs, and those don't matter for display: contents.
// but it doesn't matter, since the only point of it is calling
// TriggerImageLoads on the relevant structs, and those don't matter for
// display: contents.
upToDateContext->ResolveSameStructsAs(oldOrDisplayContentsStyle);
// We want to walk all the continuations here, even the ones with different

Просмотреть файл

@ -51,7 +51,7 @@ namespace mozilla {
if (needToCompute) { \
MOZ_ASSERT(NS_IsMainThread()); \
MOZ_ASSERT(!mozilla::IsInServoTraversal()); \
const_cast<nsStyle##name_*>(data)->FinishStyle( \
const_cast<nsStyle##name_*>(data)->TriggerImageLoads( \
*mPresContext->Document(), nullptr); \
/* the ComputedStyle owns the struct */ \
SetRequestedStruct(kStructID); \
@ -71,12 +71,12 @@ void ComputedStyle::ResolveSameStructsAs(const ComputedStyle* aOther) {
auto newBits = aOther->mRequestedStructs & ~mRequestedStructs;
#define STYLE_STRUCT(name_) \
if (nsStyle##name_::kHasFinishStyle && \
if (nsStyle##name_::kHasTriggerImageLoads && \
(newBits & StyleStructConstants::BitFor(StyleStructID::name_))) { \
const nsStyle##name_* data = ComputedData()->GetStyle##name_(); \
const nsStyle##name_* oldData = aOther->ComputedData()->GetStyle##name_(); \
const_cast<nsStyle##name_*>(data)->FinishStyle(*mPresContext->Document(), \
oldData); \
const_cast<nsStyle##name_*>(data)->TriggerImageLoads( \
*mPresContext->Document(), oldData); \
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT

Просмотреть файл

@ -289,8 +289,8 @@ nsStyleBorder::nsStyleBorder(const nsStyleBorder& aSrc)
nsStyleBorder::~nsStyleBorder() { MOZ_COUNT_DTOR(nsStyleBorder); }
void nsStyleBorder::FinishStyle(Document& aDocument,
const nsStyleBorder* aOldStyle) {
void nsStyleBorder::TriggerImageLoads(Document& aDocument,
const nsStyleBorder* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
mBorderImageSource.ResolveImage(
@ -474,8 +474,8 @@ nsStyleList::nsStyleList(const nsStyleList& aSource)
MOZ_COUNT_CTOR(nsStyleList);
}
void nsStyleList::FinishStyle(Document& aDocument,
const nsStyleList* aOldStyle) {
void nsStyleList::TriggerImageLoads(Document& aDocument,
const nsStyleList* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
if (mListStyleImage && !mListStyleImage->IsResolved()) {
@ -888,8 +888,8 @@ void StyleShapeSource::SetPath(UniquePtr<StyleSVGPath> aPath) {
mType = StyleShapeSourceType::Path;
}
void StyleShapeSource::FinishStyle(Document& aDocument,
const StyleShapeSource* aOldShapeSource) {
void StyleShapeSource::TriggerImageLoads(
Document& aDocument, const StyleShapeSource* aOldShapeSource) {
if (GetType() != StyleShapeSourceType::Image) {
return;
}
@ -1083,8 +1083,8 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
MOZ_COUNT_CTOR(nsStyleSVGReset);
}
void nsStyleSVGReset::FinishStyle(Document& aDocument,
const nsStyleSVGReset* aOldStyle) {
void nsStyleSVGReset::TriggerImageLoads(Document& aDocument,
const nsStyleSVGReset* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mMask) {
@ -1878,7 +1878,8 @@ bool nsStyleImageRequest::Resolve(Document& aDocument,
// stuff like bug 1439285. Cleanest fix if that doesn't get fixed is bug
// 1440305, but that seems too risky, and a lot of work to do before 60.
//
// Once that's fixed, the "old style" argument to FinishStyle can go away.
// Once that's fixed, the "old style" argument to TriggerImageLoads can go
// away.
if (nsContentUtils::IsChromeDoc(&aDocument) && aOldImageRequest &&
aOldImageRequest->IsResolved() && DefinitelyEquals(*aOldImageRequest)) {
MOZ_ASSERT(aOldImageRequest->mDocGroup == aDocument.GetDocGroup());
@ -2857,8 +2858,8 @@ nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
nsStyleBackground::~nsStyleBackground() { MOZ_COUNT_DTOR(nsStyleBackground); }
void nsStyleBackground::FinishStyle(Document& aDocument,
const nsStyleBackground* aOldStyle) {
void nsStyleBackground::TriggerImageLoads(Document& aDocument,
const nsStyleBackground* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
mImage.ResolveImages(aDocument, aOldStyle ? &aOldStyle->mImage : nullptr);
}
@ -3134,12 +3135,12 @@ nsStyleDisplay::~nsStyleDisplay() {
MOZ_COUNT_DTOR(nsStyleDisplay);
}
void nsStyleDisplay::FinishStyle(Document& aDocument,
const nsStyleDisplay* aOldStyle) {
void nsStyleDisplay::TriggerImageLoads(Document& aDocument,
const nsStyleDisplay* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
mShapeOutside.FinishStyle(aDocument,
aOldStyle ? &aOldStyle->mShapeOutside : nullptr);
mShapeOutside.TriggerImageLoads(
aDocument, aOldStyle ? &aOldStyle->mShapeOutside : nullptr);
}
static inline bool TransformListChanged(
@ -3653,8 +3654,8 @@ nsStyleContent::nsStyleContent(const Document& aDocument) {
nsStyleContent::~nsStyleContent() { MOZ_COUNT_DTOR(nsStyleContent); }
void nsStyleContent::FinishStyle(Document& aDocument,
const nsStyleContent* aOldStyle) {
void nsStyleContent::TriggerImageLoads(Document& aDocument,
const nsStyleContent* aOldStyle) {
for (size_t i = 0; i < mContents.Length(); ++i) {
const nsStyleContentData* oldData =
(aOldStyle && aOldStyle->mContents.Length() > i)
@ -3987,7 +3988,8 @@ nsStyleUI::nsStyleUI(const nsStyleUI& aSource)
nsStyleUI::~nsStyleUI() { MOZ_COUNT_DTOR(nsStyleUI); }
void nsStyleUI::FinishStyle(Document& aDocument, const nsStyleUI* aOldStyle) {
void nsStyleUI::TriggerImageLoads(Document& aDocument,
const nsStyleUI* aOldStyle) {
MOZ_ASSERT(NS_IsMainThread());
for (size_t i = 0; i < mCursorImages.Length(); ++i) {

Просмотреть файл

@ -88,8 +88,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont {
nsStyleFont(const nsStyleFont& aStyleFont);
explicit nsStyleFont(const mozilla::dom::Document&);
~nsStyleFont() { MOZ_COUNT_DTOR(nsStyleFont); }
void FinishStyle(mozilla::dom::Document&, const nsStyleFont*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleFont*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
@ -471,8 +471,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor {
explicit nsStyleColor(const mozilla::dom::Document&);
nsStyleColor(const nsStyleColor& aOther);
~nsStyleColor() { MOZ_COUNT_DTOR(nsStyleColor); }
void FinishStyle(mozilla::dom::Document&, const nsStyleColor*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleColor*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleColor& aNewData) const;
@ -731,8 +731,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
// Resolves and tracks the images in mImage. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleBackground constructor call.
void FinishStyle(mozilla::dom::Document&, const nsStyleBackground*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleBackground*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleBackground& aNewData) const;
@ -766,8 +766,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin {
explicit nsStyleMargin(const mozilla::dom::Document&);
nsStyleMargin(const nsStyleMargin& aMargin);
~nsStyleMargin() { MOZ_COUNT_DTOR(nsStyleMargin); }
void FinishStyle(mozilla::dom::Document&, const nsStyleMargin*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleMargin*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleMargin& aNewData) const;
@ -792,8 +792,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding {
explicit nsStylePadding(const mozilla::dom::Document&);
nsStylePadding(const nsStylePadding& aPadding);
~nsStylePadding() { MOZ_COUNT_DTOR(nsStylePadding); }
void FinishStyle(mozilla::dom::Document&, const nsStylePadding*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStylePadding*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStylePadding& aNewData) const;
@ -937,8 +937,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder {
// Resolves and tracks mBorderImageSource. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleBorder constructor call.
void FinishStyle(mozilla::dom::Document&, const nsStyleBorder*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleBorder*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleBorder& aNewData) const;
@ -1106,8 +1106,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline {
explicit nsStyleOutline(const mozilla::dom::Document&);
nsStyleOutline(const nsStyleOutline& aOutline);
~nsStyleOutline() { MOZ_COUNT_DTOR(nsStyleOutline); }
void FinishStyle(mozilla::dom::Document&, const nsStyleOutline*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleOutline*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleOutline& aNewData) const;
@ -1151,8 +1151,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList {
nsStyleList(const nsStyleList& aStyleList);
~nsStyleList();
void FinishStyle(mozilla::dom::Document&, const nsStyleList*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleList*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleList& aNewData,
const nsStyleDisplay* aOldDisplay) const;
@ -1294,8 +1294,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition {
explicit nsStylePosition(const mozilla::dom::Document&);
nsStylePosition(const nsStylePosition& aOther);
~nsStylePosition();
void FinishStyle(mozilla::dom::Document&, const nsStylePosition*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStylePosition*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(
const nsStylePosition& aNewData,
@ -1469,8 +1469,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset {
explicit nsStyleTextReset(const mozilla::dom::Document&);
nsStyleTextReset(const nsStyleTextReset& aOther);
~nsStyleTextReset();
void FinishStyle(mozilla::dom::Document&, const nsStyleTextReset*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleTextReset*) {}
const static bool kHasTriggerImageLoads = false;
// Note the difference between this and
// ComputedStyle::HasTextDecorationLines.
@ -1495,8 +1495,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText {
explicit nsStyleText(const mozilla::dom::Document&);
nsStyleText(const nsStyleText& aOther);
~nsStyleText();
void FinishStyle(mozilla::dom::Document&, const nsStyleText*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleText*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleText& aNewData) const;
@ -1593,8 +1593,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility {
explicit nsStyleVisibility(const mozilla::dom::Document&);
nsStyleVisibility(const nsStyleVisibility& aVisibility);
~nsStyleVisibility() { MOZ_COUNT_DTOR(nsStyleVisibility); }
void FinishStyle(mozilla::dom::Document&, const nsStyleVisibility*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleVisibility*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleVisibility& aNewData) const;
@ -1829,8 +1829,8 @@ struct StyleShapeSource final {
}
void SetPath(UniquePtr<StyleSVGPath> aPath);
void FinishStyle(mozilla::dom::Document&,
const StyleShapeSource* aOldShapeSource);
void TriggerImageLoads(mozilla::dom::Document&,
const StyleShapeSource* aOldShapeSource);
private:
void* operator new(size_t) = delete;
@ -1878,8 +1878,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay {
nsStyleDisplay(const nsStyleDisplay& aOther);
~nsStyleDisplay();
void FinishStyle(mozilla::dom::Document&, const nsStyleDisplay*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleDisplay*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleDisplay& aNewData) const;
@ -2313,8 +2313,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable {
explicit nsStyleTable(const mozilla::dom::Document&);
nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable();
void FinishStyle(mozilla::dom::Document&, const nsStyleTable*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleTable*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleTable& aNewData) const;
@ -2326,8 +2326,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder {
explicit nsStyleTableBorder(const mozilla::dom::Document&);
nsStyleTableBorder(const nsStyleTableBorder& aOther);
~nsStyleTableBorder();
void FinishStyle(mozilla::dom::Document&, const nsStyleTableBorder*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleTableBorder*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleTableBorder& aNewData) const;
@ -2457,8 +2457,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent {
explicit nsStyleContent(const mozilla::dom::Document&);
nsStyleContent(const nsStyleContent& aContent);
~nsStyleContent();
void FinishStyle(mozilla::dom::Document&, const nsStyleContent*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleContent*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleContent& aNewData) const;
@ -2522,8 +2522,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset {
explicit nsStyleUIReset(const mozilla::dom::Document&);
nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset();
void FinishStyle(mozilla::dom::Document&, const nsStyleUIReset*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleUIReset*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleUIReset& aNewData) const;
@ -2561,8 +2561,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUI {
nsStyleUI(const nsStyleUI& aOther);
~nsStyleUI();
void FinishStyle(mozilla::dom::Document&, const nsStyleUI*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleUI*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleUI& aNewData) const;
@ -2589,8 +2589,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL {
explicit nsStyleXUL(const mozilla::dom::Document&);
nsStyleXUL(const nsStyleXUL& aSource);
~nsStyleXUL();
void FinishStyle(mozilla::dom::Document&, const nsStyleXUL*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleXUL*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleXUL& aNewData) const;
@ -2607,8 +2607,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn {
explicit nsStyleColumn(const mozilla::dom::Document&);
nsStyleColumn(const nsStyleColumn& aSource);
~nsStyleColumn();
void FinishStyle(mozilla::dom::Document&, const nsStyleColumn*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleColumn*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleColumn& aNewData) const;
@ -2735,8 +2735,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG {
explicit nsStyleSVG(const mozilla::dom::Document&);
nsStyleSVG(const nsStyleSVG& aSource);
~nsStyleSVG();
void FinishStyle(mozilla::dom::Document&, const nsStyleSVG*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleSVG*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleSVG& aNewData) const;
@ -2834,8 +2834,8 @@ struct nsStyleFilter {
nsStyleFilter();
nsStyleFilter(const nsStyleFilter& aSource);
~nsStyleFilter();
void FinishStyle(mozilla::dom::Document&, const nsStyleFilter*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleFilter*) {}
const static bool kHasTriggerImageLoads = false;
nsStyleFilter& operator=(const nsStyleFilter& aOther);
@ -2892,8 +2892,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset {
// Resolves and tracks the images in mMask. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleSVGReset constructor call.
void FinishStyle(mozilla::dom::Document&, const nsStyleSVGReset*);
const static bool kHasFinishStyle = true;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleSVGReset*);
const static bool kHasTriggerImageLoads = true;
nsChangeHint CalcDifference(const nsStyleSVGReset& aNewData) const;
@ -2925,8 +2925,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects {
explicit nsStyleEffects(const mozilla::dom::Document&);
nsStyleEffects(const nsStyleEffects& aSource);
~nsStyleEffects();
void FinishStyle(mozilla::dom::Document&, const nsStyleEffects*) {}
const static bool kHasFinishStyle = false;
void TriggerImageLoads(mozilla::dom::Document&, const nsStyleEffects*) {}
const static bool kHasTriggerImageLoads = false;
nsChangeHint CalcDifference(const nsStyleEffects& aNewData) const;