summaryrefslogtreecommitdiff
path: root/layout/generic/nsTextFrame.cpp
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2019-06-26 01:51:45 +0300
committerwin7-7 <win7-7@users.noreply.github.com>2019-06-26 01:51:45 +0300
commit00812e30dfa70f9b1a752cf0d09de00f6d401c85 (patch)
treee7eec9b55dd4e5825d3196f196c7f981be56e17a /layout/generic/nsTextFrame.cpp
parentd7359c38b197c221c43def1e24cb48d4aee51bba (diff)
downloaduxp-00812e30dfa70f9b1a752cf0d09de00f6d401c85.tar.gz
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/generic/nsTextFrame.cpp')
-rw-r--r--layout/generic/nsTextFrame.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
index 3288d3f2e4..0641c7439a 100644
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -2838,9 +2838,9 @@ nsTextFrame::EnsureTextRun(TextRunType aWhichTextRun,
return gfxSkipCharsIterator(gfxPlatform::
GetPlatform()->EmptySkipChars(), 0);
}
- TabWidthStore* tabWidths = Properties().Get(TabWidthProperty());
+ TabWidthStore* tabWidths = GetProperty(TabWidthProperty());
if (tabWidths && tabWidths->mValidForContentOffset != GetContentOffset()) {
- Properties().Delete(TabWidthProperty());
+ DeleteProperty(TabWidthProperty());
}
}
@@ -3478,7 +3478,7 @@ PropertyProvider::CalcTabWidths(Range aRange)
return;
}
if (!mReflowing) {
- mTabWidths = mFrame->Properties().Get(TabWidthProperty());
+ mTabWidths = mFrame->GetProperty(TabWidthProperty());
#ifdef DEBUG
// If we're not reflowing, we should have already computed the
// tab widths; check that they're available as far as the last
@@ -3524,7 +3524,7 @@ PropertyProvider::CalcTabWidths(Range aRange)
} else {
if (!mTabWidths) {
mTabWidths = new TabWidthStore(mFrame->GetContentOffset());
- mFrame->Properties().Set(TabWidthProperty(), mTabWidths);
+ mFrame->SetProperty(TabWidthProperty(), mTabWidths);
}
double nextTab = AdvanceToNextTab(mOffsetFromBlockOriginForTabs,
mFrame, mTextRun, &tabWidth);
@@ -3543,7 +3543,7 @@ PropertyProvider::CalcTabWidths(Range aRange)
if (!mTabWidths) {
// Delete any stale property that may be left on the frame
- mFrame->Properties().Delete(TabWidthProperty());
+ mFrame->DeleteProperty(TabWidthProperty());
mTabWidthsAnalyzedLimit = std::max(mTabWidthsAnalyzedLimit,
aRange.end - startOffset);
}
@@ -4249,7 +4249,7 @@ nsTextFrame::ClearFrameOffsetCache()
// just destroys the frames in order, which means that the primary frame is already
// dead if we're a continuing text frame, in which case, all of its properties are
// gone, and we don't need to worry about deleting this property here.
- primaryFrame->Properties().Delete(OffsetToFrameProperty());
+ primaryFrame->DeleteProperty(OffsetToFrameProperty());
}
RemoveStateBits(TEXT_IN_OFFSET_CACHE);
}
@@ -4358,7 +4358,7 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
if (aPrevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) {
FrameBidiData bidiData = aPrevInFlow->GetBidiData();
bidiData.precedingControl = kBidiLevelNone;
- Properties().Set(BidiDataProperty(), bidiData);
+ SetProperty(BidiDataProperty(), bidiData);
if (nextContinuation) {
SetNextContinuation(nextContinuation);
@@ -4622,7 +4622,7 @@ nsTextFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemK
gfxTextRun*
nsTextFrame::GetUninflatedTextRun()
{
- return Properties().Get(UninflatedTextRunProperty());
+ return GetProperty(UninflatedTextRunProperty());
}
void
@@ -4648,7 +4648,7 @@ nsTextFrame::SetTextRun(gfxTextRun* aTextRun, TextRunType aWhichTextRun,
// Setting the property will not automatically increment the textrun's
// reference count, so we need to do it here.
aTextRun->AddRef();
- Properties().Set(UninflatedTextRunProperty(), aTextRun);
+ SetProperty(UninflatedTextRunProperty(), aTextRun);
return;
}
// fall through to setting mTextRun
@@ -4668,10 +4668,9 @@ nsTextFrame::RemoveTextRun(gfxTextRun* aTextRun)
mTextRun = nullptr;
return true;
}
- FrameProperties props = Properties();
if ((GetStateBits() & TEXT_HAS_FONT_INFLATION) &&
- props.Get(UninflatedTextRunProperty()) == aTextRun) {
- props.Delete(UninflatedTextRunProperty());
+ GetProperty(UninflatedTextRunProperty()) == aTextRun) {
+ DeleteProperty(UninflatedTextRunProperty());
return true;
}
return false;
@@ -4689,7 +4688,7 @@ nsTextFrame::ClearTextRun(nsTextFrame* aStartContinuation,
DebugOnly<bool> checkmTextrun = textRun == mTextRun;
UnhookTextRunFromFrames(textRun, aStartContinuation);
MOZ_ASSERT(checkmTextrun ? !mTextRun
- : !Properties().Get(UninflatedTextRunProperty()));
+ : !GetProperty(UninflatedTextRunProperty()));
}
void
@@ -4699,7 +4698,7 @@ nsTextFrame::DisconnectTextRuns()
"Textrun mentions this frame in its user data so we can't just disconnect");
mTextRun = nullptr;
if ((GetStateBits() & TEXT_HAS_FONT_INFLATION)) {
- Properties().Delete(UninflatedTextRunProperty());
+ DeleteProperty(UninflatedTextRunProperty());
}
}
@@ -4929,7 +4928,7 @@ NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(TextCombineScaleFactorProperty, float)
static float
GetTextCombineScaleFactor(nsTextFrame* aFrame)
{
- float factor = aFrame->Properties().Get(TextCombineScaleFactorProperty());
+ float factor = aFrame->GetProperty(TextCombineScaleFactorProperty());
return factor ? factor : 1.0f;
}
@@ -5105,7 +5104,7 @@ static nscoord
LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
{
bool offsetFound;
- nscoord offset = aChildFrame->Properties().Get(
+ nscoord offset = aChildFrame->GetProperty(
nsIFrame::LineBaselineOffset(), &offsetFound);
if (!offsetFound) {
@@ -5118,11 +5117,11 @@ LazyGetLineBaselineOffset(nsIFrame* aChildFrame, nsBlockFrame* aBlockFrame)
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
offset = lineBaseline - lineFrame->GetNormalPosition().y;
- lineFrame->Properties().Set(nsIFrame::LineBaselineOffset(), offset);
+ lineFrame->SetProperty(nsIFrame::LineBaselineOffset(), offset);
}
}
}
- return aChildFrame->Properties().Get(
+ return aChildFrame->GetProperty(
nsIFrame::LineBaselineOffset(), &offsetFound);
} else {
return offset;
@@ -5367,7 +5366,7 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
{
const nsStyleText* styleText = StyleText();
if (!styleText->HasTextEmphasis()) {
- Properties().Delete(EmphasisMarkProperty());
+ DeleteProperty(EmphasisMarkProperty());
return nsRect();
}
@@ -5419,7 +5418,7 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
overflowRect.BStart(aWM) += gap * (side == eLogicalSideBStart ? -1 : 1);
}
- Properties().Set(EmphasisMarkProperty(), info);
+ SetProperty(EmphasisMarkProperty(), info);
return overflowRect.GetPhysicalRect(aWM, frameSize.GetPhysicalSize(aWM));
}
@@ -6432,7 +6431,7 @@ nsTextFrame::DrawEmphasisMarks(gfxContext* aContext, WritingMode aWM,
const nscolor* aDecorationOverrideColor,
PropertyProvider* aProvider)
{
- const EmphasisMarkInfo* info = Properties().Get(EmphasisMarkProperty());
+ const EmphasisMarkInfo* info = GetProperty(EmphasisMarkProperty());
if (!info) {
return;
}
@@ -7584,7 +7583,7 @@ nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
int32_t offset = mContentOffset;
// Try to look up the offset to frame property
- nsTextFrame* cachedFrame = Properties().Get(OffsetToFrameProperty());
+ nsTextFrame* cachedFrame = GetProperty(OffsetToFrameProperty());
if (cachedFrame) {
f = cachedFrame;
@@ -7632,7 +7631,7 @@ nsTextFrame::GetChildFrameContainingOffset(int32_t aContentOffset,
*aOutFrame = f;
// cache the frame we found
- Properties().Set(OffsetToFrameProperty(), f);
+ SetProperty(OffsetToFrameProperty(), f);
f->AddStateBits(TEXT_IN_OFFSET_CACHE);
return NS_OK;
@@ -8169,7 +8168,7 @@ nsTextFrame::GetFontSizeInflation() const
if (!HasFontSizeInflation()) {
return 1.0f;
}
- return Properties().Get(FontSizeInflationProperty());
+ return GetProperty(FontSizeInflationProperty());
}
void
@@ -8178,13 +8177,13 @@ nsTextFrame::SetFontSizeInflation(float aInflation)
if (aInflation == 1.0f) {
if (HasFontSizeInflation()) {
RemoveStateBits(TEXT_HAS_FONT_INFLATION);
- Properties().Delete(FontSizeInflationProperty());
+ DeleteProperty(FontSizeInflationProperty());
}
return;
}
AddStateBits(TEXT_HAS_FONT_INFLATION);
- Properties().Set(FontSizeInflationProperty(), aInflation);
+ SetProperty(FontSizeInflationProperty(), aInflation);
}
/* virtual */
@@ -9319,9 +9318,9 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
gfxFloat em = fm->EmHeight();
// Compress the characters in horizontal axis if necessary.
if (width <= em) {
- Properties().Remove(TextCombineScaleFactorProperty());
+ RemoveProperty(TextCombineScaleFactorProperty());
} else {
- Properties().Set(TextCombineScaleFactorProperty(), em / width);
+ SetProperty(TextCombineScaleFactorProperty(), em / width);
finalSize.ISize(wm) = em;
}
// Make the characters be in an 1em square.
@@ -10049,13 +10048,13 @@ nsTextFrame::AssignJustificationGaps(
static_assert(sizeof(aAssign) == 1,
"The encoding might be broken if JustificationAssignment "
"is larger than 1 byte");
- Properties().Set(JustificationAssignmentProperty(), encoded);
+ SetProperty(JustificationAssignmentProperty(), encoded);
}
mozilla::JustificationAssignment
nsTextFrame::GetJustificationAssignment() const
{
- int32_t encoded = Properties().Get(JustificationAssignmentProperty());
+ int32_t encoded = GetProperty(JustificationAssignmentProperty());
mozilla::JustificationAssignment result;
result.mGapsAtStart = encoded >> 8;
result.mGapsAtEnd = encoded & 0xFF;