Bug 410857 part 3 - Cache the PresContext instead of fetching it for every paragraph. r=jfkthame

This commit is contained in:
Mats Palmgren
2017-02-20 17:43:08 +01:00
parent 6675583de4
commit d69666eb3f

View File

@@ -133,19 +133,22 @@ struct MOZ_STACK_CLASS BidiParagraphData
AutoTArray<nsIFrame*, 16> mLogicalFrames;
AutoTArray<nsLineBox*, 16> mLinePerFrame;
nsDataHashtable<nsISupportsHashKey, int32_t> mContentToFrameIndex;
// Cached presentation context for the frames we're processing.
nsPresContext* mPresContext;
bool mIsVisual;
nsBidiLevel mParaLevel;
nsIContent* mPrevContent;
nsBidi mBidiEngine;
nsIFrame* mPrevFrame;
void Init(nsBlockFrame *aBlockFrame)
void Init(nsBlockFrame* aBlockFrame)
{
mPrevContent = nullptr;
mParaLevel = nsBidiPresUtils::BidiLevelFromStyle(aBlockFrame->StyleContext());
mIsVisual = aBlockFrame->PresContext()->IsVisualMode();
mPresContext = aBlockFrame->PresContext();
mIsVisual = mPresContext->IsVisualMode();
if (mIsVisual) {
/**
* Drill up in content to detect whether this is an element that needs to
@@ -713,8 +716,6 @@ nsresult
nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
BidiParagraphData* aBpd)
{
nsPresContext *presContext = aBlockFrame->PresContext();
if (aBpd->BufferLength() < 1) {
return NS_OK;
}
@@ -742,7 +743,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame,
nsIContent* content = nullptr;
int32_t contentTextLength = 0;
FramePropertyTable *propTable = presContext->PropertyTable();
FramePropertyTable* propTable = aBpd->mPresContext->PropertyTable();
nsLineBox* currentLine = nullptr;
#ifdef DEBUG