Bug 205202 part 4 - [css-lists][css-pseudo] Rename various uses of bullet with marker to avoid any misleading association with nsBulletFrame (idempotent patch). r=emilio

This commit is contained in:
Mats Palmgren 2019-03-24 23:13:53 +01:00
Родитель 4b5f164752
Коммит be049c79d6
11 изменённых файлов: 194 добавлений и 201 удалений

Просмотреть файл

@ -39,7 +39,7 @@ HTMLLIAccessible::HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc)
mType = eHTMLLiType;
nsBlockFrame* blockFrame = do_QueryFrame(GetFrame());
if (blockFrame && blockFrame->HasBullet()) {
if (blockFrame && blockFrame->HasMarker()) {
mBullet = new HTMLListBulletAccessible(mContent, mDoc);
Document()->BindToDocument(mBullet, nullptr);
AppendChild(mBullet);
@ -120,7 +120,7 @@ HTMLListBulletAccessible::HTMLListBulletAccessible(nsIContent* aContent,
nsIFrame* HTMLListBulletAccessible::GetFrame() const {
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
return blockFrame ? blockFrame->GetBullet() : nullptr;
return blockFrame ? blockFrame->GetMarker() : nullptr;
}
ENameValueFlag HTMLListBulletAccessible::Name(nsString& aName) const {
@ -129,7 +129,7 @@ ENameValueFlag HTMLListBulletAccessible::Name(nsString& aName) const {
// Native anonymous content, ARIA can't be used. Get list bullet text.
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
if (blockFrame) {
blockFrame->GetSpokenBulletText(aName);
blockFrame->GetSpokenMarkerText(aName);
}
return eNameOK;
@ -146,7 +146,7 @@ void HTMLListBulletAccessible::AppendTextTo(nsAString& aText,
uint32_t aLength) {
nsAutoString bulletText;
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
if (blockFrame) blockFrame->GetSpokenBulletText(bulletText);
if (blockFrame) blockFrame->GetSpokenMarkerText(bulletText);
aText.Append(Substring(bulletText, aStartOffset, aLength));
}
@ -156,5 +156,5 @@ void HTMLListBulletAccessible::AppendTextTo(nsAString& aText,
bool HTMLListBulletAccessible::IsInside() const {
nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
return blockFrame ? blockFrame->HasInsideBullet() : false;
return blockFrame ? blockFrame->HasInsideMarker() : false;
}

Просмотреть файл

@ -9818,7 +9818,7 @@ void nsCSSFrameConstructor::ProcessChildren(
}
}
listItem->SetMarkerFrameForListItem(childFrame);
MOZ_ASSERT(listItem->HasAnyStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET) == isOutsideMarker);
MOZ_ASSERT(listItem->HasAnyStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER) == isOutsideMarker);
break;
}
}

Просмотреть файл

@ -131,7 +131,7 @@ static nscoord FontSizeInflationListMarginAdjustment(const nsIFrame* aFrame) {
// We only want to adjust the margins if we're dealing with an ordered list.
const nsBlockFrame* blockFrame = static_cast<const nsBlockFrame*>(aFrame);
if (!blockFrame->HasBullet()) {
if (!blockFrame->HasMarker()) {
return 0;
}

Просмотреть файл

@ -275,8 +275,8 @@ NS_DECLARE_FRAME_PROPERTY_WITH_DTOR_NEVER_CALLED(OverflowLinesProperty,
nsBlockFrame::FrameLines)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OverflowOutOfFlowsProperty)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(PushedFloatProperty)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OutsideBulletProperty)
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(InsideBulletProperty, nsIFrame)
NS_DECLARE_FRAME_PROPERTY_FRAMELIST(OutsideMarkerProperty)
NS_DECLARE_FRAME_PROPERTY_WITHOUT_DTOR(InsideMarkerProperty, nsIFrame)
NS_DECLARE_FRAME_PROPERTY_SMALL_VALUE(BlockEndEdgeOfChildrenProperty, nscoord)
//----------------------------------------------------------------------
@ -346,10 +346,10 @@ void nsBlockFrame::DestroyFrom(nsIFrame* aDestructRoot,
RemoveStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
}
if (HasOutsideBullet()) {
if (HasOutsideMarker()) {
SafelyDestroyFrameListProp(aDestructRoot, aPostDestroyData, shell,
OutsideBulletProperty());
RemoveStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
OutsideMarkerProperty());
RemoveStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
}
nsContainerFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
@ -546,7 +546,7 @@ const nsFrameList& nsBlockFrame::GetChildList(ChildListID aListID) const {
return list ? *list : nsFrameList::EmptyList();
}
case kBulletList: {
const nsFrameList* list = GetOutsideBulletList();
const nsFrameList* list = GetOutsideMarkerList();
return list ? *list : nsFrameList::EmptyList();
}
default:
@ -565,7 +565,7 @@ void nsBlockFrame::GetChildLists(nsTArray<ChildList>* aLists) const {
list->AppendIfNonempty(aLists, kOverflowOutOfFlowList);
}
mFloats.AppendIfNonempty(aLists, kFloatList);
list = GetOutsideBulletList();
list = GetOutsideMarkerList();
if (list) {
list->AppendIfNonempty(aLists, kBulletList);
}
@ -1249,16 +1249,16 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
// participates in the height calculation of the list-item box's
// first line box.
//
// There are exactly two places a bullet can be placed: near the
// There are exactly two places a ::marker can be placed: near the
// first or second line. It's only placed on the second line in a
// rare case: an empty first line followed by a second line that
// contains a block (example: <LI>\n<P>... ). This is where
// the second case can happen.
if (HasOutsideBullet() && !mLines.empty() &&
if (HasOutsideMarker() && !mLines.empty() &&
(mLines.front()->IsBlock() ||
(0 == mLines.front()->BSize() && mLines.front() != mLines.back() &&
mLines.begin().next()->IsBlock()))) {
// Reflow the bullet
// Reflow the ::marker's frame.
ReflowOutput reflowOutput(aReflowInput);
// XXX Use the entire line when we fix bug 25888.
nsLayoutUtils::LinePosition position;
@ -1268,24 +1268,24 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
nscoord lineBStart =
havePosition ? position.mBStart
: reflowInput->ComputedLogicalBorderPadding().BStart(wm);
nsIFrame* bullet = GetOutsideBullet();
ReflowBullet(bullet, state, reflowOutput, lineBStart);
NS_ASSERTION(!BulletIsEmpty() || reflowOutput.BSize(wm) == 0,
"empty bullet took up space");
nsIFrame* marker = GetOutsideMarker();
ReflowOutsideMarker(marker, state, reflowOutput, lineBStart);
NS_ASSERTION(!MarkerIsEmpty() || reflowOutput.BSize(wm) == 0,
"empty ::marker frame took up space");
if (havePosition && !BulletIsEmpty()) {
// We have some lines to align the bullet with.
if (havePosition && !MarkerIsEmpty()) {
// We have some lines to align the ::marker with.
// Doing the alignment using the baseline will also cater for
// bullets that are placed next to a child block (bug 92896)
// ::markers that are placed next to a child block (bug 92896)
// Tall bullets won't look particularly nice here...
// Tall ::markers won't look particularly nice here...
LogicalRect bbox =
bullet->GetLogicalRect(wm, reflowOutput.PhysicalSize());
marker->GetLogicalRect(wm, reflowOutput.PhysicalSize());
bbox.BStart(wm) = position.mBaseline - reflowOutput.BlockStartAscent();
bullet->SetRect(wm, bbox, reflowOutput.PhysicalSize());
marker->SetRect(wm, bbox, reflowOutput.PhysicalSize());
}
// Otherwise just leave the bullet where it is, up against our
// Otherwise just leave the ::marker where it is, up against our
// block-start padding.
}
@ -1319,10 +1319,10 @@ void nsBlockFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
nsPoint physicalDelta(deltaX, 0);
f->MovePositionBy(physicalDelta);
}
nsFrameList* bulletList = GetOutsideBulletList();
if (bulletList) {
nsFrameList* markerList = GetOutsideMarkerList();
if (markerList) {
nsPoint physicalDelta(deltaX, 0);
for (nsIFrame* f : *bulletList) {
for (nsIFrame* f : *markerList) {
f->MovePositionBy(physicalDelta);
}
}
@ -1766,14 +1766,13 @@ void nsBlockFrame::ComputeOverflowAreas(const nsRect& aBounds,
}
}
// Factor an outside bullet in; normally the bullet will be factored into
// the line-box's overflow areas. However, if the line is a block
// Factor an outside ::marker in; normally the ::marker will be factored
// into the line-box's overflow areas. However, if the line is a block
// line then it won't; if there are no lines, it won't. So just
// factor it in anyway (it can't hurt if it was already done).
// XXXldb Can we just fix GetOverflowArea instead?
nsIFrame* outsideBullet = GetOutsideBullet();
if (outsideBullet) {
areas.UnionAllWith(outsideBullet->GetRect());
if (nsIFrame* outsideMarker = GetOutsideMarker()) {
areas.UnionAllWith(outsideMarker->GetRect());
}
ConsiderBlockEndEdgeOfChildren(GetWritingMode(), aBEndEdgeOfChildren, areas,
@ -2661,23 +2660,23 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState) {
}
// Handle an odd-ball case: a list-item with no lines
if (HasOutsideBullet() && mLines.empty()) {
if (HasOutsideMarker() && mLines.empty()) {
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* bullet = GetOutsideBullet();
nsIFrame* marker = GetOutsideMarker();
WritingMode wm = aState.mReflowInput.GetWritingMode();
ReflowBullet(bullet, aState, metrics,
aState.mReflowInput.ComputedPhysicalBorderPadding().top);
NS_ASSERTION(!BulletIsEmpty() || metrics.BSize(wm) == 0,
"empty bullet took up space");
ReflowOutsideMarker(marker, aState, metrics,
aState.mReflowInput.ComputedPhysicalBorderPadding().top);
NS_ASSERTION(!MarkerIsEmpty() || metrics.BSize(wm) == 0,
"empty ::marker frame took up space");
if (!BulletIsEmpty()) {
if (!MarkerIsEmpty()) {
// There are no lines so we have to fake up some y motion so that
// we end up with *some* height.
if (metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
nscoord ascent;
WritingMode wm = aState.mReflowInput.GetWritingMode();
if (nsLayoutUtils::GetFirstLineBaseline(wm, bullet, &ascent)) {
if (nsLayoutUtils::GetFirstLineBaseline(wm, marker, &ascent)) {
metrics.SetBlockStartAscent(ascent);
} else {
metrics.SetBlockStartAscent(metrics.BSize(wm));
@ -2697,7 +2696,7 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState) {
nscoord offset = minAscent - metrics.BlockStartAscent();
if (offset > 0) {
bullet->SetRect(bullet->GetRect() + nsPoint(0, offset));
marker->SetRect(marker->GetRect() + nsPoint(0, offset));
}
}
}
@ -3024,7 +3023,7 @@ bool nsBlockFrame::IsSelfEmpty() {
return false;
}
if (HasOutsideBullet() && !BulletIsEmpty()) {
if (HasOutsideMarker() && !MarkerIsEmpty()) {
return false;
}
@ -4363,23 +4362,23 @@ bool nsBlockFrame::PlaceLine(BlockReflowInput& aState,
// participates in the height calculation of the list-item box's
// first line box.
//
// There are exactly two places a bullet can be placed: near the
// There are exactly two places a ::marker can be placed: near the
// first or second line. It's only placed on the second line in a
// rare case: when the first line is empty.
WritingMode wm = aState.mReflowInput.GetWritingMode();
bool addedBullet = false;
if (HasOutsideBullet() &&
bool addedMarker = false;
if (HasOutsideMarker() &&
((aLine == mLines.front() &&
(!aLineLayout.IsZeroBSize() || (aLine == mLines.back()))) ||
(mLines.front() != mLines.back() && 0 == mLines.front()->BSize() &&
aLine == mLines.begin().next()))) {
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* bullet = GetOutsideBullet();
ReflowBullet(bullet, aState, metrics, aState.mBCoord);
NS_ASSERTION(!BulletIsEmpty() || metrics.BSize(wm) == 0,
"empty bullet took up space");
aLineLayout.AddBulletFrame(bullet, metrics);
addedBullet = true;
nsIFrame* marker = GetOutsideMarker();
ReflowOutsideMarker(marker, aState, metrics, aState.mBCoord);
NS_ASSERTION(!MarkerIsEmpty() || metrics.BSize(wm) == 0,
"empty ::marker frame took up space");
aLineLayout.AddMarkerFrame(marker, metrics);
addedMarker = true;
}
aLineLayout.VerticalAlignLine();
@ -4490,8 +4489,8 @@ bool nsBlockFrame::PlaceLine(BlockReflowInput& aState,
nsOverflowAreas overflowAreas;
aLineLayout.RelativePositionFrames(overflowAreas);
aLine->SetOverflowAreas(overflowAreas);
if (addedBullet) {
aLineLayout.RemoveBulletFrame(GetOutsideBullet());
if (addedMarker) {
aLineLayout.RemoveMarkerFrame(GetOutsideMarker());
}
// Inline lines do not have margins themselves; however they are
@ -4954,28 +4953,28 @@ void nsBlockFrame::SetOverflowOutOfFlows(const nsFrameList& aList,
}
}
nsIFrame* nsBlockFrame::GetInsideBullet() const {
if (!HasInsideBullet()) {
nsIFrame* nsBlockFrame::GetInsideMarker() const {
if (!HasInsideMarker()) {
return nullptr;
}
NS_ASSERTION(!HasOutsideBullet(), "invalid bullet state");
nsIFrame* frame = GetProperty(InsideBulletProperty());
NS_ASSERTION(frame, "bogus inside bullet frame");
NS_ASSERTION(!HasOutsideMarker(), "invalid marker state");
nsIFrame* frame = GetProperty(InsideMarkerProperty());
NS_ASSERTION(frame, "bogus inside ::marker frame");
return frame;
}
nsIFrame* nsBlockFrame::GetOutsideBullet() const {
nsFrameList* list = GetOutsideBulletList();
nsIFrame* nsBlockFrame::GetOutsideMarker() const {
nsFrameList* list = GetOutsideMarkerList();
return list ? list->FirstChild() : nullptr;
}
nsFrameList* nsBlockFrame::GetOutsideBulletList() const {
if (!HasOutsideBullet()) {
nsFrameList* nsBlockFrame::GetOutsideMarkerList() const {
if (!HasOutsideMarker()) {
return nullptr;
}
NS_ASSERTION(!HasInsideBullet(), "invalid bullet state");
nsFrameList* list = GetProperty(OutsideBulletProperty());
NS_ASSERTION(list && list->GetLength() == 1, "bogus outside bullet list");
NS_ASSERTION(!HasInsideMarker(), "invalid marker state");
nsFrameList* list = GetProperty(OutsideMarkerProperty());
NS_ASSERTION(list && list->GetLength() == 1, "bogus outside ::marker list");
return list;
}
@ -6486,10 +6485,9 @@ void nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
aLists.Content()->AppendToTop(&textOverflow->GetMarkers());
}
if (HasOutsideBullet()) {
// Display outside bullets manually
nsIFrame* bullet = GetOutsideBullet();
BuildDisplayListForChild(aBuilder, bullet, aLists);
if (HasOutsideMarker()) {
// Display outside ::marker manually.
BuildDisplayListForChild(aBuilder, GetOutsideMarker(), aLists);
}
#ifdef DEBUG
@ -6526,7 +6524,7 @@ a11y::AccType nsBlockFrame::AccessibleType() {
return a11y::eHTMLHRType;
}
if (!HasBullet() || !PresContext()) {
if (!HasMarker() || !PresContext()) {
// XXXsmaug What if we're in the shadow dom?
if (!mContent->GetParent()) {
// Don't create accessible objects for the root content node, they are
@ -6541,11 +6539,11 @@ a11y::AccType nsBlockFrame::AccessibleType() {
return a11y::eNoType;
}
// Not a bullet, treat as normal HTML container
// Not a list item with a ::marker, treat as normal HTML container.
return a11y::eHyperTextType;
}
// Create special list bullet accessible
// Create special list item accessible since we have a ::marker.
return a11y::eHTMLLiType;
}
#endif
@ -6601,21 +6599,21 @@ void nsBlockFrame::ChildIsDirty(nsIFrame* aChild) {
if (aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW &&
aChild->IsAbsolutelyPositioned()) {
// do nothing
} else if (aChild == GetOutsideBullet()) {
// The bullet lives in the first line, unless the first line has
} else if (aChild == GetOutsideMarker()) {
// The ::marker lives in the first line, unless the first line has
// height 0 and there is a second line, in which case it lives
// in the second line.
LineIterator bulletLine = LinesBegin();
if (bulletLine != LinesEnd() && bulletLine->BSize() == 0 &&
bulletLine != mLines.back()) {
bulletLine = bulletLine.next();
LineIterator markerLine = LinesBegin();
if (markerLine != LinesEnd() && markerLine->BSize() == 0 &&
markerLine != mLines.back()) {
markerLine = markerLine.next();
}
if (bulletLine != LinesEnd()) {
MarkLineDirty(bulletLine, &mLines);
if (markerLine != LinesEnd()) {
MarkLineDirty(markerLine, &mLines);
}
// otherwise we have an empty line list, and ReflowDirtyLines
// will handle reflowing the bullet.
// will handle reflowing the ::marker.
} else {
// Note that we should go through our children to mark lines dirty
// before the next reflow. Doing it now could make things O(N^2)
@ -6740,41 +6738,39 @@ void nsBlockFrame::SetInitialChildList(ChildListID aListID,
void nsBlockFrame::SetMarkerFrameForListItem(nsIFrame* aMarkerFrame) {
MOZ_ASSERT(aMarkerFrame);
MOZ_ASSERT((GetStateBits() & (NS_BLOCK_FRAME_HAS_INSIDE_BULLET |
NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET)) == 0,
"How can we have a bullet already?");
MOZ_ASSERT((GetStateBits() & (NS_BLOCK_FRAME_HAS_INSIDE_MARKER |
NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER)) == 0,
"How can we have a ::marker frame already?");
auto bullet = aMarkerFrame;
if (StyleList()->mListStylePosition == NS_STYLE_LIST_STYLE_POSITION_INSIDE) {
SetProperty(InsideBulletProperty(), bullet);
AddStateBits(NS_BLOCK_FRAME_HAS_INSIDE_BULLET);
SetProperty(InsideMarkerProperty(), aMarkerFrame);
AddStateBits(NS_BLOCK_FRAME_HAS_INSIDE_MARKER);
} else {
SetProperty(OutsideBulletProperty(),
new (PresShell()) nsFrameList(bullet, bullet));
AddStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
SetProperty(OutsideMarkerProperty(),
new (PresShell()) nsFrameList(aMarkerFrame, aMarkerFrame));
AddStateBits(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
}
}
bool nsBlockFrame::BulletIsEmpty() const {
bool nsBlockFrame::MarkerIsEmpty() const {
NS_ASSERTION(mContent->GetPrimaryFrame()->StyleDisplay()->mDisplay ==
mozilla::StyleDisplay::ListItem &&
HasOutsideBullet(),
"should only care when we have an outside bullet");
nsIFrame* marker = GetBullet();
HasOutsideMarker(),
"should only care when we have an outside ::marker");
nsIFrame* marker = GetMarker();
const nsStyleList* list = marker->StyleList();
return list->mCounterStyle.IsNone() && !list->GetListStyleImage() &&
marker->StyleContent()->ContentCount() == 0;
}
void nsBlockFrame::GetSpokenBulletText(nsAString& aText) const {
void nsBlockFrame::GetSpokenMarkerText(nsAString& aText) const {
const nsStyleList* myList = StyleList();
if (myList->GetListStyleImage()) {
aText.Assign(kDiscCharacter);
aText.Append(' ');
} else {
if (nsIFrame* marker = GetBullet()) {
nsBulletFrame* bullet = do_QueryFrame(marker);
if (bullet) {
if (nsIFrame* marker = GetMarker()) {
if (nsBulletFrame* bullet = do_QueryFrame(marker)) {
bullet->GetSpokenText(aText);
} else {
ErrorResult err;
@ -6789,22 +6785,21 @@ void nsBlockFrame::GetSpokenBulletText(nsAString& aText) const {
}
}
void nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
BlockReflowInput& aState,
ReflowOutput& aMetrics, nscoord aLineTop) {
void nsBlockFrame::ReflowOutsideMarker(nsIFrame* aMarkerFrame,
BlockReflowInput& aState,
ReflowOutput& aMetrics, nscoord aLineTop) {
const ReflowInput& ri = aState.mReflowInput;
// Reflow the bullet now
WritingMode bulletWM = aBulletFrame->GetWritingMode();
LogicalSize availSize(bulletWM);
WritingMode markerWM = aMarkerFrame->GetWritingMode();
LogicalSize availSize(markerWM);
// Make up an inline-size since it doesn't really matter (XXX).
availSize.ISize(bulletWM) = aState.ContentISize();
availSize.BSize(bulletWM) = NS_UNCONSTRAINEDSIZE;
availSize.ISize(markerWM) = aState.ContentISize();
availSize.BSize(markerWM) = NS_UNCONSTRAINEDSIZE;
ReflowInput reflowInput(aState.mPresContext, ri, aBulletFrame, availSize,
ReflowInput reflowInput(aState.mPresContext, ri, aMarkerFrame, availSize,
nullptr, ReflowInput::COMPUTE_SIZE_SHRINK_WRAP);
nsReflowStatus status;
aBulletFrame->Reflow(aState.mPresContext, aMetrics, reflowInput, status);
aMarkerFrame->Reflow(aState.mPresContext, aMetrics, reflowInput, status);
// Get the float available space using our saved state from before we
// started reflowing the block, so that we ignore any floats inside
@ -6819,36 +6814,36 @@ void nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
// FIXME (bug 25888): need to check the entire region that the first
// line overlaps, not just the top pixel.
// Place the bullet now. We want to place the bullet relative to the
// Place the ::marker now. We want to place the ::marker relative to the
// border-box of the associated block (using the right/left margin of
// the bullet frame as separation). However, if a line box would be
// the ::marker frame as separation). However, if a line box would be
// displaced by floats that are *outside* the associated block, we
// want to displace it by the same amount. That is, we act as though
// the edge of the floats is the content-edge of the block, and place
// the bullet at a position offset from there by the block's padding,
// the block's border, and the bullet frame's margin.
// the ::marker at a position offset from there by the block's padding,
// the block's border, and the ::marker frame's margin.
// IStart from floatAvailSpace gives us the content/float start edge
// in the current writing mode. Then we subtract out the start
// border/padding and the bullet's width and margin to offset the position.
// border/padding and the ::marker's width and margin to offset the position.
WritingMode wm = ri.GetWritingMode();
// Get the bullet's margin, converted to our writing mode so that we can
// Get the ::marker's margin, converted to our writing mode so that we can
// combine it with other logical values here.
LogicalMargin bulletMargin =
reflowInput.ComputedLogicalMargin().ConvertTo(wm, bulletWM);
LogicalMargin markerMargin =
reflowInput.ComputedLogicalMargin().ConvertTo(wm, markerWM);
nscoord iStart = floatAvailSpace.IStart(wm) -
ri.ComputedLogicalBorderPadding().IStart(wm) -
bulletMargin.IEnd(wm) - aMetrics.ISize(wm);
markerMargin.IEnd(wm) - aMetrics.ISize(wm);
// Approximate the bullets position; vertical alignment will provide
// Approximate the ::marker's position; vertical alignment will provide
// the final vertical location. We pass our writing-mode here, because
// it may be different from the bullet frame's mode.
// it may be different from the ::marker frame's mode.
nscoord bStart = floatAvailSpace.BStart(wm);
aBulletFrame->SetRect(
aMarkerFrame->SetRect(
wm,
LogicalRect(wm, iStart, bStart, aMetrics.ISize(wm), aMetrics.BSize(wm)),
aState.ContainerSize());
aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowInput);
aMarkerFrame->DidReflow(aState.mPresContext, &aState.mReflowInput);
}
// This is used to scan frames for any float placeholders, add their

Просмотреть файл

@ -229,41 +229,41 @@ class nsBlockFrame : public nsContainerFrame {
bool CachedIsEmpty() override;
bool IsSelfEmpty() override;
// Given that we have a bullet, does it actually draw something, i.e.,
// Given that we have a ::marker frame, does it actually draw something, i.e.,
// do we have either a 'list-style-type' or 'list-style-image' that is
// not 'none'?
bool BulletIsEmpty() const;
// not 'none', and no 'content'?
bool MarkerIsEmpty() const;
/**
* Return the bullet text equivalent.
* Return the ::marker text equivalent.
*/
void GetSpokenBulletText(nsAString& aText) const;
void GetSpokenMarkerText(nsAString& aText) const;
/**
* Return true if there's a bullet.
* Return true if this frame has a ::marker frame.
*/
bool HasBullet() const { return HasOutsideBullet() || HasInsideBullet(); }
bool HasMarker() const { return HasOutsideMarker() || HasInsideMarker(); }
/**
* @return true if this frame has an inside bullet frame.
* @return true if this frame has an inside ::marker frame.
*/
bool HasInsideBullet() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_INSIDE_BULLET);
bool HasInsideMarker() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_INSIDE_MARKER);
}
/**
* @return true if this frame has an outside bullet frame.
* @return true if this frame has an outside ::marker frame.
*/
bool HasOutsideBullet() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET);
bool HasOutsideMarker() const {
return 0 != (mState & NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER);
}
/**
* @return the bullet frame or nullptr if we don't have one.
* @return the ::marker frame or nullptr if we don't have one.
*/
nsIFrame* GetBullet() const {
nsIFrame* outside = GetOutsideBullet();
return outside ? outside : GetInsideBullet();
nsIFrame* GetMarker() const {
nsIFrame* outside = GetOutsideMarker();
return outside ? outside : GetInsideMarker();
}
/**
@ -395,7 +395,7 @@ class nsBlockFrame : public nsContainerFrame {
};
/**
* Update the styles of our various pseudo-elements (bullets, first-line,
* Update the styles of our various pseudo-elements (marker, first-line,
* etc, but _not_ first-letter).
*/
void UpdatePseudoElementStyles(mozilla::ServoRestyleState& aRestyleState);
@ -819,8 +819,8 @@ class nsBlockFrame : public nsContainerFrame {
//----------------------------------------
// List handling kludge
void ReflowBullet(nsIFrame* aBulletFrame, BlockReflowInput& aState,
ReflowOutput& aMetrics, nscoord aLineTop);
void ReflowOutsideMarker(nsIFrame* aMarkerFrame, BlockReflowInput& aState,
ReflowOutput& aMetrics, nscoord aLineTop);
//----------------------------------------
@ -864,19 +864,19 @@ class nsBlockFrame : public nsContainerFrame {
void SetOverflowOutOfFlows(const nsFrameList& aList, nsFrameList* aPropValue);
/**
* @return the inside bullet frame or nullptr if we don't have one.
* @return the inside ::marker frame or nullptr if we don't have one.
*/
nsIFrame* GetInsideBullet() const;
nsIFrame* GetInsideMarker() const;
/**
* @return the outside bullet frame or nullptr if we don't have one.
* @return the outside ::marker frame or nullptr if we don't have one.
*/
nsIFrame* GetOutsideBullet() const;
nsIFrame* GetOutsideMarker() const;
/**
* @return the outside bullet frame list frame property.
* @return the outside ::marker frame list frame property.
*/
nsFrameList* GetOutsideBulletList() const;
nsFrameList* GetOutsideMarkerList() const;
/**
* @return true if this frame has pushed floats.

Просмотреть файл

@ -562,10 +562,10 @@ FRAME_STATE_BIT(Block, 28, NS_BLOCK_CLIP_PAGINATED_OVERFLOW)
// even if it has no actual first-letter frame among its descendants.
FRAME_STATE_BIT(Block, 29, NS_BLOCK_HAS_FIRST_LETTER_STYLE)
// NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET and NS_BLOCK_FRAME_HAS_INSIDE_BULLET
// means the block has an associated bullet frame, they are mutually exclusive.
FRAME_STATE_BIT(Block, 30, NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET)
FRAME_STATE_BIT(Block, 31, NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
// NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER and NS_BLOCK_FRAME_HAS_INSIDE_MARKER
// means the block has an associated ::marker frame, they are mutually exclusive.
FRAME_STATE_BIT(Block, 30, NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER)
FRAME_STATE_BIT(Block, 31, NS_BLOCK_FRAME_HAS_INSIDE_MARKER)
// This block has had a child marked dirty, so before we reflow we need
// to look through the lines to find any such children and mark

Просмотреть файл

@ -34,15 +34,15 @@ class ViewportFrame;
// NS_BLOCK_FLAGS_NON_INHERITED_MASK bits below.
#define NS_BLOCK_FLAGS_MASK \
(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS | NS_BLOCK_CLIP_PAGINATED_OVERFLOW | \
NS_BLOCK_HAS_FIRST_LETTER_STYLE | NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | \
NS_BLOCK_HAS_FIRST_LETTER_CHILD | NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
NS_BLOCK_HAS_FIRST_LETTER_STYLE | NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER | \
NS_BLOCK_HAS_FIRST_LETTER_CHILD | NS_BLOCK_FRAME_HAS_INSIDE_MARKER)
// This is the subset of NS_BLOCK_FLAGS_MASK that is NOT inherited
// by default. They should only be set on the first-in-flow.
// See nsBlockFrame::Init.
#define NS_BLOCK_FLAGS_NON_INHERITED_MASK \
(NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET | NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
NS_BLOCK_FRAME_HAS_INSIDE_BULLET)
(NS_BLOCK_FRAME_HAS_OUTSIDE_MARKER | NS_BLOCK_HAS_FIRST_LETTER_CHILD | \
NS_BLOCK_FRAME_HAS_INSIDE_MARKER)
// Factory methods for creating html layout objects

Просмотреть файл

@ -310,7 +310,7 @@ bool nsLineBox::IsEmpty() const {
--n, kid = kid->GetNextSibling()) {
if (!kid->IsEmpty()) return false;
}
if (HasBullet()) {
if (HasMarker()) {
return false;
}
return true;
@ -339,7 +339,7 @@ bool nsLineBox::CachedIsEmpty() {
break;
}
}
if (HasBullet()) {
if (HasMarker()) {
result = false;
}
}

Просмотреть файл

@ -247,16 +247,16 @@ class nsLineBox final : public nsLineLink {
return mFlags.mResizeReflowOptimizationDisabled;
}
// mHasBullet bit
void SetHasBullet() {
mFlags.mHasBullet = true;
// mHasMarker bit
void SetHasMarker() {
mFlags.mHasMarker = true;
InvalidateCachedIsEmpty();
}
void ClearHasBullet() {
mFlags.mHasBullet = false;
void ClearHasMarker() {
mFlags.mHasMarker = false;
InvalidateCachedIsEmpty();
}
bool HasBullet() const { return mFlags.mHasBullet; }
bool HasMarker() const { return mFlags.mHasMarker; }
// mHadFloatPushed bit
void SetHadFloatPushed() { mFlags.mHadFloatPushed = true; }
@ -597,9 +597,9 @@ class nsLineBox final : public nsLineLink {
bool mResizeReflowOptimizationDisabled : 1;
bool mEmptyCacheValid : 1;
bool mEmptyCacheState : 1;
// mHasBullet indicates that this is an inline line whose block's
// bullet is adjacent to this line and non-empty.
bool mHasBullet : 1;
// mHasMarker indicates that this is an inline line whose block's
// ::marker is adjacent to this line and non-empty.
bool mHasMarker : 1;
// Indicates that this line *may* have a placeholder for a float
// that was pushed to a later column or page.
bool mHadFloatPushed : 1;

Просмотреть файл

@ -13,7 +13,6 @@
#include "LayoutLogging.h"
#include "SVGTextFrame.h"
#include "nsBlockFrame.h"
#include "nsBulletFrame.h"
#include "nsFontMetrics.h"
#include "nsStyleConsts.h"
#include "nsContainerFrame.h"
@ -76,7 +75,7 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mInFirstLine(false),
mGotLineBox(false),
mInFirstLetter(false),
mHasBullet(false),
mHasMarker(false),
mDirtyNextLine(false),
mLineAtStart(false),
mHasRuby(false),
@ -191,7 +190,7 @@ void nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
mMaxStartBoxBSize = mMaxEndBoxBSize = 0;
if (mGotLineBox) {
mLineBox->ClearHasBullet();
mLineBox->ClearHasMarker();
}
PerSpanData* psd = NewPerSpanData();
@ -629,7 +628,7 @@ nsLineLayout::PerFrameData* nsLineLayout::NewPerFrameData(nsIFrame* aFrame) {
pfd->mIsNonWhitespaceTextFrame = false;
pfd->mIsLetterFrame = false;
pfd->mRecomputeOverflow = false;
pfd->mIsBullet = false;
pfd->mIsMarker = false;
pfd->mSkipWhenTrimmingWhitespace = false;
pfd->mIsEmpty = false;
pfd->mIsPlaceholder = false;
@ -907,7 +906,7 @@ void nsLineLayout::ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
!LineIsEmpty() &&
// We always place floating letter frames. This kinda sucks. They'd
// usually fall into the LineIsEmpty() check anyway, except when
// there's something like a bullet before or what not. We actually
// there's something like a ::marker before or what not. We actually
// need to place them now, because they're pretty nasty and they
// create continuations that are in flow and not a kid of the
// previous continuation's parent. We don't want the deferred reflow
@ -1384,29 +1383,29 @@ void nsLineLayout::PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics) {
}
}
void nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
void nsLineLayout::AddMarkerFrame(nsIFrame* aFrame,
const ReflowOutput& aMetrics) {
NS_ASSERTION(mCurrentSpan == mRootSpan, "bad linelayout user");
NS_ASSERTION(mGotLineBox, "must have line box");
nsBlockFrame* blockFrame = do_QueryFrame(mBlockReflowInput->mFrame);
MOZ_ASSERT(blockFrame, "must be for block");
if (!blockFrame->BulletIsEmpty()) {
mHasBullet = true;
mLineBox->SetHasBullet();
if (!blockFrame->MarkerIsEmpty()) {
mHasMarker = true;
mLineBox->SetHasMarker();
}
WritingMode lineWM = mRootSpan->mWritingMode;
PerFrameData* pfd = NewPerFrameData(aFrame);
PerSpanData* psd = mRootSpan;
MOZ_ASSERT(psd->mFirstFrame, "adding bullet to an empty line?");
// Prepend the bullet frame to the line.
MOZ_ASSERT(psd->mFirstFrame, "adding marker to an empty line?");
// Prepend the marker frame to the line.
psd->mFirstFrame->mPrev = pfd;
pfd->mNext = psd->mFirstFrame;
psd->mFirstFrame = pfd;
pfd->mIsBullet = true;
pfd->mIsMarker = true;
if (aMetrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
pfd->mAscent = aFrame->GetLogicalBaseline(lineWM);
} else {
@ -1418,13 +1417,13 @@ void nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
pfd->mOverflowAreas = aMetrics.mOverflowAreas;
}
void nsLineLayout::RemoveBulletFrame(nsIFrame* aFrame) {
void nsLineLayout::RemoveMarkerFrame(nsIFrame* aFrame) {
PerSpanData* psd = mCurrentSpan;
MOZ_ASSERT(psd == mRootSpan, "bullet on non-root span?");
MOZ_ASSERT(psd == mRootSpan, "::marker on non-root span?");
MOZ_ASSERT(psd->mFirstFrame->mFrame == aFrame,
"bullet is not the first frame?");
"::marker is not the first frame?");
PerFrameData* pfd = psd->mFirstFrame;
MOZ_ASSERT(pfd != psd->mLastFrame, "bullet is the only frame?");
MOZ_ASSERT(pfd != psd->mLastFrame, "::marker is the only frame?");
pfd->mNext->mPrev = nullptr;
psd->mFirstFrame = pfd->mNext;
FreeFrame(pfd);
@ -2247,13 +2246,13 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
// in some cases in quirks mode:
// (1) if the root span contains non-whitespace text directly (this
// is handled by zeroEffectiveSpanBox
// (2) if this line has a bullet
// (2) if this line has a ::marker
// (3) if this is the last line of an LI, DT, or DD element
// (The last line before a block also counts, but not before a
// BR) (NN4/IE5 quirk)
// (1) and (2) above
bool applyMinLH = !zeroEffectiveSpanBox || mHasBullet;
bool applyMinLH = !zeroEffectiveSpanBox || mHasMarker;
bool isLastLine =
!mGotLineBox || (!mLineBox->IsLineWrapped() && !mLineEndsInBR);
if (!applyMinLH && isLastLine) {
@ -2267,7 +2266,7 @@ void nsLineLayout::VerticalAlignFrames(PerSpanData* psd) {
}
}
if (applyMinLH) {
if (psd->mHasNonemptyContent || preMode || mHasBullet) {
if (psd->mHasNonemptyContent || preMode || mHasMarker) {
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" [span]==> adjusting min/maxBCoord: currentValues: %d,%d",
minBCoord, maxBCoord);
@ -2619,8 +2618,8 @@ bool nsLineLayout::TrimTrailingWhiteSpace() {
}
bool nsLineLayout::PerFrameData::ParticipatesInJustification() const {
if (mIsBullet || mIsEmpty || mSkipWhenTrimmingWhitespace) {
// Skip bullets, empty frames, and placeholders
if (mIsMarker || mIsEmpty || mSkipWhenTrimmingWhitespace) {
// Skip ::markers, empty frames, and placeholders
return false;
}
if (mIsTextFrame && !mIsNonWhitespaceTextFrame &&
@ -3178,11 +3177,11 @@ void nsLineLayout::TextAlignLine(nsLineBox* aLine, bool aIsLastLine) {
(!mPresContext->IsVisualMode() || !lineWM.IsBidiLTR())) {
PerFrameData* startFrame = psd->mFirstFrame;
MOZ_ASSERT(startFrame, "empty line?");
if (startFrame->mIsBullet) {
// Bullet shouldn't participate in bidi reordering.
if (startFrame->mIsMarker) {
// ::marker shouldn't participate in bidi reordering.
startFrame = startFrame->mNext;
MOZ_ASSERT(startFrame, "no frame after bullet?");
MOZ_ASSERT(!startFrame->mIsBullet, "multiple bullets?");
MOZ_ASSERT(startFrame, "no frame after ::marker?");
MOZ_ASSERT(!startFrame->mIsMarker, "multiple ::markers?");
}
nsBidiPresUtils::ReorderFrames(startFrame->mFrame, aLine->GetChildCount(),
lineWM, mContainerSize,
@ -3240,7 +3239,7 @@ void nsLineLayout::RelativePositionFrames(PerSpanData* psd,
if (psd != mRootSpan) {
// The span's overflow areas come in three parts:
// -- this frame's width and height
// -- pfd->mOverflowAreas, which is the area of a bullet or the union
// -- pfd->mOverflowAreas, which is the area of a ::marker or the union
// of a relatively positioned frame's absolute children
// -- the bounds of all inline descendants
// The former two parts are computed right here, we gather the descendants

Просмотреть файл

@ -16,7 +16,6 @@
#include "BlockReflowInput.h"
#include "nsLineBox.h"
class nsBulletFrame;
class nsFloatManager;
struct nsStyleText;
@ -93,9 +92,9 @@ class nsLineLayout {
void ReflowFrame(nsIFrame* aFrame, nsReflowStatus& aReflowStatus,
ReflowOutput* aMetrics, bool& aPushedFrame);
void AddBulletFrame(nsIFrame* aFrame, const ReflowOutput& aMetrics);
void AddMarkerFrame(nsIFrame* aFrame, const ReflowOutput& aMetrics);
void RemoveBulletFrame(nsIFrame* aFrame);
void RemoveMarkerFrame(nsIFrame* aFrame);
/**
* Place frames in the block direction (CSS property vertical-align)
@ -424,7 +423,7 @@ class nsLineLayout {
bool mIsNonWhitespaceTextFrame : 1;
bool mIsLetterFrame : 1;
bool mRecomputeOverflow : 1;
bool mIsBullet : 1;
bool mIsMarker : 1;
bool mSkipWhenTrimmingWhitespace : 1;
bool mIsEmpty : 1;
bool mIsPlaceholder : 1;
@ -570,7 +569,7 @@ class nsLineLayout {
bool mInFirstLine : 1;
bool mGotLineBox : 1;
bool mInFirstLetter : 1;
bool mHasBullet : 1;
bool mHasMarker : 1;
bool mDirtyNextLine : 1;
bool mLineAtStart : 1;
bool mHasRuby : 1;