Backed out changeset a86c4218ca5f (bug 1353187)

This commit is contained in:
Carsten "Tomcat" Book 2017-04-04 09:54:51 +02:00
parent 16f14ffd75
commit 358125cbde
8 changed files with 35 additions and 74 deletions

View File

@ -13,7 +13,7 @@ namespace mozilla {
void
FramePropertyTable::SetInternal(
nsIFrame* aFrame, UntypedDescriptor aProperty, void* aValue)
const nsIFrame* aFrame, UntypedDescriptor aProperty, void* aValue)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ASSERTION(aFrame, "Null frame?");
@ -111,7 +111,7 @@ FramePropertyTable::GetInternal(
void*
FramePropertyTable::RemoveInternal(
nsIFrame* aFrame, UntypedDescriptor aProperty, bool* aFoundResult)
const nsIFrame* aFrame, UntypedDescriptor aProperty, bool* aFoundResult)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ASSERTION(aFrame, "Null frame?");
@ -176,7 +176,7 @@ FramePropertyTable::RemoveInternal(
void
FramePropertyTable::DeleteInternal(
nsIFrame* aFrame, UntypedDescriptor aProperty)
const nsIFrame* aFrame, UntypedDescriptor aProperty)
{
MOZ_ASSERT(NS_IsMainThread());
NS_ASSERTION(aFrame, "Null frame?");
@ -206,7 +206,7 @@ FramePropertyTable::DeleteAllForEntry(Entry* aEntry)
}
void
FramePropertyTable::DeleteAllFor(nsIFrame* aFrame)
FramePropertyTable::DeleteAllFor(const nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "Null frame?");

View File

@ -165,7 +165,7 @@ public:
* is destroyed.
*/
template<typename T>
void Set(nsIFrame* aFrame, Descriptor<T> aProperty,
void Set(const nsIFrame* aFrame, Descriptor<T> aProperty,
PropertyType<T> aValue)
{
void* ptr = ReinterpretHelper<T>::ToPointer(aValue);
@ -228,7 +228,7 @@ public:
* 'property value is null'.
*/
template<typename T>
PropertyType<T> Remove(nsIFrame* aFrame, Descriptor<T> aProperty,
PropertyType<T> Remove(const nsIFrame* aFrame, Descriptor<T> aProperty,
bool* aFoundResult = nullptr)
{
void* ptr = RemoveInternal(aFrame, aProperty, aFoundResult);
@ -241,7 +241,7 @@ public:
* property, nothing happens.
*/
template<typename T>
void Delete(nsIFrame* aFrame, Descriptor<T> aProperty)
void Delete(const nsIFrame* aFrame, Descriptor<T> aProperty)
{
DeleteInternal(aFrame, aProperty);
}
@ -249,7 +249,7 @@ public:
* Remove and destroy all property values for a frame. This requires one
* hashtable lookup (using the frame as the key).
*/
void DeleteAllFor(nsIFrame* aFrame);
void DeleteAllFor(const nsIFrame* aFrame);
/**
* Remove and destroy all property values for all frames.
*/
@ -258,16 +258,16 @@ public:
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
protected:
void SetInternal(nsIFrame* aFrame, UntypedDescriptor aProperty,
void SetInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
void* aValue);
void* GetInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
bool* aFoundResult);
void* RemoveInternal(nsIFrame* aFrame, UntypedDescriptor aProperty,
void* RemoveInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty,
bool* aFoundResult);
void DeleteInternal(nsIFrame* aFrame, UntypedDescriptor aProperty);
void DeleteInternal(const nsIFrame* aFrame, UntypedDescriptor aProperty);
template<typename T>
struct ReinterpretHelper
@ -392,21 +392,22 @@ protected:
};
/**
* The FrameProperties/ConstFrameProperties class encapsulates the
* properties of a frame.
*
* However, since frame properties are like member variables, we have
* different versions for whether the frame is |const|, sharing a common
* base class.
*
* CVnsIFrame is either |nsIFrame| or |const nsIFrame|.
* This class encapsulates the properties of a frame.
*/
template<class CVnsIFrame>
class FramePropertiesBase {
class FrameProperties {
public:
template<typename T> using Descriptor = FramePropertyTable::Descriptor<T>;
template<typename T> using PropertyType = FramePropertyTable::PropertyType<T>;
FrameProperties(FramePropertyTable* aTable, const nsIFrame* aFrame)
: mTable(aTable), mFrame(aFrame) {}
template<typename T>
void Set(Descriptor<T> aProperty, PropertyType<T> aValue) const
{
mTable->Set(mFrame, aProperty, aValue);
}
template<typename T>
bool Has(Descriptor<T> aProperty) const
{
@ -419,49 +420,21 @@ public:
{
return mTable->Get(mFrame, aProperty, aFoundResult);
}
protected:
FramePropertiesBase(FramePropertyTable* aTable, CVnsIFrame* aFrame)
: mTable(aTable), mFrame(aFrame) {}
FramePropertyTable* const mTable;
CVnsIFrame* const mFrame;
};
class ConstFrameProperties : public FramePropertiesBase<const nsIFrame> {
public:
ConstFrameProperties(FramePropertyTable* aTable, const nsIFrame* aFrame)
: FramePropertiesBase(aTable, aFrame)
{
}
};
class FrameProperties : public FramePropertiesBase<nsIFrame> {
public:
FrameProperties(FramePropertyTable* aTable, nsIFrame* aFrame)
: FramePropertiesBase(aTable, aFrame)
{
}
template<typename T>
void Set(Descriptor<T> aProperty, PropertyType<T> aValue) const
{
mTable->Set(mFrame, aProperty, aValue);
}
template<typename T>
PropertyType<T> Remove(Descriptor<T> aProperty,
bool* aFoundResult = nullptr) const
{
return mTable->Remove(mFrame, aProperty, aFoundResult);
}
template<typename T>
void Delete(Descriptor<T> aProperty) const
void Delete(Descriptor<T> aProperty)
{
mTable->Delete(mFrame, aProperty);
}
private:
FramePropertyTable* mTable;
const nsIFrame* mFrame;
};
} // namespace mozilla

View File

@ -1702,7 +1702,7 @@ nsIFrame::GetVisibility() const
}
bool isSet = false;
ConstFrameProperties props = Properties();
FrameProperties props = Properties();
uint32_t visibleCount = props.Get(VisibilityStateProperty(), &isSet);
MOZ_ASSERT(isSet, "Should have a VisibilityStateProperty value "

View File

@ -577,7 +577,6 @@ public:
using Visibility = mozilla::Visibility;
typedef mozilla::FrameProperties FrameProperties;
typedef mozilla::ConstFrameProperties ConstFrameProperties;
typedef mozilla::layers::Layer Layer;
typedef mozilla::layout::FrameChildList ChildList;
typedef mozilla::layout::FrameChildListID ChildListID;
@ -3252,14 +3251,10 @@ public:
return mContent == aParentContent;
}
FrameProperties Properties() {
FrameProperties Properties() const {
return FrameProperties(PresContext()->PropertyTable(), this);
}
ConstFrameProperties Properties() const {
return ConstFrameProperties(PresContext()->PropertyTable(), this);
}
/**
* Return true if and only if this frame obeys visibility:hidden.
* if it does not, then nsContainerFrame will hide its view even though

View File

@ -3204,7 +3204,7 @@ protected:
const nsStyleText* mTextStyle;
const nsTextFragment* mFrag;
const nsIFrame* mLineContainer;
nsTextFrame* mFrame;
const nsTextFrame* mFrame;
gfxSkipCharsIterator mStart; // Offset in original and transformed string
const gfxSkipCharsIterator mTempIterator;

View File

@ -167,7 +167,7 @@ FindCellProperty(const nsIFrame* aCellFrame,
nsTArray<int8_t>* propertyData = nullptr;
while (currentFrame) {
ConstFrameProperties props = currentFrame->Properties();
FrameProperties props = currentFrame->Properties();
propertyData = props.Get(aFrameProperty);
bool frameIsTable = (currentFrame->GetType() == nsGkAtoms::tableFrame);

View File

@ -2794,17 +2794,11 @@ nsTableFrame::GetUsedMargin() const
NS_DECLARE_FRAME_PROPERTY_DELETABLE(TableBCProperty, BCPropertyData)
BCPropertyData*
nsTableFrame::GetBCProperty() const
{
return Properties().Get(TableBCProperty());
}
BCPropertyData*
nsTableFrame::GetOrCreateBCProperty()
nsTableFrame::GetBCProperty(bool aCreateIfNecessary) const
{
FrameProperties props = Properties();
BCPropertyData* value = props.Get(TableBCProperty());
if (!value) {
if (!value && aCreateIfNecessary) {
value = new BCPropertyData();
props.Set(TableBCProperty(), value);
}
@ -4253,7 +4247,7 @@ nsTableFrame::AddBCDamageArea(const TableArea& aValue)
SetNeedToCalcBCBorders(true);
// Get the property
BCPropertyData* value = GetOrCreateBCProperty();
BCPropertyData* value = GetBCProperty(true);
if (value) {
#ifdef DEBUG
VerifyNonNegativeDamageRect(value->mDamageArea);
@ -4293,7 +4287,7 @@ nsTableFrame::SetFullBCDamageArea()
SetNeedToCalcBCBorders(true);
BCPropertyData* value = GetOrCreateBCProperty();
BCPropertyData* value = GetBCProperty(true);
if (value) {
value->mDamageArea = TableArea(0, 0, GetColCount(), GetRowCount());
}

View File

@ -807,8 +807,7 @@ protected:
void SetBorderCollapse(bool aValue);
BCPropertyData* GetBCProperty() const;
BCPropertyData* GetOrCreateBCProperty();
BCPropertyData* GetBCProperty(bool aCreateIfNecessary = false) const;
void SetFullBCDamageArea();
void CalcBCBorders();