зеркало из https://github.com/mozilla/pjs.git
Clean up API (and its callers) for getting style data: remove unneeded null checks and switch to new inline member functions (one for each struct) that return values. b=197205 r+sr=roc a=brendan
This commit is contained in:
Родитель
efe1c204e8
Коммит
1477c03ead
|
@ -387,6 +387,18 @@ GetSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** a
|
|||
*aResult = NS_STATIC_CAST(nsIFrame*, value);
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
|
||||
{
|
||||
for (nsIFrame *frame = aFrame, *next; ; frame = next) {
|
||||
GetSpecialSibling(aFrameManager, frame, &next);
|
||||
if (!next)
|
||||
return frame;
|
||||
}
|
||||
NS_NOTREACHED("unreachable code");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Get the frame's next-in-flow, or, if it doesn't have one,
|
||||
// its special sibling.
|
||||
static nsIFrame*
|
||||
|
@ -7812,6 +7824,14 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||
nsIFrame* prevSibling;
|
||||
aPresShell->GetPrimaryFrameFor(child, &prevSibling);
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
// contains a block). Get the last part of that split.
|
||||
if (IsFrameSpecial(prevSibling)) {
|
||||
nsCOMPtr<nsIFrameManager> fm;
|
||||
aPresShell->GetFrameManager(getter_AddRefs(fm));
|
||||
prevSibling = GetLastSpecialSibling(fm, prevSibling);
|
||||
}
|
||||
|
||||
// The frame may have a continuation. If so, we want the
|
||||
// last-in-flow as our previous sibling.
|
||||
prevSibling = prevSibling->GetLastInFlow();
|
||||
|
@ -8011,6 +8031,14 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
|
|||
aPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter), &prevSibling);
|
||||
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
// contains a block). Get the last part of that split.
|
||||
if (IsFrameSpecial(prevSibling)) {
|
||||
nsCOMPtr<nsIFrameManager> fm;
|
||||
aPresShell->GetFrameManager(getter_AddRefs(fm));
|
||||
prevSibling = GetLastSpecialSibling(fm, prevSibling);
|
||||
}
|
||||
|
||||
// The frame may have a continuation. Get the last-in-flow
|
||||
prevSibling = prevSibling->GetLastInFlow();
|
||||
|
||||
|
|
|
@ -2149,16 +2149,17 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
PRBool zeroEffectiveSpanBox = PR_FALSE;
|
||||
// XXXldb If we really have empty continuations, then all these other
|
||||
// checks don't make sense for them.
|
||||
if ((emptyContinuation || mCompatMode != eCompatibility_FullStandards) &&
|
||||
((psd == mRootSpan) ||
|
||||
((0 == spanFramePFD->mBorderPadding.top) &&
|
||||
(0 == spanFramePFD->mBorderPadding.right) &&
|
||||
(0 == spanFramePFD->mBorderPadding.bottom) &&
|
||||
(0 == spanFramePFD->mBorderPadding.left) &&
|
||||
(0 == spanFramePFD->mMargin.top) &&
|
||||
(0 == spanFramePFD->mMargin.right) &&
|
||||
(0 == spanFramePFD->mMargin.bottom) &&
|
||||
(0 == spanFramePFD->mMargin.left)))) {
|
||||
if (emptyContinuation ||
|
||||
(mCompatMode != eCompatibility_FullStandards &&
|
||||
(psd == mRootSpan ||
|
||||
(0 == spanFramePFD->mBorderPadding.top &&
|
||||
0 == spanFramePFD->mBorderPadding.right &&
|
||||
0 == spanFramePFD->mBorderPadding.bottom &&
|
||||
0 == spanFramePFD->mBorderPadding.left &&
|
||||
0 == spanFramePFD->mMargin.top &&
|
||||
0 == spanFramePFD->mMargin.right &&
|
||||
0 == spanFramePFD->mMargin.bottom &&
|
||||
0 == spanFramePFD->mMargin.left)))) {
|
||||
// This code handles an issue with compatability with non-css
|
||||
// conformant browsers. In particular, there are some cases
|
||||
// where the font-size and line-height for a span must be
|
||||
|
|
|
@ -2149,16 +2149,17 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
PRBool zeroEffectiveSpanBox = PR_FALSE;
|
||||
// XXXldb If we really have empty continuations, then all these other
|
||||
// checks don't make sense for them.
|
||||
if ((emptyContinuation || mCompatMode != eCompatibility_FullStandards) &&
|
||||
((psd == mRootSpan) ||
|
||||
((0 == spanFramePFD->mBorderPadding.top) &&
|
||||
(0 == spanFramePFD->mBorderPadding.right) &&
|
||||
(0 == spanFramePFD->mBorderPadding.bottom) &&
|
||||
(0 == spanFramePFD->mBorderPadding.left) &&
|
||||
(0 == spanFramePFD->mMargin.top) &&
|
||||
(0 == spanFramePFD->mMargin.right) &&
|
||||
(0 == spanFramePFD->mMargin.bottom) &&
|
||||
(0 == spanFramePFD->mMargin.left)))) {
|
||||
if (emptyContinuation ||
|
||||
(mCompatMode != eCompatibility_FullStandards &&
|
||||
(psd == mRootSpan ||
|
||||
(0 == spanFramePFD->mBorderPadding.top &&
|
||||
0 == spanFramePFD->mBorderPadding.right &&
|
||||
0 == spanFramePFD->mBorderPadding.bottom &&
|
||||
0 == spanFramePFD->mBorderPadding.left &&
|
||||
0 == spanFramePFD->mMargin.top &&
|
||||
0 == spanFramePFD->mMargin.right &&
|
||||
0 == spanFramePFD->mMargin.bottom &&
|
||||
0 == spanFramePFD->mMargin.left)))) {
|
||||
// This code handles an issue with compatability with non-css
|
||||
// conformant browsers. In particular, there are some cases
|
||||
// where the font-size and line-height for a span must be
|
||||
|
|
|
@ -387,6 +387,18 @@ GetSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame, nsIFrame** a
|
|||
*aResult = NS_STATIC_CAST(nsIFrame*, value);
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
GetLastSpecialSibling(nsIFrameManager* aFrameManager, nsIFrame* aFrame)
|
||||
{
|
||||
for (nsIFrame *frame = aFrame, *next; ; frame = next) {
|
||||
GetSpecialSibling(aFrameManager, frame, &next);
|
||||
if (!next)
|
||||
return frame;
|
||||
}
|
||||
NS_NOTREACHED("unreachable code");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Get the frame's next-in-flow, or, if it doesn't have one,
|
||||
// its special sibling.
|
||||
static nsIFrame*
|
||||
|
@ -7812,6 +7824,14 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||
nsIFrame* prevSibling;
|
||||
aPresShell->GetPrimaryFrameFor(child, &prevSibling);
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
// contains a block). Get the last part of that split.
|
||||
if (IsFrameSpecial(prevSibling)) {
|
||||
nsCOMPtr<nsIFrameManager> fm;
|
||||
aPresShell->GetFrameManager(getter_AddRefs(fm));
|
||||
prevSibling = GetLastSpecialSibling(fm, prevSibling);
|
||||
}
|
||||
|
||||
// The frame may have a continuation. If so, we want the
|
||||
// last-in-flow as our previous sibling.
|
||||
prevSibling = prevSibling->GetLastInFlow();
|
||||
|
@ -8011,6 +8031,14 @@ nsCSSFrameConstructor::FindPreviousSibling(nsIPresShell* aPresShell,
|
|||
aPresShell->GetPrimaryFrameFor(nsCOMPtr<nsIContent>(*iter), &prevSibling);
|
||||
|
||||
if (prevSibling) {
|
||||
// The frame may be a special frame (a split inline frame that
|
||||
// contains a block). Get the last part of that split.
|
||||
if (IsFrameSpecial(prevSibling)) {
|
||||
nsCOMPtr<nsIFrameManager> fm;
|
||||
aPresShell->GetFrameManager(getter_AddRefs(fm));
|
||||
prevSibling = GetLastSpecialSibling(fm, prevSibling);
|
||||
}
|
||||
|
||||
// The frame may have a continuation. Get the last-in-flow
|
||||
prevSibling = prevSibling->GetLastInFlow();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче