зеркало из https://github.com/mozilla/pjs.git
Bug 536716. Make BuildScrollFrame not set the primary frame on the content, fix letter frames to reset primary frames to 0 before resetting them to the new value as needed, fix things so <area> never gets a frame of its own, and reenable the SetPrimaryFrame assertion when the primary frame is being changed from one non-null frame to another. r=roc
This commit is contained in:
Родитель
5cf794388d
Коммит
2458109f0e
|
@ -865,8 +865,8 @@ public:
|
|||
*/
|
||||
nsIFrame* GetPrimaryFrame() const { return mPrimaryFrame; }
|
||||
void SetPrimaryFrame(nsIFrame* aFrame) {
|
||||
NS_WARN_IF_FALSE(!aFrame || !mPrimaryFrame || aFrame == mPrimaryFrame,
|
||||
"Losing track of existing primary frame");
|
||||
NS_PRECONDITION(!aFrame || !mPrimaryFrame || aFrame == mPrimaryFrame,
|
||||
"Losing track of existing primary frame");
|
||||
mPrimaryFrame = aFrame;
|
||||
}
|
||||
|
||||
|
|
|
@ -3694,6 +3694,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
|
||||
nsIFrame* newFrame;
|
||||
nsIFrame* primaryFrame;
|
||||
if (bits & FCDATA_FUNC_IS_FULL_CTOR) {
|
||||
nsresult rv =
|
||||
(this->*(data->mFullConstructor))(aState, aItem, aParentFrame,
|
||||
|
@ -3701,6 +3702,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
primaryFrame = newFrame;
|
||||
} else {
|
||||
nsIContent* const content = aItem.mContent;
|
||||
|
||||
|
@ -3731,8 +3734,6 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
display->IsScrollableOverflow()) {
|
||||
BuildScrollFrame(aState, content, styleContext, newFrame,
|
||||
geometricParent, frameToAddToList);
|
||||
// No need to set the primary frame, since BuildScrollFrame did it already
|
||||
bits |= FCDATA_SKIP_FRAMESET;
|
||||
} else {
|
||||
rv = InitAndRestoreFrame(aState, content, geometricParent, nsnull,
|
||||
newFrame);
|
||||
|
@ -3743,6 +3744,12 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
frameToAddToList = newFrame;
|
||||
}
|
||||
|
||||
// Use frameToAddToList as the primary frame. In the non-scrollframe case
|
||||
// they're equal, but in the scrollframe case newFrame is the scrolled
|
||||
// frame, while frameToAddToList is the scrollframe (and should be the
|
||||
// primary frame).
|
||||
primaryFrame = frameToAddToList;
|
||||
|
||||
rv = aState.AddChild(frameToAddToList, aFrameItems, content, styleContext,
|
||||
aParentFrame, allowOutOfFlow, allowOutOfFlow, isPopup);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -3839,7 +3846,7 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
|
|||
"Incorrectly set FCDATA_IS_LINE_PARTICIPANT bits");
|
||||
|
||||
if (!(bits & FCDATA_SKIP_FRAMESET)) {
|
||||
aItem.mContent->SetPrimaryFrame(newFrame);
|
||||
aItem.mContent->SetPrimaryFrame(primaryFrame);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -4315,11 +4322,7 @@ nsCSSFrameConstructor::BuildScrollFrame(nsFrameConstructorState& aState,
|
|||
InitAndRestoreFrame(aState, aContent, aNewFrame, nsnull, aScrolledFrame);
|
||||
|
||||
FinishBuildingScrollFrame(aNewFrame, aScrolledFrame);
|
||||
|
||||
// now set the primary frame to the ScrollFrame
|
||||
aContent->SetPrimaryFrame(aNewFrame);
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
|
@ -9596,7 +9599,13 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIFrame* aBlockFrame,
|
|||
textSC = mPresShell->StyleSet()->ResolveStyleForNonElement(sc);
|
||||
|
||||
// Create a new text frame (the original one will be discarded)
|
||||
// pass a temporary stylecontext, the correct one will be set later
|
||||
// pass a temporary stylecontext, the correct one will be set
|
||||
// later. Start off by unsetting the primary frame for
|
||||
// aTextContent, so it's no longer pointing to the to-be-destroyed
|
||||
// frame.
|
||||
// XXXbz it would be really nice to destroy the old frame _first_,
|
||||
// then create the new one, so we could avoid this hack.
|
||||
aTextContent->SetPrimaryFrame(nsnull);
|
||||
nsIFrame* textFrame = NS_NewTextFrame(mPresShell, textSC);
|
||||
|
||||
NS_ASSERTION(aBlockFrame == GetFloatContainingBlock(aParentFrame),
|
||||
|
@ -9811,7 +9820,6 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
return NS_ERROR_OUT_OF_MEMORY;;
|
||||
}
|
||||
newTextFrame->Init(textContent, parentFrame, nsnull);
|
||||
textContent->SetPrimaryFrame(newTextFrame);
|
||||
|
||||
// Destroy the old text frame's continuations (the old text frame
|
||||
// will be destroyed when its letter frame is destroyed).
|
||||
|
@ -9833,6 +9841,10 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
// Remove placeholder frame and the float
|
||||
aFrameManager->RemoveFrame(nsnull, placeholderFrame);
|
||||
|
||||
// Now that the old frames are gone, we can start pointing to our
|
||||
// new primary frame.
|
||||
textContent->SetPrimaryFrame(newTextFrame);
|
||||
|
||||
// Insert text frame in its place
|
||||
nsFrameList textList(newTextFrame, newTextFrame);
|
||||
aFrameManager->InsertFrames(parentFrame, nsnull, prevSibling, textList);
|
||||
|
@ -9874,11 +9886,14 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsPresContext* aPresContext,
|
|||
}
|
||||
textFrame = NS_NewTextFrame(aPresShell, newSC);
|
||||
textFrame->Init(textContent, aFrame, nsnull);
|
||||
textContent->SetPrimaryFrame(textFrame);
|
||||
|
||||
// Next rip out the kid and replace it with the text frame
|
||||
aFrameManager->RemoveFrame(nsnull, kid);
|
||||
|
||||
// Now that the old frames are gone, we can start pointing to our
|
||||
// new primary frame.
|
||||
textContent->SetPrimaryFrame(textFrame);
|
||||
|
||||
// Insert text frame in its place
|
||||
nsFrameList textList(textFrame, textFrame);
|
||||
aFrameManager->InsertFrames(aFrame, nsnull, prevSibling, textList);
|
||||
|
|
|
@ -594,9 +594,7 @@ private:
|
|||
set. */
|
||||
#define FCDATA_SUPPRESS_FRAME 0x40
|
||||
/* If FCDATA_MAY_NEED_SCROLLFRAME is set, the new frame should be wrapped in
|
||||
a scrollframe if its overflow type so requires. This flag might override
|
||||
FCDATA_SKIP_FRAMEMAP, since scrollframe construction will add to the frame
|
||||
map. */
|
||||
a scrollframe if its overflow type so requires. */
|
||||
#define FCDATA_MAY_NEED_SCROLLFRAME 0x80
|
||||
#ifdef MOZ_XUL
|
||||
/* If FCDATA_IS_POPUP is set, the new frame is a XUL popup frame. These need
|
||||
|
@ -1331,7 +1329,6 @@ private:
|
|||
|
||||
// Build a scroll frame:
|
||||
// Calls BeginBuildingScrollFrame, InitAndRestoreFrame, and then FinishBuildingScrollFrame.
|
||||
// Sets the primary frame for the content to the output aNewFrame.
|
||||
// @param aNewFrame the created scrollframe --- output only
|
||||
// @param aParentFrame the geometric parent that the scrollframe will have.
|
||||
nsresult
|
||||
|
|
|
@ -499,11 +499,16 @@ tr:focus, tt:focus, u:focus, ul:focus, var:focus {
|
|||
}
|
||||
|
||||
/* hidden elements */
|
||||
area, base, basefont, head, meta, script, style, title,
|
||||
base, basefont, head, meta, script, style, title,
|
||||
noembed, param {
|
||||
display: none;
|
||||
}
|
||||
|
||||
area {
|
||||
/* Don't give it frames other than its imageframe */
|
||||
display: none ! important;
|
||||
}
|
||||
|
||||
/* media elements */
|
||||
video > xul|videocontrols, audio > xul|videocontrols {
|
||||
display: -moz-box;
|
||||
|
|
Загрузка…
Ссылка в новой задаче