summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsBlockFrame.cpp
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2019-07-03 15:17:08 +0000
committerGitHub <noreply@github.com>2019-07-03 15:17:08 +0000
commit0e54a032624b4ce23a959454047bfd504a734cc0 (patch)
tree6e19e55c35095548177db6fb9e5fbabe2aff2310 /layout/generic/nsBlockFrame.cpp
parent8ea1f38f9c55a076dade47eaf0daaea27590d179 (diff)
parent3051056bbb0b41b8258d91e44a4ff8ec33a98d8f (diff)
downloadUXP-0e54a032624b4ce23a959454047bfd504a734cc0.tar
UXP-0e54a032624b4ce23a959454047bfd504a734cc0.tar.gz
UXP-0e54a032624b4ce23a959454047bfd504a734cc0.tar.lz
UXP-0e54a032624b4ce23a959454047bfd504a734cc0.tar.xz
UXP-0e54a032624b4ce23a959454047bfd504a734cc0.zip
Merge pull request #1151 from win7-7/FrameProperties
Attach FrameProperties to each frame instead of using a shared hashtable
Diffstat (limited to 'layout/generic/nsBlockFrame.cpp')
-rw-r--r--layout/generic/nsBlockFrame.cpp58
1 files changed, 25 insertions, 33 deletions
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
index 851e3406c..a37bfc06b 100644
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -326,10 +326,8 @@ nsBlockFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsLineBox::DeleteLineList(presContext, mLines, aDestructRoot,
&mFrames);
- FramePropertyTable* props = presContext->PropertyTable();
-
if (HasPushedFloats()) {
- SafelyDestroyFrameListProp(aDestructRoot, shell, props,
+ SafelyDestroyFrameListProp(aDestructRoot, shell,
PushedFloatProperty());
RemoveStateBits(NS_BLOCK_HAS_PUSHED_FLOATS);
}
@@ -343,13 +341,13 @@ nsBlockFrame::DestroyFrom(nsIFrame* aDestructRoot)
}
if (GetStateBits() & NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS) {
- SafelyDestroyFrameListProp(aDestructRoot, shell, props,
+ SafelyDestroyFrameListProp(aDestructRoot, shell,
OverflowOutOfFlowsProperty());
RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
}
if (HasOutsideBullet()) {
- SafelyDestroyFrameListProp(aDestructRoot, shell, props,
+ SafelyDestroyFrameListProp(aDestructRoot, shell,
OutsideBulletProperty());
RemoveStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
}
@@ -1669,7 +1667,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
// our computed size due to overflowing their containing block. (E.g. this
// ensures we fill the last row when a multi-row grid item is fragmented).
bool found;
- nscoord bSize = Properties().Get(FragStretchBSizeProperty(), &found);
+ nscoord bSize = GetProperty(FragStretchBSizeProperty(), &found);
if (found) {
finalSize.BSize(wm) = std::max(bSize, finalSize.BSize(wm));
}
@@ -1679,7 +1677,7 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
if (MOZ_UNLIKELY(aReflowInput.mFlags.mBClampMarginBoxMinSize) &&
NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
bool found;
- nscoord cbSize = Properties().Get(BClampMarginBoxMinSizeProperty(), &found);
+ nscoord cbSize = GetProperty(BClampMarginBoxMinSizeProperty(), &found);
if (found) {
auto marginBoxBSize = finalSize.BSize(wm) +
aReflowInput.ComputedLogicalMargin().BStartEnd(wm);
@@ -1697,11 +1695,10 @@ nsBlockFrame::ComputeFinalSize(const ReflowInput& aReflowInput,
finalSize.BSize(wm) = std::max(0, finalSize.BSize(wm));
*aBEndEdgeOfChildren = blockEndEdgeOfChildren;
- FrameProperties properties = Properties();
if (blockEndEdgeOfChildren != finalSize.BSize(wm) - borderPadding.BEnd(wm)) {
- properties.Set(BlockEndEdgeOfChildrenProperty(), blockEndEdgeOfChildren);
+ SetProperty(BlockEndEdgeOfChildrenProperty(), blockEndEdgeOfChildren);
} else {
- properties.Delete(BlockEndEdgeOfChildrenProperty());
+ DeleteProperty(BlockEndEdgeOfChildrenProperty());
}
aMetrics.SetSize(wm, finalSize);
@@ -1834,7 +1831,7 @@ nsBlockFrame::ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas)
{
bool found;
nscoord blockEndEdgeOfChildren =
- Properties().Get(BlockEndEdgeOfChildrenProperty(), &found);
+ GetProperty(BlockEndEdgeOfChildrenProperty(), &found);
if (found) {
ConsiderBlockEndEdgeOfChildren(GetWritingMode(),
blockEndEdgeOfChildren, aOverflowAreas);
@@ -4985,7 +4982,7 @@ nsBlockFrame::GetOverflowLines() const
if (!HasOverflowLines()) {
return nullptr;
}
- FrameLines* prop = Properties().Get(OverflowLinesProperty());
+ FrameLines* prop = GetProperty(OverflowLinesProperty());
NS_ASSERTION(prop && !prop->mLines.empty() &&
prop->mLines.front()->GetChildCount() == 0 ? prop->mFrames.IsEmpty() :
prop->mLines.front()->mFirstChild == prop->mFrames.FirstChild(),
@@ -4999,7 +4996,7 @@ nsBlockFrame::RemoveOverflowLines()
if (!HasOverflowLines()) {
return nullptr;
}
- FrameLines* prop = Properties().Remove(OverflowLinesProperty());
+ FrameLines* prop = RemoveProperty(OverflowLinesProperty());
NS_ASSERTION(prop && !prop->mLines.empty() &&
prop->mLines.front()->GetChildCount() == 0 ? prop->mFrames.IsEmpty() :
prop->mLines.front()->mFirstChild == prop->mFrames.FirstChild(),
@@ -5012,7 +5009,7 @@ void
nsBlockFrame::DestroyOverflowLines()
{
NS_ASSERTION(HasOverflowLines(), "huh?");
- FrameLines* prop = Properties().Remove(OverflowLinesProperty());
+ FrameLines* prop = RemoveProperty(OverflowLinesProperty());
NS_ASSERTION(prop && prop->mLines.empty(),
"value should always be stored but empty when destroying");
RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_LINES);
@@ -5032,10 +5029,9 @@ nsBlockFrame::SetOverflowLines(FrameLines* aOverflowLines)
NS_ASSERTION(!(GetStateBits() & NS_BLOCK_HAS_OVERFLOW_LINES),
"Overwriting existing overflow lines");
- FrameProperties props = Properties();
// Verify that we won't overwrite an existing overflow list
- NS_ASSERTION(!props.Get(OverflowLinesProperty()), "existing overflow list");
- props.Set(OverflowLinesProperty(), aOverflowLines);
+ NS_ASSERTION(!GetProperty(OverflowLinesProperty()), "existing overflow list");
+ SetProperty(OverflowLinesProperty(), aOverflowLines);
AddStateBits(NS_BLOCK_HAS_OVERFLOW_LINES);
}
@@ -5088,7 +5084,7 @@ nsBlockFrame::GetInsideBullet() const
return nullptr;
}
NS_ASSERTION(!HasOutsideBullet(), "invalid bullet state");
- nsBulletFrame* frame = Properties().Get(InsideBulletProperty());
+ nsBulletFrame* frame = GetProperty(InsideBulletProperty());
NS_ASSERTION(frame && frame->GetType() == nsGkAtoms::bulletFrame,
"bogus inside bullet frame");
return frame;
@@ -5109,8 +5105,7 @@ nsBlockFrame::GetOutsideBulletList() const
return nullptr;
}
NS_ASSERTION(!HasInsideBullet(), "invalid bullet state");
- nsFrameList* list =
- Properties().Get(OutsideBulletProperty());
+ nsFrameList* list = GetProperty(OutsideBulletProperty());
NS_ASSERTION(list && list->GetLength() == 1 &&
list->FirstChild()->GetType() == nsGkAtoms::bulletFrame,
"bogus outside bullet list");
@@ -5123,8 +5118,7 @@ nsBlockFrame::GetPushedFloats() const
if (!HasPushedFloats()) {
return nullptr;
}
- nsFrameList* result =
- Properties().Get(PushedFloatProperty());
+ nsFrameList* result = GetProperty(PushedFloatProperty());
NS_ASSERTION(result, "value should always be non-empty when state set");
return result;
}
@@ -5137,7 +5131,7 @@ nsBlockFrame::EnsurePushedFloats()
return result;
result = new (PresContext()->PresShell()) nsFrameList;
- Properties().Set(PushedFloatProperty(), result);
+ SetProperty(PushedFloatProperty(), result);
AddStateBits(NS_BLOCK_HAS_PUSHED_FLOATS);
return result;
@@ -5149,7 +5143,7 @@ nsBlockFrame::RemovePushedFloats()
if (!HasPushedFloats()) {
return nullptr;
}
- nsFrameList *result = Properties().Remove(PushedFloatProperty());
+ nsFrameList *result = RemoveProperty(PushedFloatProperty());
RemoveStateBits(NS_BLOCK_HAS_PUSHED_FLOATS);
NS_ASSERTION(result, "value should always be non-empty when state set");
return result;
@@ -5619,7 +5613,7 @@ nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
if (mLine != line_end) {
*aFoundValidLine = true;
if (mLine != cursor) {
- aFrame->Properties().Set(nsBlockFrame::LineCursorProperty(), mLine);
+ aFrame->SetProperty(nsBlockFrame::LineCursorProperty(), mLine);
}
return;
}
@@ -6769,7 +6763,7 @@ void nsBlockFrame::ClearLineCursor()
return;
}
- Properties().Delete(LineCursorProperty());
+ DeleteProperty(LineCursorProperty());
RemoveStateBits(NS_BLOCK_HAS_LINE_CURSOR);
}
@@ -6780,7 +6774,7 @@ void nsBlockFrame::SetupLineCursor()
return;
}
- Properties().Set(LineCursorProperty(), mLines.front());
+ SetProperty(LineCursorProperty(), mLines.front());
AddStateBits(NS_BLOCK_HAS_LINE_CURSOR);
}
@@ -6790,9 +6784,7 @@ nsLineBox* nsBlockFrame::GetFirstLineContaining(nscoord y)
return nullptr;
}
- FrameProperties props = Properties();
-
- nsLineBox* property = props.Get(LineCursorProperty());
+ nsLineBox* property = GetProperty(LineCursorProperty());
LineIterator cursor = mLines.begin(property);
nsRect cursorArea = cursor->GetVisualOverflowArea();
@@ -6808,7 +6800,7 @@ nsLineBox* nsBlockFrame::GetFirstLineContaining(nscoord y)
}
if (cursor.get() != property) {
- props.Set(LineCursorProperty(), cursor.get());
+ SetProperty(LineCursorProperty(), cursor.get());
}
return cursor.get();
@@ -7021,11 +7013,11 @@ nsBlockFrame::CreateBulletFrameForListItem(bool aCreateBulletList,
if (aListStylePositionInside) {
nsFrameList bulletList(bullet, bullet);
AddFrames(bulletList, nullptr);
- Properties().Set(InsideBulletProperty(), bullet);
+ SetProperty(InsideBulletProperty(), bullet);
AddStateBits(NS_BLOCK_FRAME_HAS_INSIDE_BULLET);
} else {
nsFrameList* bulletList = new (shell) nsFrameList(bullet, bullet);
- Properties().Set(OutsideBulletProperty(), bulletList);
+ SetProperty(OutsideBulletProperty(), bulletList);
AddStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
}
}