applied bug1385395_pm.diff

This commit is contained in:
2018-07-13 20:51:25 +08:00
parent ced7c7e683
commit f9e5710b24
4 changed files with 46 additions and 13 deletions
+9 -1
View File
@@ -51,10 +51,18 @@ enum {
// bit is set, and if so it indicates whether we're only whitespace or
// not.
NS_TEXT_IS_ONLY_WHITESPACE = DATA_NODE_FLAG_BIT(3),
// This bit is set if there is a NewlineProperty attached to the node
// (used by nsTextFrame).
NS_HAS_NEWLINE_PROPERTY = DATA_NODE_FLAG_BIT(4),
// This bit is set if there is a FlowLengthProperty attached to the node
// (used by nsTextFrame).
NS_HAS_FLOWLENGTH_PROPERTY = DATA_NODE_FLAG_BIT(5),
};
// Make sure we have enough space for those bits
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 4);
ASSERT_NODE_FLAGS_SPACE(NODE_TYPE_SPECIFIC_BITS_OFFSET + 6);
#undef DATA_NODE_FLAG_BIT
+1
View File
@@ -360,6 +360,7 @@ include('/ipc/chromium/chromium-config.mozbuild')
LOCAL_INCLUDES += [
'/docshell/base', # for nsDocShell.h
'/dom/base', # for nsDocument.h
]
FINAL_LIBRARY = 'xul'
+27 -10
View File
@@ -59,7 +59,6 @@
#include "nsContentUtils.h"
#include "nsLineBreaker.h"
#include "nsIWordBreaker.h"
#include "nsGenericDOMDataNode.h"
#include "nsIFrameInlines.h"
#include <algorithm>
@@ -624,7 +623,9 @@ int32_t nsTextFrame::GetInFlowContentLength() {
}
FlowLengthProperty* flowLength =
static_cast<FlowLengthProperty*>(mContent->GetProperty(nsGkAtoms::flowlength));
mContent->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)
? static_cast<FlowLengthProperty*>(mContent->GetProperty(nsGkAtoms::flowlength))
: nullptr;
/**
* This frame must start inside the cached flow. If the flow starts at
@@ -652,6 +653,7 @@ int32_t nsTextFrame::GetInFlowContentLength() {
delete flowLength;
flowLength = nullptr;
}
mContent->SetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
if (flowLength) {
flowLength->mStartOffset = mContentOffset;
@@ -3959,9 +3961,13 @@ nsTextFrame::Init(nsIContent* aContent,
// Remove any NewlineOffsetProperty or InFlowContentLengthProperty since they
// might be invalid if the content was modified while there was no frame
aContent->DeleteProperty(nsGkAtoms::newline);
if (PresContext()->BidiEnabled()) {
if (aContent->HasFlag(NS_HAS_NEWLINE_PROPERTY)) {
aContent->DeleteProperty(nsGkAtoms::newline);
aContent->UnsetFlags(NS_HAS_NEWLINE_PROPERTY);
}
if (aContent->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
aContent->DeleteProperty(nsGkAtoms::flowlength);
aContent->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
// Since our content has a frame now, this flag is no longer needed.
@@ -4458,11 +4464,15 @@ nsTextFrame::DisconnectTextRuns()
nsresult
nsTextFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
{
mContent->DeleteProperty(nsGkAtoms::newline);
if (PresContext()->BidiEnabled()) {
mContent->DeleteProperty(nsGkAtoms::flowlength);
if (mContent->HasFlag(NS_HAS_NEWLINE_PROPERTY)) {
mContent->DeleteProperty(nsGkAtoms::newline);
mContent->UnsetFlags(NS_HAS_NEWLINE_PROPERTY);
}
if (mContent->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
mContent->DeleteProperty(nsGkAtoms::flowlength);
mContent->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
// Find the first frame whose text has changed. Frames that are entirely
// before the text change are completely unaffected.
nsTextFrame* next;
@@ -8168,7 +8178,9 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
NewlineProperty* cachedNewlineOffset = nullptr;
if (textStyle->NewlineIsSignificant()) {
cachedNewlineOffset =
static_cast<NewlineProperty*>(mContent->GetProperty(nsGkAtoms::newline));
mContent->HasFlag(NS_HAS_NEWLINE_PROPERTY)
? static_cast<NewlineProperty*>(mContent->GetProperty(nsGkAtoms::newline))
: nullptr;
if (cachedNewlineOffset && cachedNewlineOffset->mStartOffset <= offset &&
(cachedNewlineOffset->mNewlineOffset == -1 ||
cachedNewlineOffset->mNewlineOffset >= offset)) {
@@ -8620,6 +8632,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
delete cachedNewlineOffset;
cachedNewlineOffset = nullptr;
}
mContent->SetFlags(NS_HAS_NEWLINE_PROPERTY);
}
if (cachedNewlineOffset) {
cachedNewlineOffset->mStartOffset = offset;
@@ -8627,6 +8640,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
}
} else if (cachedNewlineOffset) {
mContent->DeleteProperty(nsGkAtoms::newline);
mContent->UnsetFlags(NS_HAS_NEWLINE_PROPERTY);
}
// Compute space and letter counts for justification, if required
@@ -9079,7 +9093,10 @@ void
nsTextFrame::AdjustOffsetsForBidi(int32_t aStart, int32_t aEnd)
{
AddStateBits(NS_FRAME_IS_BIDI);
mContent->DeleteProperty(nsGkAtoms::flowlength);
if (mContent->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
mContent->DeleteProperty(nsGkAtoms::flowlength);
mContent->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
/*
* After Bidi resolution we may need to reassign text runs.
+9 -2
View File
@@ -9,6 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/gfx/2D.h"
#include "nsFrame.h"
#include "nsGenericDOMDataNode.h"
#include "nsSplittableFrame.h"
#include "nsLineBox.h"
#include "gfxSkipChars.h"
@@ -89,7 +90,10 @@ public:
aNextContinuation->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
// Setting a non-fluid continuation might affect our flow length (they're
// quite rare so we assume it always does) so we delete our cached value:
GetContent()->DeleteProperty(nsGkAtoms::flowlength);
if (GetContent()->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
GetContent()->DeleteProperty(nsGkAtoms::flowlength);
GetContent()->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
}
virtual nsIFrame* GetNextInFlowVirtual() const override { return GetNextInFlow(); }
nsIFrame* GetNextInFlow() const {
@@ -106,7 +110,10 @@ public:
!mNextContinuation->HasAnyStateBits(NS_FRAME_IS_FLUID_CONTINUATION)) {
// Changing from non-fluid to fluid continuation might affect our flow
// length, so we delete our cached value:
GetContent()->DeleteProperty(nsGkAtoms::flowlength);
if (GetContent()->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
GetContent()->DeleteProperty(nsGkAtoms::flowlength);
GetContent()->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
}
}
if (aNextInFlow) {
aNextInFlow->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);