зеркало из https://github.com/mozilla/gecko-dev.git
Bug 983465. Disable collapsing-text frame construction optimization on a per-document basis. r=bz
--HG-- extra : rebase_source : fc2059ac826e001660fb7233d775f8a046467f6b
This commit is contained in:
Родитель
579e0bc4c5
Коммит
458a675e16
|
@ -51,10 +51,6 @@ enum {
|
||||||
// bit is set, and if so it indicates whether we're only whitespace or
|
// bit is set, and if so it indicates whether we're only whitespace or
|
||||||
// not.
|
// not.
|
||||||
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
|
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
|
||||||
|
|
||||||
// This bit is set to indicate that we must create frames for this text node
|
|
||||||
// even if it's only whitespace next to a block boundary.
|
|
||||||
NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE = DATA_NODE_FLAG_BIT(4)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Make sure we have enough space for those bits
|
// Make sure we have enough space for those bits
|
||||||
|
|
|
@ -2751,8 +2751,10 @@ GetTextFrameForContent(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
|
nsIPresShell* presShell = aContent->OwnerDoc()->GetShell();
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
nsIFrame* frame = presShell->FrameConstructor()->EnsureFrameForTextNode(
|
presShell->FrameConstructor()->EnsureFrameForTextNode(
|
||||||
static_cast<nsGenericDOMDataNode*>(aContent));
|
static_cast<nsGenericDOMDataNode*>(aContent));
|
||||||
|
aContent->OwnerDoc()->FlushPendingNotifications(Flush_Layout);
|
||||||
|
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||||
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
|
if (frame && frame->GetType() == nsGkAtoms::textFrame) {
|
||||||
return static_cast<nsTextFrame*>(frame);
|
return static_cast<nsTextFrame*>(frame);
|
||||||
}
|
}
|
||||||
|
@ -2804,7 +2806,7 @@ static void CollectClientRects(nsLayoutUtils::RectCallback* aCollector,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aStartParent->GetCurrentDoc()->FlushPendingNotifications(Flush_Layout);
|
aStartParent->OwnerDoc()->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Recheck whether we're still in the document
|
// Recheck whether we're still in the document
|
||||||
if (!aStartParent->IsInDoc()) {
|
if (!aStartParent->IsInDoc()) {
|
||||||
|
|
|
@ -1425,6 +1425,7 @@ nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument *aDocument,
|
||||||
, mCountersDirty(false)
|
, mCountersDirty(false)
|
||||||
, mIsDestroyingFrameTree(false)
|
, mIsDestroyingFrameTree(false)
|
||||||
, mHasRootAbsPosContainingBlock(false)
|
, mHasRootAbsPosContainingBlock(false)
|
||||||
|
, mAlwaysCreateFramesForIgnorableWhitespace(false)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static bool gFirstTime = true;
|
static bool gFirstTime = true;
|
||||||
|
@ -5552,16 +5553,13 @@ nsCSSFrameConstructor::ConstructFramesFromItem(nsFrameConstructorState& aState,
|
||||||
// due to dynamic changes.
|
// due to dynamic changes.
|
||||||
// We don't do it for SVG text, since we might need to position and
|
// We don't do it for SVG text, since we might need to position and
|
||||||
// measure the white space glyphs due to x/y/dx/dy attributes.
|
// measure the white space glyphs due to x/y/dx/dy attributes.
|
||||||
// We check that NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE is not set on
|
|
||||||
// the node. This lets us disable this optimization for specific nodes
|
|
||||||
// (e.g. nodes whose geometry is being queried via DOM APIs).
|
|
||||||
if (AtLineBoundary(aIter) &&
|
if (AtLineBoundary(aIter) &&
|
||||||
!styleContext->StyleText()->WhiteSpaceOrNewlineIsSignificant() &&
|
!styleContext->StyleText()->WhiteSpaceOrNewlineIsSignificant() &&
|
||||||
aIter.List()->ParentHasNoXBLChildren() &&
|
aIter.List()->ParentHasNoXBLChildren() &&
|
||||||
!(aState.mAdditionalStateBits & NS_FRAME_GENERATED_CONTENT) &&
|
!(aState.mAdditionalStateBits & NS_FRAME_GENERATED_CONTENT) &&
|
||||||
(item.mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) &&
|
(item.mFCData->mBits & FCDATA_IS_LINE_PARTICIPANT) &&
|
||||||
!(item.mFCData->mBits & FCDATA_IS_SVG_TEXT) &&
|
!(item.mFCData->mBits & FCDATA_IS_SVG_TEXT) &&
|
||||||
!item.mContent->HasFlag(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE) &&
|
!mAlwaysCreateFramesForIgnorableWhitespace &&
|
||||||
item.IsWhitespace(aState))
|
item.IsWhitespace(aState))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -7784,13 +7782,15 @@ nsIFrame*
|
||||||
nsCSSFrameConstructor::EnsureFrameForTextNode(nsGenericDOMDataNode* aContent)
|
nsCSSFrameConstructor::EnsureFrameForTextNode(nsGenericDOMDataNode* aContent)
|
||||||
{
|
{
|
||||||
if (aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) &&
|
if (aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) &&
|
||||||
!aContent->HasFlag(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE)) {
|
!mAlwaysCreateFramesForIgnorableWhitespace) {
|
||||||
// Text frame may have been suppressed. Disable suppression and signal
|
// Text frame may have been suppressed. Disable suppression and signal
|
||||||
// that a flush should be performed.
|
// that a flush should be performed. We do this on a document-wide
|
||||||
aContent->SetFlags(NS_CREATE_FRAME_FOR_IGNORABLE_WHITESPACE);
|
// basis so that pages that repeatedly query metrics for
|
||||||
|
// collapsed-whitespace text nodes don't trigger pathological behavior.
|
||||||
|
mAlwaysCreateFramesForIgnorableWhitespace = true;
|
||||||
nsAutoScriptBlocker blocker;
|
nsAutoScriptBlocker blocker;
|
||||||
BeginUpdate();
|
BeginUpdate();
|
||||||
RecreateFramesForContent(aContent, false);
|
ReconstructDocElementHierarchy();
|
||||||
EndUpdate();
|
EndUpdate();
|
||||||
}
|
}
|
||||||
return aContent->GetPrimaryFrame();
|
return aContent->GetPrimaryFrame();
|
||||||
|
|
|
@ -1801,6 +1801,7 @@ private:
|
||||||
bool mIsDestroyingFrameTree : 1;
|
bool mIsDestroyingFrameTree : 1;
|
||||||
// This is true if mDocElementContainingBlock supports absolute positioning
|
// This is true if mDocElementContainingBlock supports absolute positioning
|
||||||
bool mHasRootAbsPosContainingBlock : 1;
|
bool mHasRootAbsPosContainingBlock : 1;
|
||||||
|
bool mAlwaysCreateFramesForIgnorableWhitespace : 1;
|
||||||
|
|
||||||
nsCOMPtr<nsILayoutHistoryState> mTempFrameTreeState;
|
nsCOMPtr<nsILayoutHistoryState> mTempFrameTreeState;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче