зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1174711
- patch 1 - Rename nsIPercentHeightObserver to nsIPercentBSizeObserver, and update related frame methods to match. r=dholbert
--HG-- rename : layout/base/nsIPercentHeightObserver.h => layout/base/nsIPercentBSizeObserver.h
This commit is contained in:
Родитель
642c1ce6d5
Коммит
10bd90547b
|
@ -77,7 +77,7 @@ EXPORTS += [
|
|||
'nsIFrameTraversal.h',
|
||||
'nsILayoutDebugger.h',
|
||||
'nsILayoutHistoryState.h',
|
||||
'nsIPercentHeightObserver.h',
|
||||
'nsIPercentBSizeObserver.h',
|
||||
'nsIPresShell.h',
|
||||
'nsIReflowCallback.h',
|
||||
'nsLayoutUtils.h',
|
||||
|
|
|
@ -3,28 +3,29 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsIPercentHeightObserver_h___
|
||||
#define nsIPercentHeightObserver_h___
|
||||
#ifndef nsIPercentBSizeObserver_h___
|
||||
#define nsIPercentBSizeObserver_h___
|
||||
|
||||
#include "nsQueryFrame.h"
|
||||
|
||||
struct nsHTMLReflowState;
|
||||
|
||||
/**
|
||||
* This interface is supported by frames that need to provide computed height
|
||||
* values to children during reflow which would otherwise not happen. Currently only
|
||||
* table cells support this.
|
||||
* This interface is supported by frames that need to provide computed bsize
|
||||
* values to children during reflow which would otherwise not happen. Currently
|
||||
* only table cells support this.
|
||||
*/
|
||||
class nsIPercentHeightObserver
|
||||
class nsIPercentBSizeObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_QUERYFRAME_TARGET(nsIPercentHeightObserver)
|
||||
NS_DECL_QUERYFRAME_TARGET(nsIPercentBSizeObserver)
|
||||
|
||||
// Notify the observer that aReflowState has no computed height, but it has a percent height
|
||||
virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0;
|
||||
// Notify the observer that aReflowState has no computed bsize,
|
||||
// but it has a percent bsize
|
||||
virtual void NotifyPercentBSize(const nsHTMLReflowState& aReflowState) = 0;
|
||||
|
||||
// Ask the observer if it should observe aReflowState.frame
|
||||
virtual bool NeedsToObserve(const nsHTMLReflowState& aReflowState) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIPercentHeightObserver_h___
|
||||
#endif // nsIPercentBSizeObserver_h___
|
|
@ -53,7 +53,7 @@
|
|||
#include "nsRange.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsIPercentHeightObserver.h"
|
||||
#include "nsIPercentBSizeObserver.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
|
||||
|
@ -4449,15 +4449,16 @@ nsFrame::DidReflow(nsPresContext* aPresContext,
|
|||
NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
}
|
||||
|
||||
// Notify the percent height observer if there is a percent height.
|
||||
// Notify the percent bsize observer if there is a percent bsize.
|
||||
// The observer may be able to initiate another reflow with a computed
|
||||
// height. This happens in the case where a table cell has no computed
|
||||
// height but can fabricate one when the cell height is known.
|
||||
if (aReflowState && aReflowState->mPercentHeightObserver &&
|
||||
// bsize. This happens in the case where a table cell has no computed
|
||||
// bsize but can fabricate one when the cell bsize is known.
|
||||
if (aReflowState && aReflowState->mPercentBSizeObserver &&
|
||||
!GetPrevInFlow()) {
|
||||
const nsStyleCoord &height = aReflowState->mStylePosition->mHeight;
|
||||
if (height.HasPercent()) {
|
||||
aReflowState->mPercentHeightObserver->NotifyPercentHeight(*aReflowState);
|
||||
const nsStyleCoord &bsize =
|
||||
aReflowState->mStylePosition->BSize(aReflowState->GetWritingMode());
|
||||
if (bsize.HasPercent()) {
|
||||
aReflowState->mPercentBSizeObserver->NotifyPercentBSize(*aReflowState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ FRAME_ID(nsIMathMLFrame)
|
|||
FRAME_ID(nsIMenuFrame)
|
||||
FRAME_ID(nsIObjectFrame)
|
||||
FRAME_ID(nsIPageSequenceFrame)
|
||||
FRAME_ID(nsIPercentHeightObserver)
|
||||
FRAME_ID(nsIPercentBSizeObserver)
|
||||
FRAME_ID(nsIRootBox)
|
||||
FRAME_ID(nsISVGChildFrame)
|
||||
FRAME_ID(nsISVGSVGFrame)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "nsImageFrame.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsIPercentHeightObserver.h"
|
||||
#include "nsIPercentBSizeObserver.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsFontInflationData.h"
|
||||
|
@ -75,7 +75,7 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
|||
mLineLayout = nullptr;
|
||||
memset(&mFlags, 0, sizeof(mFlags));
|
||||
mDiscoveredClearance = nullptr;
|
||||
mPercentHeightObserver = nullptr;
|
||||
mPercentBSizeObserver = nullptr;
|
||||
|
||||
if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
|
||||
mFlags.mDummyParentReflowState = true;
|
||||
|
@ -223,9 +223,9 @@ nsHTMLReflowState::nsHTMLReflowState(
|
|||
mFlags.mDummyParentReflowState = false;
|
||||
|
||||
mDiscoveredClearance = nullptr;
|
||||
mPercentHeightObserver = (aParentReflowState.mPercentHeightObserver &&
|
||||
aParentReflowState.mPercentHeightObserver->NeedsToObserve(*this))
|
||||
? aParentReflowState.mPercentHeightObserver : nullptr;
|
||||
mPercentBSizeObserver = (aParentReflowState.mPercentBSizeObserver &&
|
||||
aParentReflowState.mPercentBSizeObserver->NeedsToObserve(*this))
|
||||
? aParentReflowState.mPercentBSizeObserver : nullptr;
|
||||
|
||||
if ((aFlags & DUMMY_PARENT_REFLOW_STATE) ||
|
||||
(parentReflowState->mFlags.mDummyParentReflowState &&
|
||||
|
|
|
@ -18,7 +18,7 @@ class nsPresContext;
|
|||
class nsRenderingContext;
|
||||
class nsFloatManager;
|
||||
class nsLineLayout;
|
||||
class nsIPercentHeightObserver;
|
||||
class nsIPercentBSizeObserver;
|
||||
struct nsHypotheticalBox;
|
||||
|
||||
/**
|
||||
|
@ -514,8 +514,8 @@ public:
|
|||
uint8_t GetDisplay() const;
|
||||
|
||||
// a frame (e.g. nsTableCellFrame) which may need to generate a special
|
||||
// reflow for percent height calculations
|
||||
nsIPercentHeightObserver* mPercentHeightObserver;
|
||||
// reflow for percent bsize calculations
|
||||
nsIPercentBSizeObserver* mPercentBSizeObserver;
|
||||
|
||||
// CSS margin collapsing sometimes requires us to reflow
|
||||
// optimistically assuming that margins collapse to see if clearance
|
||||
|
|
|
@ -105,10 +105,10 @@ nsTableCellFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
|||
nsContainerFrame::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
// nsIPercentHeightObserver methods
|
||||
// nsIPercentBSizeObserver methods
|
||||
|
||||
void
|
||||
nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
|
||||
nsTableCellFrame::NotifyPercentBSize(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
// nsHTMLReflowState ensures the mCBReflowState of blocks inside a
|
||||
// cell is the cell frame, not the inner-cell block, and that the
|
||||
|
@ -121,17 +121,17 @@ nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
|
|||
const nsHTMLReflowState *cellRS = aReflowState.mCBReflowState;
|
||||
|
||||
if (cellRS && cellRS->frame == this &&
|
||||
(cellRS->ComputedHeight() == NS_UNCONSTRAINEDSIZE ||
|
||||
cellRS->ComputedHeight() == 0)) { // XXXldb Why 0?
|
||||
// This is a percentage height on a frame whose percentage heights
|
||||
// are based on the height of the cell, since its containing block
|
||||
(cellRS->ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
|
||||
cellRS->ComputedBSize() == 0)) { // XXXldb Why 0?
|
||||
// This is a percentage bsize on a frame whose percentage bsizes
|
||||
// are based on the bsize of the cell, since its containing block
|
||||
// is the inner cell frame.
|
||||
|
||||
// We'll only honor the percent height if sibling-cells/ancestors
|
||||
// have specified/pct height. (Also, siblings only count for this if
|
||||
// We'll only honor the percent bsize if sibling-cells/ancestors
|
||||
// have specified/pct bsize. (Also, siblings only count for this if
|
||||
// both this cell and the sibling cell span exactly 1 row.)
|
||||
|
||||
if (nsTableFrame::AncestorsHaveStyleHeight(*cellRS) ||
|
||||
if (nsTableFrame::AncestorsHaveStyleBSize(*cellRS) ||
|
||||
(GetTableFrame()->GetEffectiveRowSpan(*this) == 1 &&
|
||||
(cellRS->parentReflowState->frame->GetStateBits() &
|
||||
NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT))) {
|
||||
|
@ -142,7 +142,7 @@ nsTableCellFrame::NotifyPercentHeight(const nsHTMLReflowState& aReflowState)
|
|||
rs->frame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
|
||||
}
|
||||
|
||||
nsTableFrame::RequestSpecialHeightReflow(*cellRS);
|
||||
nsTableFrame::RequestSpecialBSizeReflow(*cellRS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ nsTableCellFrame::NeedsToObserve(const nsHTMLReflowState& aReflowState)
|
|||
return false;
|
||||
}
|
||||
|
||||
// We always need to let the percent height observer be propagated
|
||||
// We always need to let the percent bsize observer be propagated
|
||||
// from an outer table frame to an inner table frame.
|
||||
nsIAtom *fType = aReflowState.frame->GetType();
|
||||
if (fType == nsGkAtoms::tableFrame) {
|
||||
|
@ -175,6 +175,9 @@ nsTableCellFrame::NeedsToObserve(const nsHTMLReflowState& aReflowState)
|
|||
// We need the observer to be propagated to all children of the cell
|
||||
// (i.e., children of the child block) in quirks mode, but only to
|
||||
// tables in standards mode.
|
||||
// XXX This may not be true in the case of orthogonal flows within
|
||||
// the cell (bug 1174711 comment 8); we may need to observe isizes
|
||||
// instead of bsizes for orthogonal children.
|
||||
return rs->frame == this &&
|
||||
(PresContext()->CompatibilityMode() == eCompatibility_NavQuirks ||
|
||||
fType == nsGkAtoms::tableOuterFrame);
|
||||
|
@ -869,7 +872,7 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// see if a special height reflow needs to occur due to having a pct height
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||
nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
WritingMode wm = aReflowState.GetWritingMode();
|
||||
|
@ -922,13 +925,13 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
availSize.ConvertTo(kidWM, wm));
|
||||
|
||||
// Don't be a percent height observer if we're in the middle of
|
||||
// special-height reflow, in case we get an accidental NotifyPercentHeight()
|
||||
// special-height reflow, in case we get an accidental NotifyPercentBSize()
|
||||
// call (which we shouldn't honor during special-height reflow)
|
||||
if (!aReflowState.mFlags.mSpecialHeightReflow) {
|
||||
// mPercentHeightObserver is for children of cells in quirks mode,
|
||||
// mPercentBSizeObserver is for children of cells in quirks mode,
|
||||
// but only those than are tables in standards mode. NeedsToObserve
|
||||
// will determine how far this is propagated to descendants.
|
||||
kidReflowState.mPercentHeightObserver = this;
|
||||
kidReflowState.mPercentBSizeObserver = this;
|
||||
}
|
||||
// Don't propagate special height reflow state to our kids
|
||||
kidReflowState.mFlags.mSpecialHeightReflow = false;
|
||||
|
@ -1047,7 +1050,7 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
NS_QUERYFRAME_HEAD(nsTableCellFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsTableCellFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsITableCellLayout)
|
||||
NS_QUERYFRAME_ENTRY(nsIPercentHeightObserver)
|
||||
NS_QUERYFRAME_ENTRY(nsIPercentBSizeObserver)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIPercentHeightObserver.h"
|
||||
#include "nsIPercentBSizeObserver.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
class nsTableCellFrame : public nsContainerFrame,
|
||||
public nsITableCellLayout,
|
||||
public nsIPercentHeightObserver
|
||||
public nsIPercentBSizeObserver
|
||||
{
|
||||
typedef mozilla::image::DrawResult DrawResult;
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
|||
|
||||
virtual nsMargin GetUsedMargin() const override;
|
||||
|
||||
virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) override;
|
||||
virtual void NotifyPercentBSize(const nsHTMLReflowState& aReflowState) override;
|
||||
|
||||
virtual bool NeedsToObserve(const nsHTMLReflowState& aReflowState) override;
|
||||
|
||||
|
|
|
@ -1661,46 +1661,49 @@ nsTableFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
}
|
||||
|
||||
// Return true if aParentReflowState.frame or any of its ancestors within
|
||||
// the containing table have non-auto height. (e.g. pct or fixed height)
|
||||
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
|
||||
bool
|
||||
nsTableFrame::AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowState)
|
||||
nsTableFrame::AncestorsHaveStyleBSize(const nsHTMLReflowState& aParentReflowState)
|
||||
{
|
||||
WritingMode wm = aParentReflowState.GetWritingMode();
|
||||
for (const nsHTMLReflowState* rs = &aParentReflowState;
|
||||
rs && rs->frame; rs = rs->parentReflowState) {
|
||||
nsIAtom* frameType = rs->frame->GetType();
|
||||
if (IS_TABLE_CELL(frameType) ||
|
||||
(nsGkAtoms::tableRowFrame == frameType) ||
|
||||
(nsGkAtoms::tableRowGroupFrame == frameType)) {
|
||||
const nsStyleCoord &height = rs->mStylePosition->mHeight;
|
||||
const nsStyleCoord &bsize = rs->mStylePosition->BSize(wm);
|
||||
// calc() with percentages treated like 'auto' on internal table elements
|
||||
if (height.GetUnit() != eStyleUnit_Auto &&
|
||||
(!height.IsCalcUnit() || !height.HasPercent())) {
|
||||
if (bsize.GetUnit() != eStyleUnit_Auto &&
|
||||
(!bsize.IsCalcUnit() || !bsize.HasPercent())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (nsGkAtoms::tableFrame == frameType) {
|
||||
// we reached the containing table, so always return
|
||||
return rs->mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto;
|
||||
return rs->mStylePosition->BSize(wm).GetUnit() != eStyleUnit_Auto;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// See if a special height reflow needs to occur and if so, call RequestSpecialHeightReflow
|
||||
// See if a special block-size reflow needs to occur and if so,
|
||||
// call RequestSpecialBSizeReflow
|
||||
void
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
|
||||
nsTableFrame::CheckRequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
NS_ASSERTION(IS_TABLE_CELL(aReflowState.frame->GetType()) ||
|
||||
aReflowState.frame->GetType() == nsGkAtoms::tableRowFrame ||
|
||||
aReflowState.frame->GetType() == nsGkAtoms::tableRowGroupFrame ||
|
||||
aReflowState.frame->GetType() == nsGkAtoms::tableFrame,
|
||||
"unexpected frame type");
|
||||
WritingMode wm = aReflowState.GetWritingMode();
|
||||
if (!aReflowState.frame->GetPrevInFlow() && // 1st in flow
|
||||
(NS_UNCONSTRAINEDSIZE == aReflowState.ComputedHeight() || // no computed height
|
||||
0 == aReflowState.ComputedHeight()) &&
|
||||
eStyleUnit_Percent == aReflowState.mStylePosition->mHeight.GetUnit() && // pct height
|
||||
nsTableFrame::AncestorsHaveStyleHeight(*aReflowState.parentReflowState)) {
|
||||
nsTableFrame::RequestSpecialHeightReflow(aReflowState);
|
||||
(NS_UNCONSTRAINEDSIZE == aReflowState.ComputedBSize() || // no computed bsize
|
||||
0 == aReflowState.ComputedBSize()) &&
|
||||
eStyleUnit_Percent == aReflowState.mStylePosition->BSize(wm).GetUnit() && // pct bsize
|
||||
nsTableFrame::AncestorsHaveStyleBSize(*aReflowState.parentReflowState)) {
|
||||
nsTableFrame::RequestSpecialBSizeReflow(aReflowState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1710,7 +1713,7 @@ nsTableFrame::CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowSt
|
|||
// change the height of row groups, rows, cells in DistributeHeightToRows after.
|
||||
// And the row group can change the height of rows, cells in CalculateRowHeights.
|
||||
void
|
||||
nsTableFrame::RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
|
||||
nsTableFrame::RequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState)
|
||||
{
|
||||
// notify the frame and its ancestors of the special reflow, stopping at the containing table
|
||||
for (const nsHTMLReflowState* rs = &aReflowState; rs && rs->frame; rs = rs->parentReflowState) {
|
||||
|
@ -1749,12 +1752,12 @@ nsTableFrame::RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState)
|
|||
*
|
||||
* 1) Each table related frame (table, row group, row, cell) implements NeedsSpecialReflow()
|
||||
* to indicate that it should get the reflow. It does this when it has a percent height but
|
||||
* no computed height by calling CheckRequestSpecialHeightReflow(). This method calls
|
||||
* RequestSpecialHeightReflow() which calls SetNeedSpecialReflow() on its ancestors until
|
||||
* no computed height by calling CheckRequestSpecialBSizeReflow(). This method calls
|
||||
* RequestSpecialBSizeReflow() which calls SetNeedSpecialReflow() on its ancestors until
|
||||
* it reaches the containing table and calls SetNeedToInitiateSpecialReflow() on it. For
|
||||
* percent height frames inside cells, during DidReflow(), the cell's NotifyPercentHeight()
|
||||
* is called (the cell is the reflow state's mPercentHeightObserver in this case).
|
||||
* NotifyPercentHeight() calls RequestSpecialHeightReflow().
|
||||
* percent height frames inside cells, during DidReflow(), the cell's NotifyPercentBSize()
|
||||
* is called (the cell is the reflow state's mPercentBSizeObserver in this case).
|
||||
* NotifyPercentBSize() calls RequestSpecialBSizeReflow().
|
||||
*
|
||||
* 2) After the pass 2 reflow, if the table's NeedToInitiateSpecialReflow(true) was called, it
|
||||
* will do the special height reflow, setting the reflow state's mFlags.mSpecialHeightReflow
|
||||
|
@ -1814,12 +1817,12 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
CalcBCBorders();
|
||||
}
|
||||
|
||||
aDesiredSize.Width() = aReflowState.AvailableWidth();
|
||||
aDesiredSize.ISize(wm) = aReflowState.AvailableISize();
|
||||
|
||||
// Check for an overflow list, and append any row group frames being pushed
|
||||
MoveOverflowToChildList();
|
||||
|
||||
bool haveDesiredHeight = false;
|
||||
bool haveDesiredBSize = false;
|
||||
SetHaveReflowedColGroups(false);
|
||||
|
||||
// Reflow the entire table (pass 2 and possibly pass 3). This phase is necessary during a
|
||||
|
@ -1829,14 +1832,14 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (NS_SUBTREE_DIRTY(this) ||
|
||||
aReflowState.ShouldReflowAllKids() ||
|
||||
IsGeometryDirty() ||
|
||||
aReflowState.IsVResize()) {
|
||||
aReflowState.IsBResize()) {
|
||||
|
||||
if (aReflowState.ComputedHeight() != NS_UNCONSTRAINEDSIZE ||
|
||||
// Also check mVResize, to handle the first Reflow preceding a
|
||||
// special height Reflow, when we've already had a special height
|
||||
// Reflow (where mComputedHeight would not be
|
||||
if (aReflowState.ComputedBSize() != NS_UNCONSTRAINEDSIZE ||
|
||||
// Also check IsBResize, to handle the first Reflow preceding a
|
||||
// special height Reflow, when we've already had a special bsize
|
||||
// Reflow (where ComputedBSize would not be
|
||||
// NS_UNCONSTRAINEDSIZE, but without a style change in between).
|
||||
aReflowState.IsVResize()) {
|
||||
aReflowState.IsBResize()) {
|
||||
// XXX Eventually, we should modify DistributeHeightToRows to use
|
||||
// nsTableRowFrame::GetHeight instead of nsIFrame::GetSize().height.
|
||||
// That way, it will make its calculations based on internal table
|
||||
|
@ -1849,11 +1852,12 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
bool needToInitiateSpecialReflow =
|
||||
!!(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE);
|
||||
// see if an extra reflow will be necessary in pagination mode when there is a specified table height
|
||||
if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableHeight())) {
|
||||
nscoord tableSpecifiedHeight = CalcBorderBoxHeight(aReflowState);
|
||||
if ((tableSpecifiedHeight > 0) &&
|
||||
(tableSpecifiedHeight != NS_UNCONSTRAINEDSIZE)) {
|
||||
// see if an extra reflow will be necessary in pagination mode
|
||||
// when there is a specified table bsize
|
||||
if (isPaginated && !GetPrevInFlow() && (NS_UNCONSTRAINEDSIZE != aReflowState.AvailableBSize())) {
|
||||
nscoord tableSpecifiedBSize = CalcBorderBoxHeight(aReflowState);
|
||||
if ((tableSpecifiedBSize > 0) &&
|
||||
(tableSpecifiedBSize != NS_UNCONSTRAINEDSIZE)) {
|
||||
needToInitiateSpecialReflow = true;
|
||||
}
|
||||
}
|
||||
|
@ -1868,15 +1872,16 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// if we need to initiate a special height reflow, then don't constrain the
|
||||
// height of the reflow before that
|
||||
nscoord availHeight = needToInitiateSpecialReflow
|
||||
? NS_UNCONSTRAINEDSIZE : aReflowState.AvailableHeight();
|
||||
nscoord availBSize = needToInitiateSpecialReflow
|
||||
? NS_UNCONSTRAINEDSIZE : aReflowState.AvailableBSize();
|
||||
|
||||
ReflowTable(aDesiredSize, aReflowState, availHeight,
|
||||
ReflowTable(aDesiredSize, aReflowState, availBSize,
|
||||
lastChildReflowed, aStatus);
|
||||
|
||||
// reevaluate special height reflow conditions
|
||||
if (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE)
|
||||
// reevaluate special bsize reflow conditions
|
||||
if (GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE) {
|
||||
needToInitiateSpecialReflow = true;
|
||||
}
|
||||
|
||||
// XXXldb Are all these conditions correct?
|
||||
if (needToInitiateSpecialReflow && NS_FRAME_IS_COMPLETE(aStatus)) {
|
||||
|
@ -1889,16 +1894,18 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
CalcDesiredHeight(aReflowState, aDesiredSize);
|
||||
mutable_rs.mFlags.mSpecialHeightReflow = true;
|
||||
|
||||
ReflowTable(aDesiredSize, aReflowState, aReflowState.AvailableHeight(),
|
||||
ReflowTable(aDesiredSize, aReflowState, aReflowState.AvailableBSize(),
|
||||
lastChildReflowed, aStatus);
|
||||
|
||||
if (lastChildReflowed && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
|
||||
// if there is an incomplete child, then set the desired height to include it but not the next one
|
||||
// if there is an incomplete child, then set the desired bsize
|
||||
// to include it but not the next one
|
||||
LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
|
||||
aDesiredSize.Height() = borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
|
||||
lastChildReflowed->GetNormalRect().YMost();
|
||||
aDesiredSize.BSize(wm) =
|
||||
borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
|
||||
lastChildReflowed->GetNormalRect().YMost(); // XXX YMost should be B-flavored
|
||||
}
|
||||
haveDesiredHeight = true;
|
||||
haveDesiredBSize = true;
|
||||
|
||||
mutable_rs.mFlags.mSpecialHeightReflow = false;
|
||||
}
|
||||
|
@ -1910,20 +1917,20 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
aDesiredSize.Width() = aReflowState.ComputedWidth() +
|
||||
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
|
||||
if (!haveDesiredHeight) {
|
||||
aDesiredSize.ISize(wm) = aReflowState.ComputedISize() +
|
||||
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm);
|
||||
if (!haveDesiredBSize) {
|
||||
CalcDesiredHeight(aReflowState, aDesiredSize);
|
||||
}
|
||||
if (IsRowInserted()) {
|
||||
ProcessRowInserted(aDesiredSize.Height());
|
||||
ProcessRowInserted(aDesiredSize.BSize(wm));
|
||||
}
|
||||
|
||||
LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
|
||||
SetColumnDimensions(aDesiredSize.Height(), wm, borderPadding,
|
||||
SetColumnDimensions(aDesiredSize.BSize(wm), wm, borderPadding,
|
||||
aDesiredSize.Width());
|
||||
if (NeedToCollapse() &&
|
||||
(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableWidth())) {
|
||||
(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableISize())) {
|
||||
AdjustForCollapsingRowsCols(aDesiredSize, wm, borderPadding);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,16 +158,16 @@ public:
|
|||
static float GetTwipsToPixels(nsPresContext* aPresContext);
|
||||
|
||||
// Return true if aParentReflowState.frame or any of its ancestors within
|
||||
// the containing table have non-auto height. (e.g. pct or fixed height)
|
||||
static bool AncestorsHaveStyleHeight(const nsHTMLReflowState& aParentReflowState);
|
||||
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
|
||||
static bool AncestorsHaveStyleBSize(const nsHTMLReflowState& aParentReflowState);
|
||||
|
||||
// See if a special height reflow will occur due to having a pct height when
|
||||
// the pct height basis may not yet be valid.
|
||||
static void CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
||||
// See if a special height reflow will occur due to having a pct bsize when
|
||||
// the pct bsize basis may not yet be valid.
|
||||
static void CheckRequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState);
|
||||
|
||||
// Notify the frame and its ancestors (up to the containing table) that a special
|
||||
// height reflow will occur.
|
||||
static void RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
||||
static void RequestSpecialBSizeReflow(const nsHTMLReflowState& aReflowState);
|
||||
|
||||
static void RePositionViews(nsIFrame* aFrame);
|
||||
|
||||
|
|
|
@ -783,9 +783,9 @@ nsTableOuterFrame::UpdateReflowMetrics(uint8_t aCaptionSide,
|
|||
|
||||
void
|
||||
nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
nsReflowStatus& aStatus)
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
MarkInReflow();
|
||||
DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame");
|
||||
|
|
|
@ -1085,7 +1085,7 @@ nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// see if a special height reflow needs to occur due to having a pct height
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||
nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
|
||||
|
||||
// See if we have a cell with specified/pct bsize
|
||||
InitHasCellWithStyleBSize(tableFrame);
|
||||
|
|
|
@ -1331,7 +1331,7 @@ nsTableRowGroupFrame::Reflow(nsPresContext* aPresContext,
|
|||
ClearRowCursor();
|
||||
|
||||
// see if a special height reflow needs to occur due to having a pct height
|
||||
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
||||
nsTableFrame::CheckRequestSpecialBSizeReflow(aReflowState);
|
||||
|
||||
nsTableFrame* tableFrame = GetTableFrame();
|
||||
nsRowGroupReflowState state(aReflowState, tableFrame);
|
||||
|
|
Загрузка…
Ссылка в новой задаче