Backed out changeset 59c0589220ec (bug 1368249) unused function GetNormalPosition at nsIFrame.h:1073. r=backout

This commit is contained in:
Sebastian Hengst 2017-05-28 15:38:15 +02:00
Родитель 1f8beade4e
Коммит 99f17a4e95
8 изменённых файлов: 31 добавлений и 78 удалений

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

@ -33,18 +33,6 @@ FrameProperties::SetInternal(UntypedDescriptor aProperty, void* aValue,
#endif
}
void
FrameProperties::AddInternal(UntypedDescriptor aProperty, void* aValue)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aProperty, "Null property?");
mProperties.AppendElement(PropertyValue(aProperty, aValue));
#ifdef DEBUG
mMaxLength = std::max<uint32_t>(mMaxLength, mProperties.Length());
#endif
}
void*
FrameProperties::RemoveInternal(UntypedDescriptor aProperty, bool* aFoundResult)
{

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

@ -175,17 +175,6 @@ public:
SetInternal(aProperty, ptr, aFrame);
}
/**
* Add a property value; the descriptor MUST NOT already be present.
*/
template<typename T>
void Add(Descriptor<T> aProperty, PropertyType<T> aValue)
{
MOZ_ASSERT(!Has(aProperty), "duplicate frame property");
void* ptr = ReinterpretHelper<T>::ToPointer(aValue);
AddInternal(aProperty, ptr);
}
/**
* @return true if @aProperty is set. This requires a linear search through the
* properties of the frame.
@ -210,8 +199,7 @@ public:
template<typename T>
bool Has(Descriptor<T> aProperty) const
{
return mProperties.IndexOf(aProperty, 0, PropertyComparator())
!= nsTArray<PropertyValue>::NoIndex;
return mProperties.IndexOf(aProperty, 0, PropertyComparator()) != nsTArray<PropertyValue>::NoIndex;
}
/**
@ -280,8 +268,6 @@ private:
void SetInternal(UntypedDescriptor aProperty, void* aValue,
const nsIFrame* aFrame);
void AddInternal(UntypedDescriptor aProperty, void* aValue);
inline void*
GetInternal(UntypedDescriptor aProperty, bool* aFoundResult) const;

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

@ -803,10 +803,9 @@ RecomputePosition(nsIFrame* aFrame)
// since we've already checked mPosition and aren't changing the frame's
// normal position, go ahead and add the offsets directly.
// First, we need to ensure that the normal position is stored though.
bool hasProperty;
nsPoint normalPosition = cont->GetNormalPosition(&hasProperty);
if (!hasProperty) {
cont->AddProperty(nsIFrame::NormalPositionProperty(),
nsPoint normalPosition = cont->GetNormalPosition();
if (!cont->GetProperty(nsIFrame::NormalPositionProperty())) {
cont->SetProperty(nsIFrame::NormalPositionProperty(),
new nsPoint(normalPosition));
}
cont->SetPosition(normalPosition +

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

@ -6177,7 +6177,7 @@ AddGenConPseudoToFrame(nsIFrame* aOwnerFrame, nsIContent* aContent)
aOwnerFrame->GetProperty(nsIFrame::GenConProperty());
if (!value) {
value = new nsIFrame::ContentArray;
aOwnerFrame->AddProperty(nsIFrame::GenConProperty(), value);
aOwnerFrame->SetProperty(nsIFrame::GenConProperty(), value);
}
value->AppendElement(aContent);
}

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

@ -1020,7 +1020,7 @@ ReflowInput::ComputeRelativeOffsets(WritingMode aWM,
if (physicalOffsets) {
*physicalOffsets = aComputedOffsets;
} else {
aFrame->AddProperty(nsIFrame::ComputedOffsetProperty(),
aFrame->SetProperty(nsIFrame::ComputedOffsetProperty(),
new nsMargin(aComputedOffsets));
}
}
@ -1045,7 +1045,7 @@ ReflowInput::ApplyRelativePositioning(nsIFrame* aFrame,
if (normalPosition) {
*normalPosition = *aPosition;
} else {
aFrame->AddProperty(nsIFrame::NormalPositionProperty(),
aFrame->SetProperty(nsIFrame::NormalPositionProperty(),
new nsPoint(*aPosition));
}
@ -2519,7 +2519,7 @@ UpdateProp(nsIFrame* aFrame,
if (propValue) {
*propValue = aNewValue;
} else {
aFrame->AddProperty(aProperty, new nsMargin(aNewValue));
aFrame->SetProperty(aProperty, new nsMargin(aNewValue));
}
} else {
aFrame->DeleteProperty(aProperty);

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

@ -949,16 +949,16 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
const nsStyleMargin* oldMargin = aOldStyleContext->PeekStyleMargin();
if (oldMargin && oldMargin->GetMargin(oldValue)) {
if ((!StyleMargin()->GetMargin(newValue) || oldValue != newValue) &&
!HasProperty(UsedMarginProperty())) {
AddProperty(UsedMarginProperty(), new nsMargin(oldValue));
!GetProperty(UsedMarginProperty())) {
SetProperty(UsedMarginProperty(), new nsMargin(oldValue));
}
}
const nsStylePadding* oldPadding = aOldStyleContext->PeekStylePadding();
if (oldPadding && oldPadding->GetPadding(oldValue)) {
if ((!StylePadding()->GetPadding(newValue) || oldValue != newValue) &&
!HasProperty(UsedPaddingProperty())) {
AddProperty(UsedPaddingProperty(), new nsMargin(oldValue));
!GetProperty(UsedPaddingProperty())) {
SetProperty(UsedPaddingProperty(), new nsMargin(oldValue));
}
}
@ -967,8 +967,8 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
oldValue = oldBorder->GetComputedBorder();
newValue = StyleBorder()->GetComputedBorder();
if (oldValue != newValue &&
!HasProperty(UsedBorderProperty())) {
AddProperty(UsedBorderProperty(), new nsMargin(oldValue));
!GetProperty(UsedBorderProperty())) {
SetProperty(UsedBorderProperty(), new nsMargin(oldValue));
}
}
}
@ -6569,7 +6569,7 @@ nsIFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
return;
}
rect = new nsRect();
AddProperty(InvalidationRect(), rect);
SetProperty(InvalidationRect(), rect);
AddStateBits(NS_FRAME_HAS_INVALID_RECT);
}
@ -6832,6 +6832,18 @@ nsIFrame::GetNormalRect() const
return GetRect();
}
nsPoint
nsIFrame::GetNormalPosition() const
{
// It might be faster to first check
// StyleDisplay()->IsRelativelyPositionedStyle().
nsPoint* normalPosition = GetProperty(NormalPositionProperty());
if (normalPosition) {
return *normalPosition;
}
return GetPosition();
}
nsPoint
nsIFrame::GetPositionIgnoringScrolling()
{
@ -8713,7 +8725,7 @@ nsIFrame::GetOverflowAreasProperty()
// The property isn't set yet, so allocate a new rect, set the property,
// and return the newly allocated rect
overflow = new nsOverflowAreas;
AddProperty(OverflowAreasProperty(), overflow);
SetProperty(OverflowAreasProperty(), overflow);
return overflow;
}
@ -9010,7 +9022,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
nsOverflowAreas* initial =
GetProperty(nsIFrame::InitialOverflowProperty());
if (!initial) {
AddProperty(nsIFrame::InitialOverflowProperty(),
SetProperty(nsIFrame::InitialOverflowProperty(),
new nsOverflowAreas(aOverflowAreas));
} else if (initial != &aOverflowAreas) {
*initial = aOverflowAreas;

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

@ -1066,12 +1066,9 @@ public:
nsRect GetNormalRect() const;
/**
* Return frame's position without relative positioning.
* If aHasProperty is provided, returns whether the normal position
* was stored in a frame property.
* Return frame's position without relative positioning
*/
inline nsPoint GetNormalPosition(bool* aHasProperty = nullptr) const;
nsPoint GetNormalPosition() const;
mozilla::LogicalPoint
GetLogicalNormalPosition(mozilla::WritingMode aWritingMode,
const nsSize& aContainerSize) const
@ -3408,7 +3405,6 @@ public:
return false;
}
// Add a property, or update an existing property for the given descriptor.
template<typename T>
void SetProperty(FrameProperties::Descriptor<T> aProperty,
FrameProperties::PropertyType<T> aValue)
@ -3419,18 +3415,6 @@ public:
mProperties->Set(aProperty, aValue, this);
}
// Unconditionally add a property; use ONLY if the descriptor is known
// to NOT already be present.
template<typename T>
void AddProperty(FrameProperties::Descriptor<T> aProperty,
FrameProperties::PropertyType<T> aValue)
{
if (!mProperties) {
mProperties = mozilla::MakeUnique<FrameProperties>();
}
mProperties->Add(aProperty, aValue);
}
template<typename T>
FrameProperties::PropertyType<T>
RemoveProperty(FrameProperties::Descriptor<T> aProperty,

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

@ -180,20 +180,4 @@ nsIFrame::GetInFlowParent()
return GetParent();
}
nsPoint
nsIFrame::GetNormalPosition(bool* aHasProperty) const
{
nsPoint* normalPosition = GetProperty(NormalPositionProperty());
if (normalPosition) {
if (aHasProperty) {
*aHasProperty = true;
}
return *normalPosition;
}
if (aHasProperty) {
*aHasProperty = false;
}
return GetPosition();
}
#endif