diff options
author | win7-7 <win7-7@users.noreply.github.com> | 2019-06-26 01:51:45 +0300 |
---|---|---|
committer | win7-7 <win7-7@users.noreply.github.com> | 2019-06-26 01:51:45 +0300 |
commit | 00812e30dfa70f9b1a752cf0d09de00f6d401c85 (patch) | |
tree | e7eec9b55dd4e5825d3196f196c7f981be56e17a /layout/tables | |
parent | d7359c38b197c221c43def1e24cb48d4aee51bba (diff) | |
download | UXP-00812e30dfa70f9b1a752cf0d09de00f6d401c85.tar UXP-00812e30dfa70f9b1a752cf0d09de00f6d401c85.tar.gz UXP-00812e30dfa70f9b1a752cf0d09de00f6d401c85.tar.lz UXP-00812e30dfa70f9b1a752cf0d09de00f6d401c85.tar.xz UXP-00812e30dfa70f9b1a752cf0d09de00f6d401c85.zip |
Attach FrameProperties to each frame instead of using a shared hashtable
Dispense the shared hashtable and instead attach the frame property list directly to nsIFrame.
Diffstat (limited to 'layout/tables')
-rw-r--r-- | layout/tables/nsTableFrame.cpp | 31 | ||||
-rw-r--r-- | layout/tables/nsTableFrame.h | 3 | ||||
-rw-r--r-- | layout/tables/nsTableRowFrame.cpp | 10 | ||||
-rw-r--r-- | layout/tables/nsTableRowGroupFrame.cpp | 6 | ||||
-rw-r--r-- | layout/tables/nsTableWrapperFrame.cpp | 4 |
5 files changed, 28 insertions, 26 deletions
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 4c11d2704..b9b6ca5fe 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -272,13 +272,12 @@ nsTableFrame::RegisterPositionedTablePart(nsIFrame* aFrame) tableFrame = static_cast<nsTableFrame*>(tableFrame->FirstContinuation()); // Retrieve the positioned parts array for this table. - FrameProperties props = tableFrame->Properties(); - FrameTArray* positionedParts = props.Get(PositionedTablePartArray()); + FrameTArray* positionedParts = tableFrame->GetProperty(PositionedTablePartArray()); // Lazily create the array if it doesn't exist yet. if (!positionedParts) { positionedParts = new FrameTArray; - props.Set(PositionedTablePartArray(), positionedParts); + tableFrame->SetProperty(PositionedTablePartArray(), positionedParts); } // Add this frame to the list. @@ -302,8 +301,7 @@ nsTableFrame::UnregisterPositionedTablePart(nsIFrame* aFrame, tableFrame = static_cast<nsTableFrame*>(tableFrame->FirstContinuation()); // Retrieve the positioned parts array for this table. - FrameProperties props = tableFrame->Properties(); - FrameTArray* positionedParts = props.Get(PositionedTablePartArray()); + FrameTArray* positionedParts = tableFrame->GetProperty(PositionedTablePartArray()); // Remove the frame. MOZ_ASSERT(positionedParts && positionedParts->Contains(aFrame), @@ -1992,7 +1990,7 @@ nsTableFrame::FixupPositionedTableParts(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, const ReflowInput& aReflowInput) { - FrameTArray* positionedParts = Properties().Get(PositionedTablePartArray()); + FrameTArray* positionedParts = GetProperty(PositionedTablePartArray()); if (!positionedParts) { return; } @@ -2653,13 +2651,18 @@ nsTableFrame::GetUsedMargin() const NS_DECLARE_FRAME_PROPERTY_DELETABLE(TableBCProperty, BCPropertyData) BCPropertyData* -nsTableFrame::GetBCProperty(bool aCreateIfNecessary) const +nsTableFrame::GetBCProperty() const { - FrameProperties props = Properties(); - BCPropertyData* value = props.Get(TableBCProperty()); - if (!value && aCreateIfNecessary) { + return GetProperty(TableBCProperty()); +} + +BCPropertyData* +nsTableFrame::GetOrCreateBCProperty() +{ + BCPropertyData* value = GetProperty(TableBCProperty()); + if (!value) { value = new BCPropertyData(); - props.Set(TableBCProperty(), value); + SetProperty(TableBCProperty(), value); } return value; @@ -4103,7 +4106,7 @@ nsTableFrame::AddBCDamageArea(const TableArea& aValue) SetNeedToCalcBCBorders(true); // Get the property - BCPropertyData* value = GetBCProperty(true); + BCPropertyData* value = GetOrCreateBCProperty(); if (value) { #ifdef DEBUG VerifyNonNegativeDamageRect(value->mDamageArea); @@ -4143,7 +4146,7 @@ nsTableFrame::SetFullBCDamageArea() SetNeedToCalcBCBorders(true); - BCPropertyData* value = GetBCProperty(true); + BCPropertyData* value = GetOrCreateBCProperty(); if (value) { value->mDamageArea = TableArea(0, 0, GetColCount(), GetRowCount()); } @@ -4310,7 +4313,7 @@ BCMapCellInfo::BCMapCellInfo(nsTableFrame* aTableFrame) : mTableFrame(aTableFrame) , mNumTableRows(aTableFrame->GetRowCount()) , mNumTableCols(aTableFrame->GetColCount()) - , mTableBCData(mTableFrame->Properties().Get(TableBCProperty())) + , mTableBCData(mTableFrame->GetProperty(TableBCProperty())) , mTableWM(aTableFrame->StyleContext()) { ResetCellInfo(); diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index a78625339..7e56c28c1 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -809,7 +809,8 @@ protected: void SetBorderCollapse(bool aValue); - BCPropertyData* GetBCProperty(bool aCreateIfNecessary = false) const; + BCPropertyData* GetBCProperty() const; + BCPropertyData* GetOrCreateBCProperty(); void SetFullBCDamageArea(); void CalcBCBorders(); diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 81b5d6699..1b6051ef2 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -978,7 +978,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, // MovePositionBy does internally. (This codepath should really // be merged into the else below if we can.) nsMargin* computedOffsetProp = - kidFrame->Properties().Get(nsIFrame::ComputedOffsetProperty()); + kidFrame->GetProperty(nsIFrame::ComputedOffsetProperty()); // Bug 975644: a position:sticky kid can end up with a null // property value here. LogicalMargin computedOffsets(wm, computedOffsetProp ? @@ -1417,16 +1417,14 @@ nsTableRowFrame::SetUnpaginatedBSize(nsPresContext* aPresContext, nscoord aValue) { NS_ASSERTION(!GetPrevInFlow(), "program error"); - // Get the property - aPresContext->PropertyTable()-> - Set(this, RowUnpaginatedHeightProperty(), aValue); + // Set the property + SetProperty(RowUnpaginatedHeightProperty(), aValue); } nscoord nsTableRowFrame::GetUnpaginatedBSize() { - FrameProperties props = FirstInFlow()->Properties(); - return props.Get(RowUnpaginatedHeightProperty()); + return GetProperty(RowUnpaginatedHeightProperty()); } void nsTableRowFrame::SetContinuousBCBorderWidth(LogicalSide aForSide, diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 60596f12b..8f014b204 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -1910,7 +1910,7 @@ nsTableRowGroupFrame::ClearRowCursor() } RemoveStateBits(NS_ROWGROUP_HAS_ROW_CURSOR); - Properties().Delete(RowCursorProperty()); + DeleteProperty(RowCursorProperty()); } nsTableRowGroupFrame::FrameCursorData* @@ -1934,7 +1934,7 @@ nsTableRowGroupFrame::SetupRowCursor() FrameCursorData* data = new FrameCursorData(); if (!data) return nullptr; - Properties().Set(RowCursorProperty(), data); + SetProperty(RowCursorProperty(), data); AddStateBits(NS_ROWGROUP_HAS_ROW_CURSOR); return data; } @@ -1946,7 +1946,7 @@ nsTableRowGroupFrame::GetFirstRowContaining(nscoord aY, nscoord* aOverflowAbove) return nullptr; } - FrameCursorData* property = Properties().Get(RowCursorProperty()); + FrameCursorData* property = GetProperty(RowCursorProperty()); uint32_t cursorIndex = property->mCursorIndex; uint32_t frameCount = property->mFrames.Length(); if (cursorIndex >= frameCount) diff --git a/layout/tables/nsTableWrapperFrame.cpp b/layout/tables/nsTableWrapperFrame.cpp index e44652a73..f0b6d1512 100644 --- a/layout/tables/nsTableWrapperFrame.cpp +++ b/layout/tables/nsTableWrapperFrame.cpp @@ -246,7 +246,7 @@ nsTableWrapperFrame::InitChildReflowInput(nsPresContext& aPresContext, } // Propagate our stored CB size if present, minus any margins. if (!HasAnyStateBits(NS_FRAME_OUT_OF_FLOW)) { - LogicalSize* cb = Properties().Get(GridItemCBSizeProperty()); + LogicalSize* cb = GetProperty(GridItemCBSizeProperty()); if (cb) { cbSize.emplace(*cb); *cbSize -= aReflowInput.ComputedLogicalMargin().Size(wm); @@ -953,7 +953,7 @@ nsTableWrapperFrame::Reflow(nsPresContext* aPresContext, // for the table frame if we are bsize constrained and the caption is above // or below the inner table. Also reduce the CB size that we store for // our children in case we're a grid item, by the same amount. - LogicalSize* cbSize = Properties().Get(GridItemCBSizeProperty()); + LogicalSize* cbSize = GetProperty(GridItemCBSizeProperty()); if (NS_UNCONSTRAINEDSIZE != aOuterRI.AvailableBSize() || cbSize) { nscoord captionBSize = 0; nscoord captionISize = 0; |