2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* 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/. */
|
2006-03-29 22:29:03 +04:00
|
|
|
|
|
|
|
/* base class of all rendering objects */
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsFrame_h___
|
|
|
|
#define nsFrame_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2012-10-26 17:32:10 +04:00
|
|
|
#include "mozilla/Likely.h"
|
2004-09-28 22:37:50 +04:00
|
|
|
#include "nsBox.h"
|
2015-05-19 21:15:34 +03:00
|
|
|
#include "mozilla/Logging.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-12-05 02:49:50 +03:00
|
|
|
#include "nsIPresShell.h"
|
2016-07-21 13:36:34 +03:00
|
|
|
#include "mozilla/ReflowInput.h"
|
2011-01-20 01:39:31 +03:00
|
|
|
#include "nsHTMLParts.h"
|
2013-08-22 22:32:52 +04:00
|
|
|
#include "nsISelectionDisplay.h"
|
1999-12-05 02:49:50 +03:00
|
|
|
|
1998-05-20 20:24:36 +04:00
|
|
|
/**
|
|
|
|
* nsFrame logging constants. We redefine the nspr
|
|
|
|
* PRLogModuleInfo.level field to be a bitfield. Each bit controls a
|
|
|
|
* specific type of logging. Each logging operation has associated
|
|
|
|
* inline methods defined below.
|
2017-04-05 00:36:21 +03:00
|
|
|
*
|
|
|
|
* Due to the redefinition of the level field we cannot use MOZ_LOG directly
|
|
|
|
* as that will cause assertions due to invalid log levels.
|
1998-05-20 20:24:36 +04:00
|
|
|
*/
|
|
|
|
#define NS_FRAME_TRACE_CALLS 0x1
|
|
|
|
#define NS_FRAME_TRACE_PUSH_PULL 0x2
|
|
|
|
#define NS_FRAME_TRACE_CHILD_REFLOW 0x4
|
1998-06-25 20:33:10 +04:00
|
|
|
#define NS_FRAME_TRACE_NEW_FRAMES 0x8
|
1998-05-20 20:24:36 +04:00
|
|
|
|
2015-11-06 01:35:03 +03:00
|
|
|
#define NS_FRAME_LOG_TEST(_lm,_bit) (int(((mozilla::LogModule*)_lm)->Level()) & (_bit))
|
1998-05-20 20:24:36 +04:00
|
|
|
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
1998-05-20 20:24:36 +04:00
|
|
|
#define NS_FRAME_LOG(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
2015-11-06 01:35:03 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
|
2017-04-05 00:36:21 +03:00
|
|
|
printf_stderr _args; \
|
1998-05-20 20:24:36 +04:00
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
#else
|
|
|
|
#define NS_FRAME_LOG(_bit,_args)
|
|
|
|
#endif
|
|
|
|
|
1998-06-25 20:33:10 +04:00
|
|
|
// XXX Need to rework this so that logging is free when it's off
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
2011-10-17 18:59:28 +04:00
|
|
|
#define NS_FRAME_TRACE_IN(_method) Trace(_method, true)
|
1998-06-25 20:33:10 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
#define NS_FRAME_TRACE_OUT(_method) Trace(_method, false)
|
1998-06-25 20:33:10 +04:00
|
|
|
|
|
|
|
// XXX remove me
|
|
|
|
#define NS_FRAME_TRACE_MSG(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
2015-11-06 01:35:03 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
|
1998-06-25 20:33:10 +04:00
|
|
|
TraceMsg _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
|
|
|
#define NS_FRAME_TRACE(_bit,_args) \
|
|
|
|
PR_BEGIN_MACRO \
|
2015-11-06 01:35:03 +03:00
|
|
|
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
|
1998-06-25 20:33:10 +04:00
|
|
|
TraceMsg _args; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
#define NS_FRAME_TRACE_REFLOW_IN(_method) Trace(_method, true)
|
1998-06-25 20:33:10 +04:00
|
|
|
|
1998-05-20 20:24:36 +04:00
|
|
|
#define NS_FRAME_TRACE_REFLOW_OUT(_method, _status) \
|
2011-10-17 18:59:28 +04:00
|
|
|
Trace(_method, false, _status)
|
1998-06-25 20:33:10 +04:00
|
|
|
|
1998-05-20 20:24:36 +04:00
|
|
|
#else
|
1998-07-08 02:07:35 +04:00
|
|
|
#define NS_FRAME_TRACE(_bits,_args)
|
1998-05-20 20:24:36 +04:00
|
|
|
#define NS_FRAME_TRACE_IN(_method)
|
|
|
|
#define NS_FRAME_TRACE_OUT(_method)
|
1998-06-25 20:33:10 +04:00
|
|
|
#define NS_FRAME_TRACE_MSG(_bits,_args)
|
1998-05-20 20:24:36 +04:00
|
|
|
#define NS_FRAME_TRACE_REFLOW_IN(_method)
|
|
|
|
#define NS_FRAME_TRACE_REFLOW_OUT(_method, _status)
|
|
|
|
#endif
|
|
|
|
|
2015-11-04 12:57:35 +03:00
|
|
|
// Frame allocation boilerplate macros. Every subclass of nsFrame must
|
|
|
|
// either use NS_{DECL,IMPL}_FRAMEARENA_HELPERS pair for allocating
|
|
|
|
// memory correctly, or use NS_DECL_ABSTRACT_FRAME to declare a frame
|
|
|
|
// class abstract and stop it from being instantiated. If a frame class
|
|
|
|
// without its own operator new and GetFrameId gets instantiated, the
|
|
|
|
// per-frame recycler lists in nsPresArena will not work correctly,
|
|
|
|
// with potentially catastrophic consequences (not enough memory is
|
|
|
|
// allocated for a frame object).
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2017-05-26 13:11:11 +03:00
|
|
|
#define NS_DECL_FRAMEARENA_HELPERS(class) \
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(class) \
|
2017-05-26 13:11:11 +03:00
|
|
|
static constexpr nsIFrame::ClassID kClassID = nsIFrame::ClassID::class##_id; \
|
2017-05-26 13:11:11 +03:00
|
|
|
void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE; \
|
|
|
|
nsQueryFrame::FrameIID GetFrameId() override MOZ_MUST_OVERRIDE { \
|
|
|
|
return nsQueryFrame::class##_id; \
|
|
|
|
}
|
2009-09-12 20:49:24 +04:00
|
|
|
|
|
|
|
#define NS_IMPL_FRAMEARENA_HELPERS(class) \
|
|
|
|
void* class::operator new(size_t sz, nsIPresShell* aShell) \
|
2009-09-16 02:00:04 +04:00
|
|
|
{ return aShell->AllocateFrame(nsQueryFrame::class##_id, sz); } \
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2015-11-04 12:57:35 +03:00
|
|
|
#define NS_DECL_ABSTRACT_FRAME(class) \
|
|
|
|
void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE = delete; \
|
|
|
|
virtual nsQueryFrame::FrameIID GetFrameId() override MOZ_MUST_OVERRIDE = 0;
|
|
|
|
|
1998-05-20 20:24:36 +04:00
|
|
|
//----------------------------------------------------------------------
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
struct nsBoxLayoutMetrics;
|
2013-09-07 06:15:49 +04:00
|
|
|
struct nsRect;
|
2004-09-28 22:37:50 +04:00
|
|
|
|
1998-10-17 00:09:32 +04:00
|
|
|
/**
|
|
|
|
* Implementation of a simple frame that's not splittable and has no
|
|
|
|
* child frames.
|
|
|
|
*
|
|
|
|
* Sets the NS_FRAME_SYNCHRONIZE_FRAME_AND_VIEW bit, so the default
|
|
|
|
* behavior is to keep the frame and view position and size in sync.
|
|
|
|
*/
|
2004-09-28 22:37:50 +04:00
|
|
|
class nsFrame : public nsBox
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new "empty" frame that maps a given piece of content into a
|
|
|
|
* 0,0 area.
|
|
|
|
*/
|
2009-08-18 07:21:06 +04:00
|
|
|
friend nsIFrame* NS_NewEmptyFrame(nsIPresShell* aShell,
|
|
|
|
nsStyleContext* aContext);
|
1999-12-05 02:49:50 +03:00
|
|
|
|
1999-12-05 05:24:02 +03:00
|
|
|
private:
|
2009-08-18 07:21:06 +04:00
|
|
|
// Left undefined; nsFrame objects are never allocated from the heap.
|
|
|
|
void* operator new(size_t sz) CPP_THROW_NEW;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// Overridden to prevent the global delete from being called, since
|
|
|
|
// the memory came out of an arena instead of the heap.
|
|
|
|
//
|
|
|
|
// Ideally this would be private and undefined, like the normal
|
|
|
|
// operator new. Unfortunately, the C++ standard requires an
|
|
|
|
// overridden operator delete to be accessible to any subclass that
|
|
|
|
// defines a virtual destructor, so we can only make it protected;
|
|
|
|
// worse, some C++ compilers will synthesize calls to this function
|
|
|
|
// from the "deleting destructors" that they emit in case of
|
|
|
|
// delete-expressions, so it can't even be undefined.
|
|
|
|
void operator delete(void* aPtr, size_t sz);
|
1999-12-05 02:49:50 +03:00
|
|
|
|
|
|
|
public:
|
1999-02-26 20:05:20 +03:00
|
|
|
|
2009-01-12 22:20:59 +03:00
|
|
|
// nsQueryFrame
|
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsFrame)
|
|
|
|
virtual nsQueryFrame::FrameIID GetFrameId() MOZ_MUST_OVERRIDE {
|
|
|
|
return kFrameIID;
|
|
|
|
}
|
2015-01-06 23:15:20 +03:00
|
|
|
void* operator new(size_t, nsIPresShell*) MOZ_MUST_OVERRIDE;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-02 09:28:11 +04:00
|
|
|
// nsIFrame
|
2017-01-18 03:27:03 +03:00
|
|
|
void Init(nsIContent* aContent,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsContainerFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
void DestroyFrom(nsIFrame* aDestructRoot) override;
|
|
|
|
nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const override;
|
|
|
|
void SetAdditionalStyleContext(int32_t aIndex,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsStyleContext* aStyleContext) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
|
|
|
const nsFrameList& GetChildList(ChildListID aListID) const override;
|
|
|
|
void GetChildLists(nsTArray<ChildList>* aLists) const override;
|
2011-08-25 00:54:29 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult HandleEvent(nsPresContext* aPresContext,
|
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsIContent** aContent) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetCursor(const nsPoint& aPoint,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsIFrame::Cursor& aCursor) override;
|
1999-02-12 03:02:31 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetPointFromOffset(int32_t inOffset,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsPoint* outPoint) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetCharacterRectsInRange(int32_t aInOffset,
|
2017-01-18 03:27:03 +03:00
|
|
|
int32_t aLength,
|
|
|
|
nsTArray<nsRect>& aOutRect) override;
|
1999-02-12 03:02:31 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
|
2017-01-18 03:27:03 +03:00
|
|
|
bool inHint,
|
|
|
|
int32_t* outFrameContentOffset,
|
|
|
|
nsIFrame** outChildFrame) override;
|
1999-02-12 03:02:31 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
static nsresult GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsPeekOffsetStruct *aPos,
|
|
|
|
nsIFrame *aBlockFrame,
|
|
|
|
int32_t aLineStart,
|
|
|
|
int8_t aOutSideLimit);
|
2006-06-16 05:54:31 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult CharacterDataChanged(CharacterDataChangeInfo* aInfo) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult AttributeChanged(int32_t aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
int32_t aModType) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
nsSplittableType GetSplittableType() const override;
|
|
|
|
nsIFrame* GetPrevContinuation() const override;
|
|
|
|
void SetPrevContinuation(nsIFrame*) override;
|
|
|
|
nsIFrame* GetNextContinuation() const override;
|
|
|
|
void SetNextContinuation(nsIFrame*) override;
|
|
|
|
nsIFrame* GetPrevInFlowVirtual() const override;
|
|
|
|
void SetPrevInFlow(nsIFrame*) override;
|
|
|
|
nsIFrame* GetNextInFlowVirtual() const override;
|
|
|
|
void SetNextInFlow(nsIFrame*) override;
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetSelectionController(nsPresContext *aPresContext,
|
|
|
|
nsISelectionController **aSelCon) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
FrameSearchResult PeekOffsetNoAmount(bool aForward,
|
|
|
|
int32_t* aOffset) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
|
2017-01-18 03:27:03 +03:00
|
|
|
bool aRespectClusters = true) override;
|
|
|
|
FrameSearchResult PeekOffsetWord(bool aForward, bool aWordSelectEatSpace,
|
|
|
|
bool aIsKeyboardSelect,
|
|
|
|
int32_t* aOffset,
|
|
|
|
PeekWordState *aState) override;
|
2007-08-30 07:10:19 +04:00
|
|
|
/**
|
|
|
|
* Check whether we should break at a boundary between punctuation and
|
2008-03-03 11:37:34 +03:00
|
|
|
* non-punctuation. Only call it at a punctuation boundary
|
|
|
|
* (i.e. exactly one of the previous and next characters are punctuation).
|
|
|
|
* @param aForward true if we're moving forward in content order
|
|
|
|
* @param aPunctAfter true if the next character is punctuation
|
|
|
|
* @param aWhitespaceAfter true if the next character is whitespace
|
2007-08-30 07:10:19 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
bool BreakWordBetweenPunctuation(const PeekWordState* aState,
|
2017-01-18 03:27:03 +03:00
|
|
|
bool aForward,
|
|
|
|
bool aPunctAfter, bool aWhitespaceAfter,
|
|
|
|
bool aIsKeyboardSelect);
|
2008-03-03 11:37:34 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult CheckVisibility(nsPresContext* aContext,
|
|
|
|
int32_t aStartIndex, int32_t aEndIndex,
|
|
|
|
bool aRecurse, bool *aFinished,
|
|
|
|
bool *_retval) override;
|
2000-07-26 15:31:12 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetOffsets(int32_t &aStart, int32_t &aEnd) const override;
|
2017-01-18 03:27:03 +03:00
|
|
|
void ChildIsDirty(nsIFrame* aChild) override;
|
1999-02-18 06:25:23 +03:00
|
|
|
|
2001-08-17 07:13:07 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::a11y::AccType AccessibleType() override;
|
2001-08-17 07:13:07 +04:00
|
|
|
#endif
|
2001-05-18 03:52:32 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsStyleContext* GetParentStyleContext(nsIFrame** aProviderFrame) const override {
|
2014-11-20 21:24:10 +03:00
|
|
|
return DoGetParentStyleContext(aProviderFrame);
|
2011-09-12 20:08:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Do the work for getting the parent style context frame so that
|
2014-11-20 21:24:10 +03:00
|
|
|
* other frame's |GetParentStyleContext| methods can call this
|
2011-09-12 20:08:07 +04:00
|
|
|
* method on *another* frame. (This function handles out-of-flow
|
|
|
|
* frames by using the frame manager's placeholder map and it also
|
|
|
|
* handles block-within-inline and generated content wrappers.)
|
2014-11-20 21:24:10 +03:00
|
|
|
*
|
|
|
|
* @param aProviderFrame (out) the frame associated with the returned value
|
|
|
|
* or null if the style context is for display:contents content.
|
|
|
|
* @return The style context that should be the parent of this frame's
|
|
|
|
* style context. Null is permitted, and means that this frame's
|
|
|
|
* style context should be the root of the style context tree.
|
2011-09-12 20:08:07 +04:00
|
|
|
*/
|
2014-11-20 21:24:10 +03:00
|
|
|
nsStyleContext* DoGetParentStyleContext(nsIFrame** aProviderFrame) const;
|
2000-09-13 02:47:09 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
bool IsEmpty() override;
|
|
|
|
bool IsSelfEmpty() override;
|
2001-10-25 05:08:40 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void MarkIntrinsicISizesDirty() override;
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord GetMinISize(gfxContext *aRenderingContext) override;
|
|
|
|
nscoord GetPrefISize(gfxContext *aRenderingContext) override;
|
|
|
|
void AddInlineMinISize(gfxContext *aRenderingContext,
|
2017-01-18 03:27:03 +03:00
|
|
|
InlineMinISizeData *aData) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
void AddInlinePrefISize(gfxContext *aRenderingContext,
|
2017-01-18 03:27:03 +03:00
|
|
|
InlinePrefISizeData *aData) override;
|
2017-01-18 03:27:03 +03:00
|
|
|
IntrinsicISizeOffsetData IntrinsicISizeOffsets() override;
|
|
|
|
mozilla::IntrinsicSize GetIntrinsicSize() override;
|
|
|
|
nsSize GetIntrinsicRatio() override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
mozilla::LogicalSize
|
2017-06-09 22:14:53 +03:00
|
|
|
ComputeSize(gfxContext* aRenderingContext,
|
2016-11-05 04:57:06 +03:00
|
|
|
mozilla::WritingMode aWM,
|
2014-08-24 18:34:44 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aAvailableISize,
|
2014-08-24 18:34:44 +04:00
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeSizeFlags aFlags) override;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2016-11-05 04:57:06 +03:00
|
|
|
/**
|
|
|
|
* Calculate the used values for 'width' and 'height' for a replaced element.
|
|
|
|
* http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
|
|
|
|
*/
|
|
|
|
mozilla::LogicalSize
|
|
|
|
ComputeSizeWithIntrinsicDimensions(
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRenderingContext,
|
2016-11-05 04:57:06 +03:00
|
|
|
mozilla::WritingMode aWM,
|
|
|
|
const mozilla::IntrinsicSize& aIntrinsicSize,
|
|
|
|
nsSize aIntrinsicRatio,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
2016-11-05 04:57:06 +03:00
|
|
|
const mozilla::LogicalSize& aPadding,
|
|
|
|
ComputeSizeFlags aFlags);
|
2016-11-05 04:57:06 +03:00
|
|
|
|
2007-10-12 12:30:54 +04:00
|
|
|
// Compute tight bounds assuming this frame honours its border, background
|
|
|
|
// and outline, its children's tight bounds, and nothing else.
|
2015-12-16 00:56:41 +03:00
|
|
|
nsRect ComputeSimpleTightBounds(mozilla::gfx::DrawTarget* aDrawTarget) const;
|
2007-10-12 12:30:54 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/**
|
|
|
|
* A helper, used by |nsFrame::ComputeSize| (for frames that need to
|
|
|
|
* override only this part of ComputeSize), that computes the size
|
|
|
|
* that should be returned when 'width', 'height', and
|
|
|
|
* min/max-width/height are all 'auto' or equivalent.
|
|
|
|
*
|
|
|
|
* In general, frames that can accept any computed width/height should
|
|
|
|
* override only ComputeAutoSize, and frames that cannot do so need to
|
|
|
|
* override ComputeSize to enforce their width/height invariants.
|
|
|
|
*
|
|
|
|
* Implementations may optimize by returning a garbage width if
|
2013-02-17 01:51:02 +04:00
|
|
|
* StylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
* likewise for height, since in such cases the result is guaranteed
|
|
|
|
* to be unused.
|
|
|
|
*/
|
2014-08-24 18:34:51 +04:00
|
|
|
virtual mozilla::LogicalSize
|
2017-06-09 22:14:53 +03:00
|
|
|
ComputeAutoSize(gfxContext* aRenderingContext,
|
2016-11-05 04:57:06 +03:00
|
|
|
mozilla::WritingMode aWM,
|
2014-08-24 18:34:51 +04:00
|
|
|
const mozilla::LogicalSize& aCBSize,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aAvailableISize,
|
2014-08-24 18:34:51 +04:00
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2016-11-05 04:57:06 +03:00
|
|
|
ComputeSizeFlags aFlags);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Utility function for ComputeAutoSize implementations. Return
|
2016-11-05 04:57:06 +03:00
|
|
|
* max(GetMinISize(), min(aISizeInCB, GetPrefISize()))
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
*/
|
2017-06-09 22:14:53 +03:00
|
|
|
nscoord ShrinkWidthToFit(gfxContext* aRenderingContext,
|
2016-11-05 04:57:06 +03:00
|
|
|
nscoord aISizeInCB,
|
|
|
|
ComputeSizeFlags aFlags);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
2012-08-29 12:01:09 +04:00
|
|
|
/**
|
|
|
|
* Calculates the size of this frame after reflowing (calling Reflow on, and
|
|
|
|
* updating the size and position of) its children, as necessary. The
|
2016-07-21 13:36:38 +03:00
|
|
|
* calculated size is returned to the caller via the ReflowOutput
|
2012-08-29 12:01:09 +04:00
|
|
|
* outparam. (The caller is responsible for setting the actual size and
|
|
|
|
* position of this frame.)
|
|
|
|
*
|
|
|
|
* A frame's children must _all_ be reflowed if the frame is dirty (the
|
|
|
|
* NS_FRAME_IS_DIRTY bit is set on it). Otherwise, individual children
|
|
|
|
* must be reflowed if they are dirty or have the NS_FRAME_HAS_DIRTY_CHILDREN
|
|
|
|
* bit set on them. Otherwise, whether children need to be reflowed depends
|
|
|
|
* on the frame's type (it's up to individual Reflow methods), and on what
|
|
|
|
* has changed. For example, a change in the width of the frame may require
|
|
|
|
* all of its children to be reflowed (even those without dirty bits set on
|
|
|
|
* them), whereas a change in its height might not.
|
2016-07-21 13:36:35 +03:00
|
|
|
* (ReflowInput::ShouldReflowAllKids may be helpful in deciding whether
|
2012-08-29 12:01:09 +04:00
|
|
|
* to reflow all the children, but for some frame types it might result in
|
|
|
|
* over-reflow.)
|
|
|
|
*
|
|
|
|
* Note: if it's only the overflow rect(s) of a frame that need to be
|
|
|
|
* updated, then UpdateOverflow should be called instead of Reflow.
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
void Reflow(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
|
|
|
const ReflowInput& aReflowInput,
|
|
|
|
nsReflowStatus& aStatus) override;
|
|
|
|
void DidReflow(nsPresContext* aPresContext,
|
|
|
|
const ReflowInput* aReflowInput,
|
|
|
|
nsDidReflowStatus aStatus) override;
|
2013-02-24 04:06:55 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* NOTE: aStatus is assumed to be already-initialized. The reflow statuses of
|
|
|
|
* any reflowed absolute children will be merged into aStatus; aside from
|
|
|
|
* that, this method won't modify aStatus.
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
void ReflowAbsoluteFrames(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
bool aConstrainBSize = true);
|
|
|
|
void FinishReflowWithAbsoluteFrames(nsPresContext* aPresContext,
|
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2017-01-18 03:27:03 +03:00
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
bool aConstrainBSize = true);
|
2014-08-21 04:48:56 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If this frame is dirty, marks all absolutely-positioned children of this
|
|
|
|
* frame dirty. If this frame isn't dirty, or if there are no
|
|
|
|
* absolutely-positioned children, does nothing.
|
|
|
|
*
|
|
|
|
* It's necessary to use PushDirtyBitToAbsoluteFrames() when you plan to
|
|
|
|
* reflow this frame's absolutely-positioned children after the dirty bit on
|
2016-07-21 13:36:35 +03:00
|
|
|
* this frame has already been cleared, which prevents ReflowInput from
|
2014-08-21 04:48:56 +04:00
|
|
|
* propagating the dirty bit normally. This situation generally only arises
|
|
|
|
* when a multipass layout algorithm is used.
|
|
|
|
*/
|
|
|
|
void PushDirtyBitToAbsoluteFrames();
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
bool CanContinueTextRun() const override;
|
1998-10-01 08:46:11 +04:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2016-05-04 03:27:43 +03:00
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
void UnionChildOverflow(nsOverflowAreas& aOverflowAreas) override;
|
2011-06-16 01:03:49 +04:00
|
|
|
|
1998-10-08 22:21:32 +04:00
|
|
|
// Selection Methods
|
2012-09-11 01:02:23 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandlePress(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
1998-08-28 19:58:37 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleMultiplePress(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
bool aControlHeld);
|
1999-05-17 04:21:18 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleDrag(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
1998-08-28 19:58:37 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD HandleRelease(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
1998-08-28 19:58:37 +04:00
|
|
|
|
2012-09-11 01:02:23 +04:00
|
|
|
enum { SELECT_ACCUMULATE = 0x01 };
|
|
|
|
|
|
|
|
nsresult PeekBackwardAndForward(nsSelectionAmount aAmountBack,
|
|
|
|
nsSelectionAmount aAmountForward,
|
|
|
|
int32_t aStartPos,
|
|
|
|
bool aJumpLines,
|
|
|
|
uint32_t aSelectFlags);
|
1999-09-30 00:04:05 +04:00
|
|
|
|
2012-09-11 01:02:23 +04:00
|
|
|
nsresult SelectByTypeAtPoint(nsPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsSelectionAmount aBeginAmountType,
|
|
|
|
nsSelectionAmount aEndAmountType,
|
|
|
|
uint32_t aSelectFlags);
|
1999-09-30 00:04:05 +04:00
|
|
|
|
2006-02-27 08:57:37 +03:00
|
|
|
// Helper for GetContentAndOffsetsFromPoint; calculation of content offsets
|
|
|
|
// in this function assumes there is no child frame that can be targeted.
|
|
|
|
virtual ContentOffsets CalcContentOffsetsFromFramePoint(nsPoint aPoint);
|
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
// Box layout methods
|
2017-01-18 03:27:03 +03:00
|
|
|
nsSize GetXULPrefSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
nsSize GetXULMaxSize(nsBoxLayoutState& aBoxLayoutState) override;
|
|
|
|
nscoord GetXULFlex() override;
|
|
|
|
nscoord GetXULBoxAscent(nsBoxLayoutState& aBoxLayoutState) override;
|
2004-09-28 22:37:50 +04:00
|
|
|
|
2009-08-18 07:21:06 +04:00
|
|
|
// We compute and store the HTML content's overflow area. So don't
|
|
|
|
// try to compute it in the box code.
|
2017-01-18 03:27:03 +03:00
|
|
|
bool ComputesOwnOverflowArea() override { return true; }
|
2009-08-18 07:21:06 +04:00
|
|
|
|
1998-06-06 01:06:24 +04:00
|
|
|
//--------------------------------------------------
|
|
|
|
// Additional methods
|
1998-06-04 02:49:45 +04:00
|
|
|
|
2011-01-12 04:09:22 +03:00
|
|
|
// Helper function that tests if the frame tree is too deep; if it is
|
|
|
|
// it marks the frame as "unflowable", zeroes out the metrics, sets
|
2011-10-17 18:59:28 +04:00
|
|
|
// the reflow status, and returns true. Otherwise, the frame is
|
2011-01-12 04:09:22 +03:00
|
|
|
// unmarked "unflowable" and the metrics and reflow status are not
|
2011-10-17 18:59:28 +04:00
|
|
|
// touched and false is returned.
|
2016-07-21 13:36:39 +03:00
|
|
|
bool IsFrameTreeTooDeep(const ReflowInput& aReflowInput,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aMetrics,
|
2011-01-12 04:09:22 +03:00
|
|
|
nsReflowStatus& aStatus);
|
1999-08-28 01:48:06 +04:00
|
|
|
|
2010-10-07 08:25:45 +04:00
|
|
|
// Incorporate the child overflow areas into aOverflowAreas.
|
|
|
|
// If the child does not have a overflow, use the child area.
|
|
|
|
void ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
|
2004-12-27 18:05:18 +03:00
|
|
|
nsIFrame* aChildFrame);
|
2003-09-13 20:21:41 +04:00
|
|
|
|
2012-11-08 20:09:38 +04:00
|
|
|
/**
|
|
|
|
* @return true if we should avoid a page/column break in this frame.
|
|
|
|
*/
|
2016-07-21 13:36:39 +03:00
|
|
|
bool ShouldAvoidBreakInside(const ReflowInput& aReflowInput) const {
|
|
|
|
return !aReflowInput.mFlags.mIsTopOfPage &&
|
2013-02-17 01:51:02 +04:00
|
|
|
NS_STYLE_PAGE_BREAK_AVOID == StyleDisplay()->mBreakInside &&
|
2012-11-08 20:09:38 +04:00
|
|
|
!GetPrevInFlow();
|
|
|
|
}
|
|
|
|
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
1998-05-20 20:24:36 +04:00
|
|
|
/**
|
|
|
|
* Tracing method that writes a method enter/exit routine to the
|
|
|
|
* nspr log using the nsIFrame log module. The tracing is only
|
|
|
|
* done when the NS_FRAME_TRACE_CALLS bit is set in the log module's
|
|
|
|
* level field.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void Trace(const char* aMethod, bool aEnter);
|
|
|
|
void Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus);
|
2016-12-10 03:03:53 +03:00
|
|
|
void TraceMsg(const char* fmt, ...) MOZ_FORMAT_PRINTF(2, 3);
|
1999-07-24 06:37:06 +04:00
|
|
|
|
|
|
|
// Helper function that verifies that each frame in the list has the
|
|
|
|
// NS_FRAME_IS_DIRTY bit set
|
2009-07-28 16:53:20 +04:00
|
|
|
static void VerifyDirtyBitSet(const nsFrameList& aFrameList);
|
1998-05-20 20:24:36 +04:00
|
|
|
|
2004-05-04 20:27:40 +04:00
|
|
|
static void XMLQuote(nsString& aString);
|
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
/**
|
|
|
|
* Dump out the "base classes" regression data. This should dump
|
|
|
|
* out the interior data, not the "frame" XML container. And it
|
|
|
|
* should call the base classes same named method before doing
|
|
|
|
* anything specific in a derived class. This means that derived
|
|
|
|
* classes need not override DumpRegressionData unless they need
|
|
|
|
* some custom behavior that requires changing how the outer "frame"
|
|
|
|
* XML container is dumped.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, int32_t aIndent);
|
1999-11-02 01:12:45 +03:00
|
|
|
|
2001-10-29 04:43:59 +03:00
|
|
|
// Display Reflow Debugging
|
2004-08-01 03:15:21 +04:00
|
|
|
static void* DisplayReflowEnter(nsPresContext* aPresContext,
|
2001-11-14 16:40:03 +03:00
|
|
|
nsIFrame* aFrame,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
static void* DisplayLayoutEnter(nsIFrame* aFrame);
|
2014-07-24 21:03:26 +04:00
|
|
|
static void* DisplayIntrinsicISizeEnter(nsIFrame* aFrame,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
const char* aType);
|
|
|
|
static void* DisplayIntrinsicSizeEnter(nsIFrame* aFrame,
|
|
|
|
const char* aType);
|
2017-02-10 12:29:10 +03:00
|
|
|
static void DisplayReflowExit(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
ReflowOutput& aMetrics,
|
|
|
|
const nsReflowStatus& aStatus,
|
|
|
|
void* aFrameTreeNode);
|
2017-01-18 03:27:03 +03:00
|
|
|
static void DisplayLayoutExit(nsIFrame* aFrame,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
void* aFrameTreeNode);
|
2017-01-18 03:27:03 +03:00
|
|
|
static void DisplayIntrinsicISizeExit(nsIFrame* aFrame,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
const char* aType,
|
|
|
|
nscoord aResult,
|
|
|
|
void* aFrameTreeNode);
|
2017-01-18 03:27:03 +03:00
|
|
|
static void DisplayIntrinsicSizeExit(nsIFrame* aFrame,
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
const char* aType,
|
|
|
|
nsSize aResult,
|
|
|
|
void* aFrameTreeNode);
|
2003-03-22 18:09:17 +03:00
|
|
|
|
|
|
|
static void DisplayReflowStartup();
|
|
|
|
static void DisplayReflowShutdown();
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-05 19:03:07 +03:00
|
|
|
|
2009-07-22 04:44:51 +04:00
|
|
|
/**
|
2012-09-13 14:34:23 +04:00
|
|
|
* Adds display items for standard CSS background if necessary.
|
2009-07-22 04:44:51 +04:00
|
|
|
* Does not check IsVisibleForPainting.
|
|
|
|
* @param aForceBackground draw the background even if the frame
|
|
|
|
* background style appears to have no background --- this is useful
|
|
|
|
* for frames that might receive a propagated background via
|
|
|
|
* nsCSSRendering::FindBackground
|
2013-07-24 11:38:55 +04:00
|
|
|
* @return whether a themed background item was created.
|
2009-07-22 04:44:51 +04:00
|
|
|
*/
|
2013-07-24 11:38:55 +04:00
|
|
|
bool DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
|
2013-02-14 15:12:27 +04:00
|
|
|
const nsDisplayListSet& aLists,
|
2013-07-24 11:38:55 +04:00
|
|
|
bool aForceBackground);
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* Adds display items for standard CSS borders, background and outline for
|
|
|
|
* for this frame, as necessary. Checks IsVisibleForPainting and won't
|
|
|
|
* display anything if the frame is not visible.
|
|
|
|
* @param aForceBackground draw the background even if the frame
|
|
|
|
* background style appears to have no background --- this is useful
|
|
|
|
* for frames that might receive a propagated background via
|
|
|
|
* nsCSSRendering::FindBackground
|
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
void DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists,
|
|
|
|
bool aForceBackground = false);
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* Add a display item for the CSS outline. Does not check visibility.
|
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
void DisplayOutlineUnconditional(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* Add a display item for the CSS outline, after calling
|
|
|
|
* IsVisibleForPainting to confirm we are visible.
|
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
void DisplayOutline(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aLists);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2007-04-16 03:14:26 +04:00
|
|
|
/**
|
|
|
|
* Adjust the given parent frame to the right style context parent frame for
|
|
|
|
* the child, given the pseudo-type of the prospective child. This handles
|
|
|
|
* things like walking out of table pseudos and so forth.
|
|
|
|
*
|
|
|
|
* @param aProspectiveParent what GetParent() on the child returns.
|
|
|
|
* Must not be null.
|
|
|
|
* @param aChildPseudo the child's pseudo type, if any.
|
|
|
|
*/
|
|
|
|
static nsIFrame*
|
|
|
|
CorrectStyleParentFrame(nsIFrame* aProspectiveParent, nsIAtom* aChildPseudo);
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
1998-12-05 19:03:07 +03:00
|
|
|
// Protected constructor and destructor
|
2017-05-26 13:11:11 +03:00
|
|
|
nsFrame(nsStyleContext* aContext, ClassID aID);
|
2017-05-26 13:11:11 +03:00
|
|
|
explicit nsFrame(nsStyleContext* aContext)
|
2017-05-26 13:11:11 +03:00
|
|
|
: nsFrame(aContext, ClassID::nsFrame_id) {}
|
1998-12-05 19:03:07 +03:00
|
|
|
virtual ~nsFrame();
|
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* To be called by |BuildDisplayLists| of this class or derived classes to add
|
|
|
|
* a translucent overlay if this frame's content is selected.
|
|
|
|
* @param aContentType an nsISelectionDisplay DISPLAY_ constant identifying
|
|
|
|
* which kind of content this is for
|
2002-12-24 01:05:47 +03:00
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
void DisplaySelectionOverlay(nsDisplayListBuilder* aBuilder,
|
2012-08-22 19:56:38 +04:00
|
|
|
nsDisplayList* aList, uint16_t aContentType = nsISelectionDisplay::DISPLAY_FRAMES);
|
2002-12-24 01:05:47 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t DisplaySelection(nsPresContext* aPresContext, bool isOkToTurnOn = false);
|
2000-08-09 03:38:00 +04:00
|
|
|
|
1998-05-08 22:33:42 +04:00
|
|
|
// Style post processing hook
|
2017-01-18 03:27:03 +03:00
|
|
|
void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
1998-05-08 22:33:42 +04:00
|
|
|
|
2004-11-29 23:28:46 +03:00
|
|
|
public:
|
2017-03-21 03:22:13 +03:00
|
|
|
/**
|
2017-03-21 03:22:13 +03:00
|
|
|
* Helper method to create a view for a frame. Only used by a few sub-classes
|
|
|
|
* that need a view.
|
2017-03-21 03:22:13 +03:00
|
|
|
*/
|
2017-03-21 03:22:13 +03:00
|
|
|
void CreateView();
|
2017-03-21 03:22:13 +03:00
|
|
|
|
1999-10-22 04:19:18 +04:00
|
|
|
//given a frame five me the first/last leaf available
|
2004-11-29 23:28:46 +03:00
|
|
|
//XXX Robert O'Callahan wants to move these elsewhere
|
2004-08-01 03:15:21 +04:00
|
|
|
static void GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
|
|
|
|
static void GetFirstLeaf(nsPresContext* aPresContext, nsIFrame **aFrame);
|
2006-08-07 14:54:56 +04:00
|
|
|
|
2008-10-09 14:22:30 +04:00
|
|
|
// Return the line number of the aFrame, and (optionally) the containing block
|
|
|
|
// frame.
|
|
|
|
// If aScrollLock is true, don't break outside scrollframes when looking for a
|
|
|
|
// containing block frame.
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t GetLineNumber(nsIFrame *aFrame,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aLockScroll,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIFrame** aContainingBlock = nullptr);
|
2006-08-07 14:54:56 +04:00
|
|
|
|
2012-01-19 00:04:51 +04:00
|
|
|
/**
|
|
|
|
* Returns true if aFrame should apply overflow clipping.
|
|
|
|
*/
|
2013-03-06 15:08:16 +04:00
|
|
|
static bool ShouldApplyOverflowClipping(const nsIFrame* aFrame,
|
|
|
|
const nsStyleDisplay* aDisp)
|
2011-01-20 01:39:31 +03:00
|
|
|
{
|
2015-07-07 00:57:37 +03:00
|
|
|
// clip overflow:-moz-hidden-unscrollable, except for nsListControlFrame,
|
|
|
|
// which is an nsHTMLScrollFrame.
|
|
|
|
if (MOZ_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP &&
|
2017-04-30 18:30:08 +03:00
|
|
|
!aFrame->IsListControlFrame())) {
|
2012-01-19 00:04:51 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// and overflow:hidden that we should interpret as -moz-hidden-unscrollable
|
|
|
|
if (aDisp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
|
|
|
|
aDisp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
|
|
|
|
// REVIEW: these are the frame types that set up clipping.
|
2017-05-01 20:32:52 +03:00
|
|
|
mozilla::LayoutFrameType type = aFrame->Type();
|
|
|
|
if (type == mozilla::LayoutFrameType::Table ||
|
|
|
|
type == mozilla::LayoutFrameType::TableCell ||
|
|
|
|
type == mozilla::LayoutFrameType::BCTableCell ||
|
|
|
|
type == mozilla::LayoutFrameType::SVGOuterSVG ||
|
|
|
|
type == mozilla::LayoutFrameType::SVGInnerSVG ||
|
2017-06-14 16:53:34 +03:00
|
|
|
type == mozilla::LayoutFrameType::SVGSymbol ||
|
2017-05-01 20:32:52 +03:00
|
|
|
type == mozilla::LayoutFrameType::SVGForeignObject) {
|
2012-01-19 00:04:51 +04:00
|
|
|
return true;
|
|
|
|
}
|
2013-01-25 00:44:38 +04:00
|
|
|
if (aFrame->IsFrameOfType(nsIFrame::eReplacedContainsBlock)) {
|
2017-05-01 20:32:52 +03:00
|
|
|
if (type == mozilla::LayoutFrameType::TextInput) {
|
2014-05-12 15:45:27 +04:00
|
|
|
// It always has an anonymous scroll frame that handles any overflow.
|
|
|
|
return false;
|
|
|
|
}
|
2013-01-25 00:44:38 +04:00
|
|
|
return true;
|
|
|
|
}
|
2012-01-19 00:04:51 +04:00
|
|
|
}
|
2012-07-20 22:12:29 +04:00
|
|
|
|
|
|
|
if ((aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-01-20 01:39:31 +03:00
|
|
|
// If we're paginated and a block, and have NS_BLOCK_CLIP_PAGINATED_OVERFLOW
|
|
|
|
// set, then we want to clip our overflow.
|
2017-04-30 18:30:08 +03:00
|
|
|
return (aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0 &&
|
|
|
|
aFrame->PresContext()->IsPaginated() && aFrame->IsBlockFrame();
|
2011-01-20 01:39:31 +03:00
|
|
|
}
|
|
|
|
|
2017-01-18 03:27:03 +03:00
|
|
|
nsILineIterator* GetLineIterator() override;
|
2014-05-25 02:20:39 +04:00
|
|
|
|
2004-11-29 23:28:46 +03:00
|
|
|
protected:
|
2000-03-17 02:45:39 +03:00
|
|
|
|
|
|
|
// Test if we are selecting a table object:
|
2000-05-31 04:07:58 +04:00
|
|
|
// Most table/cell selection requires that Ctrl (Cmd on Mac) key is down
|
|
|
|
// during a mouse click or drag. Exception is using Shift+click when
|
|
|
|
// already in "table/cell selection mode" to extend a block selection
|
|
|
|
// Get the parent content node and offset of the frame
|
2000-03-17 02:45:39 +03:00
|
|
|
// of the enclosing cell or table (if not inside a cell)
|
|
|
|
// aTarget tells us what table element to select (currently only cell and table supported)
|
|
|
|
// (enums for this are defined in nsIFrame.h)
|
2013-10-02 10:38:27 +04:00
|
|
|
NS_IMETHOD GetDataForTableSelection(const nsFrameSelection* aFrameSelection,
|
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
mozilla::WidgetMouseEvent* aMouseEvent,
|
|
|
|
nsIContent** aParentContent,
|
|
|
|
int32_t* aContentOffset,
|
|
|
|
int32_t* aTarget);
|
2000-03-17 02:45:39 +03:00
|
|
|
|
2004-12-31 00:56:11 +03:00
|
|
|
// Fills aCursor with the appropriate information from ui
|
|
|
|
static void FillCursorInformationFromStyle(const nsStyleUserInterface* ui,
|
|
|
|
nsIFrame::Cursor& aCursor);
|
2016-04-21 07:28:35 +03:00
|
|
|
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
|
2004-09-28 22:37:50 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG_LAYOUT
|
2017-01-18 03:27:03 +03:00
|
|
|
void GetBoxName(nsAutoString& aName) override;
|
2004-09-28 22:37:50 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
nsBoxLayoutMetrics* BoxMetrics() const;
|
|
|
|
|
2006-05-03 21:02:37 +04:00
|
|
|
// Fire DOM event. If no aContent argument use frame's mContent.
|
2012-07-30 18:20:58 +04:00
|
|
|
void FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent = nullptr);
|
2006-05-03 21:02:37 +04:00
|
|
|
|
2004-09-28 22:37:50 +04:00
|
|
|
private:
|
2014-05-13 04:47:54 +04:00
|
|
|
void BoxReflow(nsBoxLayoutState& aState,
|
|
|
|
nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRenderingContext,
|
2014-05-13 04:47:54 +04:00
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
nscoord aWidth,
|
|
|
|
nscoord aHeight,
|
|
|
|
bool aMoveFrame = true);
|
2004-09-28 22:37:50 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
|
|
|
|
|
2015-11-06 01:21:38 +03:00
|
|
|
// Returns true if this frame has any kind of CSS animations.
|
|
|
|
bool HasCSSAnimations();
|
|
|
|
|
2016-04-10 22:29:00 +03:00
|
|
|
// Returns true if this frame has any kind of CSS transitions.
|
|
|
|
bool HasCSSTransitions();
|
|
|
|
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2009-08-21 01:52:48 +04:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Get a printable from of the name of the frame type.
|
|
|
|
* XXX This should be eliminated and we use GetType() instead...
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult GetFrameName(nsAString& aResult) const override;
|
2014-01-06 03:31:14 +04:00
|
|
|
nsresult MakeFrameName(const nsAString& aKind, nsAString& aResult) const;
|
|
|
|
// Helper function to return the index in parent of the frame's content
|
|
|
|
// object. Returns -1 on error or if the frame doesn't have a content object
|
|
|
|
static int32_t ContentIndexInContainer(const nsIFrame* aFrame);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
public:
|
2009-08-21 01:52:48 +04:00
|
|
|
/**
|
|
|
|
* Return the state bits that are relevant to regression tests (that
|
|
|
|
* is, those bits which indicate a real difference when they differ
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
nsFrameState GetDebugStateBits() const override;
|
2009-08-21 01:52:48 +04:00
|
|
|
/**
|
|
|
|
* Called to dump out regression data that describes the layout
|
|
|
|
* of the frame and its children, and so on. The format of the
|
|
|
|
* data is dictated to be XML (using a specific DTD); the
|
|
|
|
* specific kind of data dumped is up to the frame itself, with
|
|
|
|
* the caveat that some base types are defined.
|
|
|
|
* For more information, see XXX.
|
|
|
|
*/
|
2017-01-18 03:27:03 +03:00
|
|
|
nsresult DumpRegressionData(nsPresContext* aPresContext,
|
2017-01-18 03:27:03 +03:00
|
|
|
FILE* out, int32_t aIndent) override;
|
2009-08-21 01:52:48 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See if style tree verification is enabled. To enable style tree
|
2016-05-26 21:40:17 +03:00
|
|
|
* verification add "styleverifytree:1" to your MOZ_LOG
|
2009-08-21 01:52:48 +04:00
|
|
|
* environment variable (any non-zero debug level will work). Or,
|
2011-10-17 18:59:28 +04:00
|
|
|
* call SetVerifyStyleTreeEnable with true.
|
2009-08-21 01:52:48 +04:00
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool GetVerifyStyleTreeEnable();
|
2009-08-21 01:52:48 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the verify-style-tree enable flag.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static void SetVerifyStyleTreeEnable(bool aEnabled);
|
2009-08-21 01:52:48 +04:00
|
|
|
|
2015-11-06 01:35:03 +03:00
|
|
|
static mozilla::LazyLogModule sFrameLogModule;
|
2009-08-21 01:52:48 +04:00
|
|
|
|
|
|
|
// Show frame borders when rendering
|
2011-09-29 10:19:26 +04:00
|
|
|
static void ShowFrameBorders(bool aEnable);
|
|
|
|
static bool GetShowFrameBorders();
|
2009-08-21 01:52:48 +04:00
|
|
|
|
|
|
|
// Show frame border of event target
|
2011-09-29 10:19:26 +04:00
|
|
|
static void ShowEventTargetFrameBorder(bool aEnable);
|
|
|
|
static bool GetShowEventTargetFrameBorder();
|
2009-08-21 01:52:48 +04:00
|
|
|
|
2011-11-17 07:44:16 +04:00
|
|
|
#endif
|
2014-12-31 23:17:39 +03:00
|
|
|
|
2011-11-17 07:44:16 +04:00
|
|
|
public:
|
|
|
|
|
2009-08-21 01:52:48 +04:00
|
|
|
static void PrintDisplayList(nsDisplayListBuilder* aBuilder,
|
2012-03-01 12:26:09 +04:00
|
|
|
const nsDisplayList& aList,
|
2014-06-20 02:36:25 +04:00
|
|
|
bool aDumpHtml = false)
|
|
|
|
{
|
|
|
|
std::stringstream ss;
|
|
|
|
PrintDisplayList(aBuilder, aList, ss, aDumpHtml);
|
|
|
|
fprintf_stderr(stderr, "%s", ss.str().c_str());
|
|
|
|
}
|
|
|
|
static void PrintDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayList& aList,
|
|
|
|
std::stringstream& aStream,
|
2012-08-07 21:57:26 +04:00
|
|
|
bool aDumpHtml = false);
|
2013-12-12 22:27:07 +04:00
|
|
|
static void PrintDisplayListSet(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsDisplayListSet& aList,
|
2014-06-20 02:36:25 +04:00
|
|
|
std::stringstream& aStream,
|
2013-12-12 22:27:07 +04:00
|
|
|
bool aDumpHtml = false);
|
2009-08-21 01:52:48 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
// Start Display Reflow Debugging
|
2001-10-29 04:43:59 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
struct DR_cookie {
|
2004-08-01 03:15:21 +04:00
|
|
|
DR_cookie(nsPresContext* aPresContext,
|
2001-11-14 16:40:03 +03:00
|
|
|
nsIFrame* aFrame,
|
2016-07-21 13:36:39 +03:00
|
|
|
const mozilla::ReflowInput& aReflowInput,
|
2016-07-21 13:36:38 +03:00
|
|
|
mozilla::ReflowOutput& aMetrics,
|
2001-10-29 04:43:59 +03:00
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
~DR_cookie();
|
2001-11-27 04:45:46 +03:00
|
|
|
void Change() const;
|
2001-10-29 04:43:59 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
nsPresContext* mPresContext;
|
2001-10-29 04:43:59 +03:00
|
|
|
nsIFrame* mFrame;
|
2016-07-21 13:36:39 +03:00
|
|
|
const mozilla::ReflowInput& mReflowInput;
|
2016-07-21 13:36:38 +03:00
|
|
|
mozilla::ReflowOutput& mMetrics;
|
2001-10-29 04:43:59 +03:00
|
|
|
nsReflowStatus& mStatus;
|
|
|
|
void* mValue;
|
|
|
|
};
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
|
|
|
|
struct DR_layout_cookie {
|
2014-08-08 03:48:38 +04:00
|
|
|
explicit DR_layout_cookie(nsIFrame* aFrame);
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
~DR_layout_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_intrinsic_width_cookie {
|
|
|
|
DR_intrinsic_width_cookie(nsIFrame* aFrame, const char* aType,
|
|
|
|
nscoord& aResult);
|
|
|
|
~DR_intrinsic_width_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
const char* mType;
|
|
|
|
nscoord& mResult;
|
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_intrinsic_size_cookie {
|
|
|
|
DR_intrinsic_size_cookie(nsIFrame* aFrame, const char* aType,
|
|
|
|
nsSize& aResult);
|
|
|
|
~DR_intrinsic_size_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
const char* mType;
|
|
|
|
nsSize& mResult;
|
|
|
|
void* mValue;
|
|
|
|
};
|
2010-05-02 01:40:16 +04:00
|
|
|
|
|
|
|
struct DR_init_constraints_cookie {
|
2016-07-21 13:36:35 +03:00
|
|
|
DR_init_constraints_cookie(nsIFrame* aFrame, mozilla::ReflowInput* aState,
|
2010-05-02 01:40:16 +04:00
|
|
|
nscoord aCBWidth, nscoord aCBHeight,
|
|
|
|
const nsMargin* aBorder,
|
|
|
|
const nsMargin* aPadding);
|
|
|
|
~DR_init_constraints_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
2016-07-21 13:36:35 +03:00
|
|
|
mozilla::ReflowInput* mState;
|
2010-05-02 01:40:16 +04:00
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_init_offsets_cookie {
|
2016-07-21 13:36:35 +03:00
|
|
|
DR_init_offsets_cookie(nsIFrame* aFrame, mozilla::SizeComputationInput* aState,
|
2015-06-04 13:43:02 +03:00
|
|
|
const mozilla::LogicalSize& aPercentBasis,
|
2013-04-11 18:51:58 +04:00
|
|
|
const nsMargin* aBorder,
|
2010-05-02 01:40:16 +04:00
|
|
|
const nsMargin* aPadding);
|
|
|
|
~DR_init_offsets_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
2016-07-21 13:36:35 +03:00
|
|
|
mozilla::SizeComputationInput* mState;
|
2010-05-02 01:40:16 +04:00
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DR_init_type_cookie {
|
2016-07-21 13:36:35 +03:00
|
|
|
DR_init_type_cookie(nsIFrame* aFrame, mozilla::ReflowInput* aState);
|
2010-05-02 01:40:16 +04:00
|
|
|
~DR_init_type_cookie();
|
|
|
|
|
|
|
|
nsIFrame* mFrame;
|
2016-07-21 13:36:35 +03:00
|
|
|
mozilla::ReflowInput* mState;
|
2010-05-02 01:40:16 +04:00
|
|
|
void* mValue;
|
|
|
|
};
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
#define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
|
|
|
|
DR_cookie dr_cookie(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status);
|
2001-11-27 04:45:46 +03:00
|
|
|
#define DISPLAY_REFLOW_CHANGE() \
|
|
|
|
dr_cookie.Change();
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DISPLAY_LAYOUT(dr_frame) \
|
|
|
|
DR_layout_cookie dr_cookie(dr_frame);
|
|
|
|
#define DISPLAY_MIN_WIDTH(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Min", dr_result)
|
|
|
|
#define DISPLAY_PREF_WIDTH(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_width_cookie dr_cookie(dr_frame, "Pref", dr_result)
|
|
|
|
#define DISPLAY_PREF_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Pref", dr_result)
|
|
|
|
#define DISPLAY_MIN_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Min", dr_result)
|
|
|
|
#define DISPLAY_MAX_SIZE(dr_frame, dr_result) \
|
|
|
|
DR_intrinsic_size_cookie dr_cookie(dr_frame, "Max", dr_result)
|
2010-05-02 01:40:16 +04:00
|
|
|
#define DISPLAY_INIT_CONSTRAINTS(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad) \
|
|
|
|
DR_init_constraints_cookie dr_cookie(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad)
|
2015-06-04 13:43:02 +03:00
|
|
|
#define DISPLAY_INIT_OFFSETS(dr_frame, dr_state, dr_pb, dr_bdr, dr_pad) \
|
|
|
|
DR_init_offsets_cookie dr_cookie(dr_frame, dr_state, dr_pb, dr_bdr, dr_pad)
|
2010-05-02 01:40:16 +04:00
|
|
|
#define DISPLAY_INIT_TYPE(dr_frame, dr_result) \
|
|
|
|
DR_init_type_cookie dr_cookie(dr_frame, dr_result)
|
2001-10-29 04:43:59 +03:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
2001-11-14 16:40:03 +03:00
|
|
|
#define DISPLAY_REFLOW(dr_pres_context, dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status)
|
2001-11-27 04:45:46 +03:00
|
|
|
#define DISPLAY_REFLOW_CHANGE()
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
#define DISPLAY_LAYOUT(dr_frame) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MIN_WIDTH(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_PREF_WIDTH(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_PREF_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MIN_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_MAX_SIZE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
2010-05-02 01:40:16 +04:00
|
|
|
#define DISPLAY_INIT_CONSTRAINTS(dr_frame, dr_state, dr_cbw, dr_cbh, \
|
|
|
|
dr_bdr, dr_pad) \
|
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
2015-06-04 13:43:02 +03:00
|
|
|
#define DISPLAY_INIT_OFFSETS(dr_frame, dr_state, dr_pb, dr_bdr, dr_pad) \
|
2010-05-02 01:40:16 +04:00
|
|
|
PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
#define DISPLAY_INIT_TYPE(dr_frame, dr_result) PR_BEGIN_MACRO PR_END_MACRO
|
|
|
|
|
2001-10-29 04:43:59 +03:00
|
|
|
#endif
|
|
|
|
// End Display Reflow Debugging
|
|
|
|
|
2002-03-12 18:21:35 +03:00
|
|
|
// similar to NS_ENSURE_TRUE but with no return value
|
|
|
|
#define ENSURE_TRUE(x) \
|
|
|
|
PR_BEGIN_MACRO \
|
|
|
|
if (!(x)) { \
|
|
|
|
NS_WARNING("ENSURE_TRUE(" #x ") failed"); \
|
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
PR_END_MACRO
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif /* nsFrame_h___ */
|