зеркало из https://github.com/mozilla/pjs.git
Bug 225820. Fold nsFrameInnerFrame into nsFrameOuterFrame, rename to nsSubDocumentFrame, and generally clean up this mess. r+sr=dbaron
This commit is contained in:
Родитель
6fde047fdc
Коммит
4ce233447a
|
@ -829,7 +829,7 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
|
|||
|
||||
// We must do this before we tell the script global object about
|
||||
// this new document since doing that will cause us to re-enter
|
||||
// into nsHTMLFrameInnerFrame code through reflows caused by
|
||||
// into nsSubDocumentFrame code through reflows caused by
|
||||
// FlushPendingNotifications() calls down the road...
|
||||
|
||||
rv = MakeWindow(aParentWidget, aBounds);
|
||||
|
@ -1842,7 +1842,7 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
// OK, so the container is not already hooked up into a foreign view manager hierarchy.
|
||||
// That means we can choose not to hook ourselves up.
|
||||
//
|
||||
// If the parent container is a chrome shell, or a frameset, then we won't hook into its view
|
||||
// If the parent container is a chrome shell then we won't hook into its view
|
||||
// tree. This will improve performance a little bit (especially given scrolling/painting perf bugs)
|
||||
// but is really just for peace of mind. This check can be removed if we want to support fancy
|
||||
// chrome effects like transparent controls floating over content, transparent Web browsers, and
|
||||
|
@ -1856,11 +1856,6 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
|| NS_FAILED(parentContainer->GetItemType(&itemType))
|
||||
|| itemType != nsIDocShellTreeItem::typeContent) {
|
||||
containerView = nsnull;
|
||||
} else {
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(parentContainer));
|
||||
if (nsnull == webShell || IsWebShellAFrameSet(webShell)) {
|
||||
containerView = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2519,6 +2519,18 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
|
|||
NS_ASSERTION(aPO, "Pointer is null!");
|
||||
if (!aPO) return NS_ERROR_FAILURE;
|
||||
|
||||
// Check to see if the subdocument's element has been hidden by the parent document
|
||||
if (aPO->mParent) {
|
||||
nsIFrame * frame;
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't reflow hidden POs
|
||||
if (aPO->mIsHidden) return NS_OK;
|
||||
|
||||
|
@ -2544,18 +2556,6 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Check to see if the Iframe has been hidden
|
||||
// then we don't want to print it.
|
||||
if (aPO->mFrameType == eIFrame) {
|
||||
nsIFrame * frame;
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 cnt = aPO->mKids.Count();
|
||||
for (PRInt32 i=0;i<cnt;i++) {
|
||||
if (NS_FAILED(ReflowDocList((nsPrintObject *)aPO->mKids[i], aSetPixelScale, aDoCalcShrink))) {
|
||||
|
@ -2690,18 +2690,20 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
|
|||
NS_ASSERTION(frameMan, "No Frame manager!");
|
||||
nsIFrame* frame;
|
||||
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame && (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame)) {
|
||||
frame = frame->GetFirstChild(nsnull);
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
nsIView* view = frame->GetView();
|
||||
NS_ASSERTION(view, "Primary frame for subdoc must have view!");
|
||||
if (view) {
|
||||
nsIWidget* w2 = view->GetWidget();
|
||||
if (w2) {
|
||||
widget = w2;
|
||||
if (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame) {
|
||||
view = view->GetFirstChild();
|
||||
NS_ASSERTION(view, "innerView not found");
|
||||
}
|
||||
|
||||
if (view && view->HasWidget()) {
|
||||
widget = view->GetWidget();
|
||||
canCreateScrollbars = PR_FALSE;
|
||||
}
|
||||
canCreateScrollbars = PR_FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -3043,7 +3045,7 @@ nsPrintEngine::PrintDocContent(nsPrintObject* aPO, nsresult& aStatus)
|
|||
|
||||
//-------------------------------------------------------
|
||||
// helper function - To calculate the correct position of
|
||||
// an iframe
|
||||
// an iframe's subdocument
|
||||
//
|
||||
// ASSUMPTION: x,y must be initialized before calling!
|
||||
//
|
||||
|
@ -3058,20 +3060,26 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY)
|
|||
// This gets out HTMLIFrame
|
||||
nsIFrame* frame;
|
||||
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
// This gets the "inner" frame,
|
||||
// and then traverse out ot the pageContentFrame
|
||||
frame = frame->GetFirstChild(nsnull);
|
||||
while (frame) {
|
||||
nsPoint pt = frame->GetPosition();
|
||||
aX += pt.x;
|
||||
aY += pt.y;
|
||||
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
|
||||
break;
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
NS_ASSERTION(frame, "no primary frame for IFRAME");
|
||||
// find the offset to the content rect
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
nsMargin borderPadding(0, 0, 0, 0);
|
||||
frame->CalcBorderPadding(borderPadding);
|
||||
aX += borderPadding.left;
|
||||
aY += borderPadding.top;
|
||||
|
||||
// traverse out to the pageContentFrame
|
||||
do {
|
||||
nsPoint pt = frame->GetPosition();
|
||||
aX += pt.x;
|
||||
aY += pt.y;
|
||||
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
} while (frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3198,7 +3206,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO, PRBool aDoSyncPrinting, PRBool& aDon
|
|||
if (doOffsetting) {
|
||||
nscoord x = 0;
|
||||
nscoord y = 0;
|
||||
// For IFrames, we locate the "inner" frame in the Parent document
|
||||
// For IFrames, we locate the subdocument in the Parent document
|
||||
// then start calculating the location as we walk our way out to the
|
||||
// the pageContentFrame
|
||||
if (aPO->mFrameType == eIFrame) {
|
||||
|
|
|
@ -98,8 +98,7 @@ LAYOUT_ATOM(brFrame, "BRFrame")
|
|||
LAYOUT_ATOM(bulletFrame, "BulletFrame")
|
||||
LAYOUT_ATOM(fieldSetFrame, "FieldSetFrame")
|
||||
LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
|
||||
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
|
||||
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
|
||||
LAYOUT_ATOM(subDocumentFrame, "subDocumentFrame")
|
||||
LAYOUT_ATOM(imageFrame, "ImageFrame")
|
||||
LAYOUT_ATOM(imageControlFrame, "ImageControlFrame")
|
||||
LAYOUT_ATOM(inlineFrame, "InlineFrame")
|
||||
|
|
|
@ -4639,9 +4639,9 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
}
|
||||
if (allowSubframes) {
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresShell, &newFrame);
|
||||
if (newFrame) {
|
||||
// the nsFrameOuterFrame needs to know about its content parent during ::Init.
|
||||
// the nsSubDocumentFrame needs to know about its content parent during ::Init.
|
||||
// there is no reasonable way to get the value there.
|
||||
// so we store it as a frame property.
|
||||
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
|
||||
|
@ -5331,7 +5331,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
}
|
||||
if (allowSubframes) {
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresShell, &newFrame);
|
||||
}
|
||||
}
|
||||
// PROGRESS METER CONSTRUCTION
|
||||
|
@ -8292,7 +8292,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
}
|
||||
// Don't create child frames for iframes/frames, they should not
|
||||
// display any content that they contain.
|
||||
else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType) {
|
||||
else if (nsLayoutAtoms::subDocumentFrame != frameType) {
|
||||
// Construct a child frame (that does not have a table as parent)
|
||||
ConstructFrame(shell, aPresContext, state, childContent, parentFrame, frameItems);
|
||||
}
|
||||
|
|
|
@ -829,7 +829,7 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
|
|||
|
||||
// We must do this before we tell the script global object about
|
||||
// this new document since doing that will cause us to re-enter
|
||||
// into nsHTMLFrameInnerFrame code through reflows caused by
|
||||
// into nsSubDocumentFrame code through reflows caused by
|
||||
// FlushPendingNotifications() calls down the road...
|
||||
|
||||
rv = MakeWindow(aParentWidget, aBounds);
|
||||
|
@ -1842,7 +1842,7 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
// OK, so the container is not already hooked up into a foreign view manager hierarchy.
|
||||
// That means we can choose not to hook ourselves up.
|
||||
//
|
||||
// If the parent container is a chrome shell, or a frameset, then we won't hook into its view
|
||||
// If the parent container is a chrome shell then we won't hook into its view
|
||||
// tree. This will improve performance a little bit (especially given scrolling/painting perf bugs)
|
||||
// but is really just for peace of mind. This check can be removed if we want to support fancy
|
||||
// chrome effects like transparent controls floating over content, transparent Web browsers, and
|
||||
|
@ -1856,11 +1856,6 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
|
|||
|| NS_FAILED(parentContainer->GetItemType(&itemType))
|
||||
|| itemType != nsIDocShellTreeItem::typeContent) {
|
||||
containerView = nsnull;
|
||||
} else {
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(parentContainer));
|
||||
if (nsnull == webShell || IsWebShellAFrameSet(webShell)) {
|
||||
containerView = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,8 +98,7 @@ LAYOUT_ATOM(brFrame, "BRFrame")
|
|||
LAYOUT_ATOM(bulletFrame, "BulletFrame")
|
||||
LAYOUT_ATOM(fieldSetFrame, "FieldSetFrame")
|
||||
LAYOUT_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
|
||||
LAYOUT_ATOM(htmlFrameInnerFrame, "htmlFrameInnerFrame")
|
||||
LAYOUT_ATOM(htmlFrameOuterFrame, "htmlFrameOuterFrame")
|
||||
LAYOUT_ATOM(subDocumentFrame, "subDocumentFrame")
|
||||
LAYOUT_ATOM(imageFrame, "ImageFrame")
|
||||
LAYOUT_ATOM(imageControlFrame, "ImageControlFrame")
|
||||
LAYOUT_ATOM(inlineFrame, "InlineFrame")
|
||||
|
|
|
@ -2613,8 +2613,8 @@ PlaceFrameView(nsIPresContext* aPresContext,
|
|||
{
|
||||
if (aFrame->HasView())
|
||||
nsContainerFrame::PositionFrameView(aPresContext, aFrame);
|
||||
|
||||
nsContainerFrame::PositionChildViews(aPresContext, aFrame);
|
||||
else
|
||||
nsContainerFrame::PositionChildViews(aPresContext, aFrame);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -982,10 +982,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
|
|||
// Recursively walk aFrame's child frames
|
||||
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
|
||||
while (childFrame) {
|
||||
// Position the frame's view (if it has one) and recursively
|
||||
// Position the frame's view (if it has one) otherwise recursively
|
||||
// process its children
|
||||
PositionFrameView(aPresContext, childFrame);
|
||||
PositionChildViews(aPresContext, childFrame);
|
||||
if (childFrame->HasView()) {
|
||||
PositionFrameView(aPresContext, childFrame);
|
||||
} else {
|
||||
PositionChildViews(aPresContext, childFrame);
|
||||
}
|
||||
|
||||
// Get the next sibling child frame
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
|
|
|
@ -2554,6 +2554,66 @@ nsFrame::Invalidate(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (aDesiredSize.width == mRect.width
|
||||
&& aDesiredSize.height == mRect.height)
|
||||
return;
|
||||
|
||||
// Below, we invalidate the old frame area (or, in the case of
|
||||
// outline, combined area) if the outline, border or background
|
||||
// settings indicate that something other than the difference
|
||||
// between the old and new areas needs to be painted. We are
|
||||
// assuming that the difference between the old and new areas will
|
||||
// be invalidated by some other means. That also means invalidating
|
||||
// the old frame area is the same as invalidating the new frame area
|
||||
// (since in either case the UNION of old and new areas will be
|
||||
// invalidated)
|
||||
|
||||
// Invalidate the entire old frame+outline if the frame has an outline
|
||||
|
||||
// This assumes 'outline' is painted outside the element, as CSS2 requires.
|
||||
// Currently we actually paint 'outline' inside the element so this code
|
||||
// isn't strictly necessary. But we're trying to get ready to switch to
|
||||
// CSS2 compliance.
|
||||
const nsStyleOutline* outline = GetStyleOutline();
|
||||
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
||||
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
|
||||
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
|
||||
nscoord width;
|
||||
outline->GetOutlineWidth(width);
|
||||
if (width > 0) {
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
r.Inflate(width, width);
|
||||
Invalidate(aPresContext, r);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has borders. Those borders
|
||||
// may be moving.
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->mBackgroundFlags &
|
||||
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Define the MAX_FRAME_DEPTH to be the ContentSink's MAX_REFLOW_DEPTH plus
|
||||
// 4 for the frames above the document's frames:
|
||||
// the Viewport, GFXScroll, ScrollPort, and Canvas
|
||||
|
@ -5154,8 +5214,7 @@ void DR_State::InitFrameTypeTable()
|
|||
AddFrameTypeInfo(nsLayoutAtoms::brFrame, "br", "br");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::bulletFrame, "bullet", "bullet");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::gfxButtonControlFrame, "button", "gfxButtonControl");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameInnerFrame, "frameI", "htmlFrameInner");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameOuterFrame, "frameO", "htmlFrameOuter");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::subDocumentFrame, "subdoc", "subDocument");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::imageFrame, "img", "image");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::inlineFrame, "inline", "inline");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::letterFrame, "letter", "letter");
|
||||
|
|
|
@ -333,6 +333,20 @@ public:
|
|||
const nsRect& aDamageRect,
|
||||
PRBool aImmediate = PR_FALSE) const;
|
||||
|
||||
/**
|
||||
* Helper method to invalidate portions of a standard container frame if the
|
||||
* reflow state indicates that the size has changed (specifically border,
|
||||
* background and outline).
|
||||
* We assume that the difference between the old frame area and the new
|
||||
* frame area is invalidated by some other means.
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDesiredSize the new size of the frame
|
||||
* @param aReflowState the reflow that was just done on this frame
|
||||
*/
|
||||
void CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
|
||||
// Helper function that tests if the frame tree is too deep; if it
|
||||
// is it marks the frame as "unflowable" and zeros out the metrics
|
||||
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -416,7 +416,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
mChildBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
||||
} else { // frame
|
||||
result = NS_NewHTMLFrameOuterFrame(shell, &frame);
|
||||
result = NS_NewSubDocumentFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
mChildTypes[mChildCount] = FRAME;
|
||||
|
|
|
@ -587,68 +587,3 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIFrame* aFrame,
|
|||
aFrame));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (aDesiredSize.width == mRect.width
|
||||
&& aDesiredSize.height == mRect.height)
|
||||
return;
|
||||
|
||||
// Below, we invalidate the old frame area (or, in the case of
|
||||
// outline, combined area) if the outline, border or background
|
||||
// settings indicate that something other than the difference
|
||||
// between the old and new areas needs to be painted. We are
|
||||
// assuming that the difference between the old and new areas will
|
||||
// be invalidated by some other means. That also means invalidating
|
||||
// the old frame area is the same as invalidating the new frame area
|
||||
// (since in either case the UNION of old and new areas will be
|
||||
// invalidated)
|
||||
|
||||
// Invalidate the entire old frame+outline if the frame has an outline
|
||||
|
||||
// This assumes 'outline' is painted outside the element, as CSS2 requires.
|
||||
// Currently we actually paint 'outline' inside the element so this code
|
||||
// isn't strictly necessary. But we're trying to get ready to switch to
|
||||
// CSS2 compliance.
|
||||
const nsStyleOutline* outline = GetStyleOutline();
|
||||
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
||||
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
|
||||
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
|
||||
nscoord width;
|
||||
outline->GetOutlineWidth(width);
|
||||
if (width > 0) {
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
r.Inflate(width, width);
|
||||
Invalidate(aPresContext, r);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRect.IsEmpty()) {
|
||||
// nothing else to do here
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has borders. Those borders
|
||||
// may be moving.
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->mBackgroundFlags &
|
||||
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,20 +106,6 @@ public:
|
|||
nsIFrame* aOldParentFrame,
|
||||
nsIFrame* aNewParentFrame);
|
||||
|
||||
/**
|
||||
* Helper method to invalidate portions of a standard container frame if the
|
||||
* reflow state indicates that the size has changed (specifically border,
|
||||
* background and outline).
|
||||
* We assume that the difference between the old frame area and the new
|
||||
* frame area is invalidated by some other means.
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDesiredSize the new size of the frame
|
||||
* @param aReflowState the reflow that was just done on this frame
|
||||
*/
|
||||
void CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
|
||||
protected:
|
||||
virtual PRIntn GetSkipSides() const = 0;
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
|||
|
||||
// <frame> and <iframe>
|
||||
nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
// <frameset>
|
||||
nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
|
|
@ -1883,11 +1883,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
|||
|
||||
} else if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) {
|
||||
// XXX not sure if this belongs here or somewhere else - cwk
|
||||
// an nsHTMLFrameInnerFrame doesn't get a placeholder frame, the nsHTMLFrameOuterFrame does
|
||||
if (nsLayoutAtoms::htmlFrameInnerFrame != frame->GetType()) {
|
||||
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
|
||||
aContainingBlockHeight);
|
||||
}
|
||||
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
|
||||
aContainingBlockHeight);
|
||||
} else if (NS_CSS_FRAME_TYPE_INLINE == mFrameType) {
|
||||
// Inline non-replaced elements do not have computed widths or heights
|
||||
// XXX add this check to HaveFixedContentHeight/Width too
|
||||
|
|
|
@ -674,7 +674,7 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||
if(bDoc)
|
||||
{
|
||||
nsIFrame * aNewFrame = nsnull;
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresContext->PresShell(), &aNewFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresContext->PresShell(), &aNewFrame);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -2613,8 +2613,8 @@ PlaceFrameView(nsIPresContext* aPresContext,
|
|||
{
|
||||
if (aFrame->HasView())
|
||||
nsContainerFrame::PositionFrameView(aPresContext, aFrame);
|
||||
|
||||
nsContainerFrame::PositionChildViews(aPresContext, aFrame);
|
||||
else
|
||||
nsContainerFrame::PositionChildViews(aPresContext, aFrame);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -982,10 +982,13 @@ nsContainerFrame::PositionChildViews(nsIPresContext* aPresContext,
|
|||
// Recursively walk aFrame's child frames
|
||||
nsIFrame* childFrame = aFrame->GetFirstChild(childListName);
|
||||
while (childFrame) {
|
||||
// Position the frame's view (if it has one) and recursively
|
||||
// Position the frame's view (if it has one) otherwise recursively
|
||||
// process its children
|
||||
PositionFrameView(aPresContext, childFrame);
|
||||
PositionChildViews(aPresContext, childFrame);
|
||||
if (childFrame->HasView()) {
|
||||
PositionFrameView(aPresContext, childFrame);
|
||||
} else {
|
||||
PositionChildViews(aPresContext, childFrame);
|
||||
}
|
||||
|
||||
// Get the next sibling child frame
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
|
|
|
@ -2554,6 +2554,66 @@ nsFrame::Invalidate(nsIPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (aDesiredSize.width == mRect.width
|
||||
&& aDesiredSize.height == mRect.height)
|
||||
return;
|
||||
|
||||
// Below, we invalidate the old frame area (or, in the case of
|
||||
// outline, combined area) if the outline, border or background
|
||||
// settings indicate that something other than the difference
|
||||
// between the old and new areas needs to be painted. We are
|
||||
// assuming that the difference between the old and new areas will
|
||||
// be invalidated by some other means. That also means invalidating
|
||||
// the old frame area is the same as invalidating the new frame area
|
||||
// (since in either case the UNION of old and new areas will be
|
||||
// invalidated)
|
||||
|
||||
// Invalidate the entire old frame+outline if the frame has an outline
|
||||
|
||||
// This assumes 'outline' is painted outside the element, as CSS2 requires.
|
||||
// Currently we actually paint 'outline' inside the element so this code
|
||||
// isn't strictly necessary. But we're trying to get ready to switch to
|
||||
// CSS2 compliance.
|
||||
const nsStyleOutline* outline = GetStyleOutline();
|
||||
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
||||
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
|
||||
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
|
||||
nscoord width;
|
||||
outline->GetOutlineWidth(width);
|
||||
if (width > 0) {
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
r.Inflate(width, width);
|
||||
Invalidate(aPresContext, r);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has borders. Those borders
|
||||
// may be moving.
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->mBackgroundFlags &
|
||||
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Define the MAX_FRAME_DEPTH to be the ContentSink's MAX_REFLOW_DEPTH plus
|
||||
// 4 for the frames above the document's frames:
|
||||
// the Viewport, GFXScroll, ScrollPort, and Canvas
|
||||
|
@ -5154,8 +5214,7 @@ void DR_State::InitFrameTypeTable()
|
|||
AddFrameTypeInfo(nsLayoutAtoms::brFrame, "br", "br");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::bulletFrame, "bullet", "bullet");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::gfxButtonControlFrame, "button", "gfxButtonControl");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameInnerFrame, "frameI", "htmlFrameInner");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameOuterFrame, "frameO", "htmlFrameOuter");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::subDocumentFrame, "subdoc", "subDocument");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::imageFrame, "img", "image");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::inlineFrame, "inline", "inline");
|
||||
AddFrameTypeInfo(nsLayoutAtoms::letterFrame, "letter", "letter");
|
||||
|
|
|
@ -333,6 +333,20 @@ public:
|
|||
const nsRect& aDamageRect,
|
||||
PRBool aImmediate = PR_FALSE) const;
|
||||
|
||||
/**
|
||||
* Helper method to invalidate portions of a standard container frame if the
|
||||
* reflow state indicates that the size has changed (specifically border,
|
||||
* background and outline).
|
||||
* We assume that the difference between the old frame area and the new
|
||||
* frame area is invalidated by some other means.
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDesiredSize the new size of the frame
|
||||
* @param aReflowState the reflow that was just done on this frame
|
||||
*/
|
||||
void CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
|
||||
// Helper function that tests if the frame tree is too deep; if it
|
||||
// is it marks the frame as "unflowable" and zeros out the metrics
|
||||
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
||||
|
|
|
@ -587,68 +587,3 @@ nsHTMLContainerFrame::CreateViewForFrame(nsIFrame* aFrame,
|
|||
aFrame));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLContainerFrame::CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
if (aDesiredSize.width == mRect.width
|
||||
&& aDesiredSize.height == mRect.height)
|
||||
return;
|
||||
|
||||
// Below, we invalidate the old frame area (or, in the case of
|
||||
// outline, combined area) if the outline, border or background
|
||||
// settings indicate that something other than the difference
|
||||
// between the old and new areas needs to be painted. We are
|
||||
// assuming that the difference between the old and new areas will
|
||||
// be invalidated by some other means. That also means invalidating
|
||||
// the old frame area is the same as invalidating the new frame area
|
||||
// (since in either case the UNION of old and new areas will be
|
||||
// invalidated)
|
||||
|
||||
// Invalidate the entire old frame+outline if the frame has an outline
|
||||
|
||||
// This assumes 'outline' is painted outside the element, as CSS2 requires.
|
||||
// Currently we actually paint 'outline' inside the element so this code
|
||||
// isn't strictly necessary. But we're trying to get ready to switch to
|
||||
// CSS2 compliance.
|
||||
const nsStyleOutline* outline = GetStyleOutline();
|
||||
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
||||
if (outlineStyle != NS_STYLE_BORDER_STYLE_NONE
|
||||
&& outlineStyle != NS_STYLE_BORDER_STYLE_HIDDEN) {
|
||||
nscoord width;
|
||||
outline->GetOutlineWidth(width);
|
||||
if (width > 0) {
|
||||
nsRect r(0, 0, mRect.width, mRect.height);
|
||||
r.Inflate(width, width);
|
||||
Invalidate(aPresContext, r);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mRect.IsEmpty()) {
|
||||
// nothing else to do here
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has borders. Those borders
|
||||
// may be moving.
|
||||
const nsStyleBorder* border = GetStyleBorder();
|
||||
if (border->IsBorderSideVisible(NS_SIDE_LEFT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_RIGHT)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_TOP)
|
||||
|| border->IsBorderSideVisible(NS_SIDE_BOTTOM)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
|
||||
// Invalidate the old frame if the frame has a background
|
||||
// whose position depends on the size of the frame
|
||||
const nsStyleBackground* background = GetStyleBackground();
|
||||
if (background->mBackgroundFlags &
|
||||
(NS_STYLE_BG_X_POSITION_PERCENT | NS_STYLE_BG_Y_POSITION_PERCENT)) {
|
||||
Invalidate(aPresContext, nsRect(0, 0, mRect.width, mRect.height));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,20 +106,6 @@ public:
|
|||
nsIFrame* aOldParentFrame,
|
||||
nsIFrame* aNewParentFrame);
|
||||
|
||||
/**
|
||||
* Helper method to invalidate portions of a standard container frame if the
|
||||
* reflow state indicates that the size has changed (specifically border,
|
||||
* background and outline).
|
||||
* We assume that the difference between the old frame area and the new
|
||||
* frame area is invalidated by some other means.
|
||||
* @param aPresContext the presentation context
|
||||
* @param aDesiredSize the new size of the frame
|
||||
* @param aReflowState the reflow that was just done on this frame
|
||||
*/
|
||||
void CheckInvalidateSizeChange(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState);
|
||||
|
||||
protected:
|
||||
virtual PRIntn GetSkipSides() const = 0;
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ NS_NewCommentFrame(nsIPresShell* aPresShell, nsIFrame** aFrameResult);
|
|||
|
||||
// <frame> and <iframe>
|
||||
nsresult
|
||||
NS_NewHTMLFrameOuterFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
// <frameset>
|
||||
nsresult
|
||||
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);
|
||||
|
|
|
@ -1883,11 +1883,8 @@ nsHTMLReflowState::InitConstraints(nsIPresContext* aPresContext,
|
|||
|
||||
} else if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) {
|
||||
// XXX not sure if this belongs here or somewhere else - cwk
|
||||
// an nsHTMLFrameInnerFrame doesn't get a placeholder frame, the nsHTMLFrameOuterFrame does
|
||||
if (nsLayoutAtoms::htmlFrameInnerFrame != frame->GetType()) {
|
||||
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
|
||||
aContainingBlockHeight);
|
||||
}
|
||||
InitAbsoluteConstraints(aPresContext, cbrs, aContainingBlockWidth,
|
||||
aContainingBlockHeight);
|
||||
} else if (NS_CSS_FRAME_TYPE_INLINE == mFrameType) {
|
||||
// Inline non-replaced elements do not have computed widths or heights
|
||||
// XXX add this check to HaveFixedContentHeight/Width too
|
||||
|
|
|
@ -674,7 +674,7 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||
if(bDoc)
|
||||
{
|
||||
nsIFrame * aNewFrame = nsnull;
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresContext->PresShell(), &aNewFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresContext->PresShell(), &aNewFrame);
|
||||
if(NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -416,7 +416,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
mChildBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
||||
} else { // frame
|
||||
result = NS_NewHTMLFrameOuterFrame(shell, &frame);
|
||||
result = NS_NewSubDocumentFrame(shell, &frame);
|
||||
frame->Init(aPresContext, child, this, kidSC, nsnull);
|
||||
|
||||
mChildTypes[mChildCount] = FRAME;
|
||||
|
|
|
@ -4639,9 +4639,9 @@ nsCSSFrameConstructor::ConstructHTMLFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
}
|
||||
if (allowSubframes) {
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresShell, &newFrame);
|
||||
if (newFrame) {
|
||||
// the nsFrameOuterFrame needs to know about its content parent during ::Init.
|
||||
// the nsSubDocumentFrame needs to know about its content parent during ::Init.
|
||||
// there is no reasonable way to get the value there.
|
||||
// so we store it as a frame property.
|
||||
nsCOMPtr<nsIAtom> contentParentAtom = do_GetAtom("contentParent");
|
||||
|
@ -5331,7 +5331,7 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
|
|||
}
|
||||
}
|
||||
if (allowSubframes) {
|
||||
rv = NS_NewHTMLFrameOuterFrame(aPresShell, &newFrame);
|
||||
rv = NS_NewSubDocumentFrame(aPresShell, &newFrame);
|
||||
}
|
||||
}
|
||||
// PROGRESS METER CONSTRUCTION
|
||||
|
@ -8292,7 +8292,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||
}
|
||||
// Don't create child frames for iframes/frames, they should not
|
||||
// display any content that they contain.
|
||||
else if (nsLayoutAtoms::htmlFrameOuterFrame != frameType) {
|
||||
else if (nsLayoutAtoms::subDocumentFrame != frameType) {
|
||||
// Construct a child frame (that does not have a table as parent)
|
||||
ConstructFrame(shell, aPresContext, state, childContent, parentFrame, frameItems);
|
||||
}
|
||||
|
|
|
@ -2519,6 +2519,18 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
|
|||
NS_ASSERTION(aPO, "Pointer is null!");
|
||||
if (!aPO) return NS_ERROR_FAILURE;
|
||||
|
||||
// Check to see if the subdocument's element has been hidden by the parent document
|
||||
if (aPO->mParent) {
|
||||
nsIFrame * frame;
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't reflow hidden POs
|
||||
if (aPO->mIsHidden) return NS_OK;
|
||||
|
||||
|
@ -2544,18 +2556,6 @@ nsPrintEngine::ReflowDocList(nsPrintObject* aPO, PRBool aSetPixelScale, PRBool a
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Check to see if the Iframe has been hidden
|
||||
// then we don't want to print it.
|
||||
if (aPO->mFrameType == eIFrame) {
|
||||
nsIFrame * frame;
|
||||
aPO->mParent->mPresShell->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
if (!frame->GetStyleVisibility()->IsVisible()) {
|
||||
aPO->mDontPrint = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32 cnt = aPO->mKids.Count();
|
||||
for (PRInt32 i=0;i<cnt;i++) {
|
||||
if (NS_FAILED(ReflowDocList((nsPrintObject *)aPO->mKids[i], aSetPixelScale, aDoCalcShrink))) {
|
||||
|
@ -2690,18 +2690,20 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO, PRBool aDoCalcShrink)
|
|||
NS_ASSERTION(frameMan, "No Frame manager!");
|
||||
nsIFrame* frame;
|
||||
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame && (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame)) {
|
||||
frame = frame->GetFirstChild(nsnull);
|
||||
}
|
||||
|
||||
if (frame) {
|
||||
nsIView* view = frame->GetView();
|
||||
NS_ASSERTION(view, "Primary frame for subdoc must have view!");
|
||||
if (view) {
|
||||
nsIWidget* w2 = view->GetWidget();
|
||||
if (w2) {
|
||||
widget = w2;
|
||||
if (aPO->mFrameType == eIFrame || aPO->mFrameType == eFrame) {
|
||||
view = view->GetFirstChild();
|
||||
NS_ASSERTION(view, "innerView not found");
|
||||
}
|
||||
|
||||
if (view && view->HasWidget()) {
|
||||
widget = view->GetWidget();
|
||||
canCreateScrollbars = PR_FALSE;
|
||||
}
|
||||
canCreateScrollbars = PR_FALSE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -3043,7 +3045,7 @@ nsPrintEngine::PrintDocContent(nsPrintObject* aPO, nsresult& aStatus)
|
|||
|
||||
//-------------------------------------------------------
|
||||
// helper function - To calculate the correct position of
|
||||
// an iframe
|
||||
// an iframe's subdocument
|
||||
//
|
||||
// ASSUMPTION: x,y must be initialized before calling!
|
||||
//
|
||||
|
@ -3058,20 +3060,26 @@ static void GetIFramePosition(nsPrintObject * aPO, nscoord& aX, nscoord& aY)
|
|||
// This gets out HTMLIFrame
|
||||
nsIFrame* frame;
|
||||
frameMan->GetPrimaryFrameFor(aPO->mContent, &frame);
|
||||
if (frame) {
|
||||
// This gets the "inner" frame,
|
||||
// and then traverse out ot the pageContentFrame
|
||||
frame = frame->GetFirstChild(nsnull);
|
||||
while (frame) {
|
||||
nsPoint pt = frame->GetPosition();
|
||||
aX += pt.x;
|
||||
aY += pt.y;
|
||||
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
|
||||
break;
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
NS_ASSERTION(frame, "no primary frame for IFRAME");
|
||||
// find the offset to the content rect
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
nsMargin borderPadding(0, 0, 0, 0);
|
||||
frame->CalcBorderPadding(borderPadding);
|
||||
aX += borderPadding.left;
|
||||
aY += borderPadding.top;
|
||||
|
||||
// traverse out to the pageContentFrame
|
||||
do {
|
||||
nsPoint pt = frame->GetPosition();
|
||||
aX += pt.x;
|
||||
aY += pt.y;
|
||||
if (nsLayoutAtoms::pageContentFrame == frame->GetType()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
frame = frame->GetParent();
|
||||
} while (frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3198,7 +3206,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO, PRBool aDoSyncPrinting, PRBool& aDon
|
|||
if (doOffsetting) {
|
||||
nscoord x = 0;
|
||||
nscoord y = 0;
|
||||
// For IFrames, we locate the "inner" frame in the Parent document
|
||||
// For IFrames, we locate the subdocument in the Parent document
|
||||
// then start calculating the location as we walk our way out to the
|
||||
// the pageContentFrame
|
||||
if (aPO->mFrameType == eIFrame) {
|
||||
|
|
|
@ -639,7 +639,9 @@ NS_IMETHODIMP nsScrollPortView::ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aU
|
|||
if (!scrolledView) return NS_ERROR_FAILURE;
|
||||
|
||||
// move the scrolled view to the new location
|
||||
scrolledView->SetPosition(-aX, -aY);
|
||||
// Note that child widgets may be scrolled by the native widget scrolling,
|
||||
// so don't update their positions
|
||||
scrolledView->SetPositionIgnoringChildWidgets(-aX, -aY);
|
||||
|
||||
// store old position in pixels. We need to do this to make sure there is no
|
||||
// round off errors. This could cause weird scrolling.
|
||||
|
|
|
@ -320,9 +320,23 @@ void nsView::SetPosition(nscoord aX, nscoord aY)
|
|||
if (mShouldIgnoreSetPosition) {
|
||||
return;
|
||||
}
|
||||
// XXX End Temporary fix for Bug #19416
|
||||
|
||||
if (nsnull != mWindow)
|
||||
// XXX End Temporary fix for Bug #19416
|
||||
ResetWidgetPosition(PR_TRUE);
|
||||
}
|
||||
|
||||
void nsView::SetPositionIgnoringChildWidgets(nscoord aX, nscoord aY)
|
||||
{
|
||||
mDimBounds.x += aX - mPosX;
|
||||
mDimBounds.y += aY - mPosY;
|
||||
mPosX = aX;
|
||||
mPosY = aY;
|
||||
|
||||
ResetWidgetPosition(PR_FALSE);
|
||||
}
|
||||
|
||||
void nsView::ResetWidgetPosition(PRBool aRecurse) {
|
||||
if (mWindow)
|
||||
{
|
||||
// see if we are caching our widget changes. Yes?
|
||||
// mark us as changed. Later we will actually move the
|
||||
|
@ -348,6 +362,11 @@ void nsView::SetPosition(nscoord aX, nscoord aY)
|
|||
|
||||
mWindow->Move(NSTwipsToIntPixels((mDimBounds.x + parx), scale),
|
||||
NSTwipsToIntPixels((mDimBounds.y + pary), scale));
|
||||
} else if (aRecurse) {
|
||||
// reposition any widgets under this view
|
||||
for (nsView* v = GetFirstChild(); v; v = v->GetNextSibling()) {
|
||||
v->ResetWidgetPosition(aRecurse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -293,6 +293,8 @@ public:
|
|||
|
||||
void ConvertToParentCoords(nscoord* aX, nscoord* aY) const { *aX += mPosX; *aY += mPosY; }
|
||||
void ConvertFromParentCoords(nscoord* aX, nscoord* aY) const { *aX -= mPosX; *aY -= mPosY; }
|
||||
void ResetWidgetPosition(PRBool aRecurse);
|
||||
void SetPositionIgnoringChildWidgets(nscoord aX, nscoord aY);
|
||||
|
||||
protected:
|
||||
virtual ~nsView();
|
||||
|
|
|
@ -1262,7 +1262,7 @@ void nsViewManager::RenderViews(nsView *aRootView, nsIRenderingContext& aRC,
|
|||
OptimizeDisplayList(&displayList, aRegion, finalTransparentRect, opaqueRgn, PR_FALSE);
|
||||
|
||||
#ifdef DEBUG_roc
|
||||
ShowDisplayList(&displayList);
|
||||
if (getenv("MOZ_SHOW_DISPLAY_LIST")) ShowDisplayList(&displayList);
|
||||
#endif
|
||||
|
||||
if (!finalTransparentRect.IsEmpty()) {
|
||||
|
@ -2212,7 +2212,7 @@ void nsViewManager::BuildEventTargetList(nsAutoVoidArray &aTargets, nsView* aVie
|
|||
BuildDisplayList(aView, eventRect, PR_TRUE, aCaptured, &displayList);
|
||||
|
||||
#ifdef DEBUG_roc
|
||||
// ShowDisplayList(aDisplayList);
|
||||
// ShowDisplayList(&displayList);
|
||||
#endif
|
||||
|
||||
// The display list is in order from back to front. We return the target list in order from
|
||||
|
|
Загрузка…
Ссылка в новой задаче