зеркало из https://github.com/mozilla/gecko-dev.git
Tweaked area frame shrink wrapping for bug #5999
This commit is contained in:
Родитель
2534879fc8
Коммит
9687a61f7a
|
@ -30,6 +30,8 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
#undef NOISY_MAX_ELEMENT_SIZE
|
||||
|
||||
static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
|
||||
nsresult
|
||||
|
@ -291,21 +293,30 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rv = mAbsoluteContainer.Reflow(aPresContext, aReflowState);
|
||||
}
|
||||
|
||||
// Compute our desired size taking into account floaters and child frames
|
||||
// that stick outside our box. Note that if this frame has a height specified
|
||||
// by CSS then we don't do this
|
||||
if ((mFlags & NS_AREA_WRAP_HEIGHT) &&
|
||||
(NS_UNCONSTRAINEDSIZE == aReflowState.computedHeight) &&
|
||||
(NS_FRAME_OUTSIDE_CHILDREN & mState)) {
|
||||
nscoord contentYMost = aDesiredSize.height;
|
||||
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
|
||||
if (yMost > contentYMost) {
|
||||
// retain the border+padding for this element after the bottom
|
||||
// most object.
|
||||
aDesiredSize.height = yMost;
|
||||
if (mFlags & NS_AREA_WRAP_SIZE) {
|
||||
// When the area frame is supposed to wrap around all in-flow
|
||||
// children, make sure its big enough to include those that stick
|
||||
// outside the box.
|
||||
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
|
||||
nscoord xMost = aDesiredSize.mCombinedArea.XMost();
|
||||
if (xMost > aDesiredSize.width) {
|
||||
aDesiredSize.width = xMost;
|
||||
}
|
||||
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
|
||||
if (yMost > aDesiredSize.height) {
|
||||
aDesiredSize.height = yMost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOISY_MAX_ELEMENT_SIZE
|
||||
ListTag(stdout);
|
||||
printf(": maxElementSize=%d,%d desiredSize=%d,%d\n",
|
||||
aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : 0,
|
||||
aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->height : 0,
|
||||
aDesiredSize.width, aDesiredSize.height);
|
||||
#endif
|
||||
|
||||
// If we have children that stick outside our box, then remember the
|
||||
// combined area, because we'll need it later when sizing our view
|
||||
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
|
|
|
@ -245,19 +245,19 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
|||
#define NS_BLOCK_MARGIN_ROOT 0x4
|
||||
#define NS_BLOCK_DOCUMENT_ROOT 0x8
|
||||
#define NS_AREA_NO_SPACE_MGR 0x10
|
||||
#define NS_AREA_WRAP_HEIGHT 0x20
|
||||
#define NS_AREA_WRAP_SIZE 0x20
|
||||
|
||||
// Create a basic area frame. By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_AREA_WRAP_HEIGHT);
|
||||
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
|
||||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root and is a margin root for
|
||||
|
@ -273,7 +273,7 @@ inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
|||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT|NS_BLOCK_SHRINK_WRAP);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "nsHTMLParts.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
|
||||
#undef NOISY_MAX_ELEMENT_SIZE
|
||||
|
||||
static NS_DEFINE_IID(kAreaFrameIID, NS_IAREAFRAME_IID);
|
||||
|
||||
nsresult
|
||||
|
@ -291,21 +293,30 @@ nsAreaFrame::Reflow(nsIPresContext& aPresContext,
|
|||
rv = mAbsoluteContainer.Reflow(aPresContext, aReflowState);
|
||||
}
|
||||
|
||||
// Compute our desired size taking into account floaters and child frames
|
||||
// that stick outside our box. Note that if this frame has a height specified
|
||||
// by CSS then we don't do this
|
||||
if ((mFlags & NS_AREA_WRAP_HEIGHT) &&
|
||||
(NS_UNCONSTRAINEDSIZE == aReflowState.computedHeight) &&
|
||||
(NS_FRAME_OUTSIDE_CHILDREN & mState)) {
|
||||
nscoord contentYMost = aDesiredSize.height;
|
||||
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
|
||||
if (yMost > contentYMost) {
|
||||
// retain the border+padding for this element after the bottom
|
||||
// most object.
|
||||
aDesiredSize.height = yMost;
|
||||
if (mFlags & NS_AREA_WRAP_SIZE) {
|
||||
// When the area frame is supposed to wrap around all in-flow
|
||||
// children, make sure its big enough to include those that stick
|
||||
// outside the box.
|
||||
if (NS_FRAME_OUTSIDE_CHILDREN & mState) {
|
||||
nscoord xMost = aDesiredSize.mCombinedArea.XMost();
|
||||
if (xMost > aDesiredSize.width) {
|
||||
aDesiredSize.width = xMost;
|
||||
}
|
||||
nscoord yMost = aDesiredSize.mCombinedArea.YMost();
|
||||
if (yMost > aDesiredSize.height) {
|
||||
aDesiredSize.height = yMost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NOISY_MAX_ELEMENT_SIZE
|
||||
ListTag(stdout);
|
||||
printf(": maxElementSize=%d,%d desiredSize=%d,%d\n",
|
||||
aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : 0,
|
||||
aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->height : 0,
|
||||
aDesiredSize.width, aDesiredSize.height);
|
||||
#endif
|
||||
|
||||
// If we have children that stick outside our box, then remember the
|
||||
// combined area, because we'll need it later when sizing our view
|
||||
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
|
|
|
@ -245,19 +245,19 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult,
|
|||
#define NS_BLOCK_MARGIN_ROOT 0x4
|
||||
#define NS_BLOCK_DOCUMENT_ROOT 0x8
|
||||
#define NS_AREA_NO_SPACE_MGR 0x10
|
||||
#define NS_AREA_WRAP_HEIGHT 0x20
|
||||
#define NS_AREA_WRAP_SIZE 0x20
|
||||
|
||||
// Create a basic area frame. By default, area frames will extend
|
||||
// their height to cover any children that "stick out".
|
||||
extern nsresult NS_NewAreaFrame(nsIFrame** aNewFrame,
|
||||
PRUint32 aFlags = NS_AREA_WRAP_HEIGHT);
|
||||
PRUint32 aFlags = NS_AREA_WRAP_SIZE);
|
||||
|
||||
// These AreaFrame's shrink wrap around their contents
|
||||
inline nsresult NS_NewTableCellInnerFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
inline nsresult NS_NewTableCaptionFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE);
|
||||
}
|
||||
|
||||
// This type of AreaFrame is the document root and is a margin root for
|
||||
|
@ -273,7 +273,7 @@ inline nsresult NS_NewAbsoluteItemWrapperFrame(nsIFrame** aNewFrame) {
|
|||
|
||||
// This type of AreaFrame shrink wraps
|
||||
inline nsresult NS_NewFloatingItemWrapperFrame(nsIFrame** aNewFrame) {
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_HEIGHT|NS_BLOCK_SHRINK_WRAP);
|
||||
return NS_NewAreaFrame(aNewFrame, NS_AREA_WRAP_SIZE|NS_BLOCK_SHRINK_WRAP);
|
||||
}
|
||||
|
||||
// This type of AreaFrame doesn't use its own space manager and
|
||||
|
|
Загрузка…
Ссылка в новой задаче