2008-04-11 12:44:58 +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/. */
|
2008-04-11 12:44:58 +04:00
|
|
|
|
|
|
|
#ifndef nsFirstLetterFrame_h__
|
|
|
|
#define nsFirstLetterFrame_h__
|
|
|
|
|
|
|
|
/* rendering object for CSS :first-letter pseudo-element */
|
|
|
|
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2008-04-11 12:44:58 +04:00
|
|
|
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsFirstLetterFrame : public nsContainerFrame {
|
2008-04-11 12:44:58 +04:00
|
|
|
public:
|
2010-11-27 18:21:00 +03:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2011-12-28 00:18:48 +04:00
|
|
|
nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
2008-04-11 12:44:58 +04:00
|
|
|
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 16:53:20 +04:00
|
|
|
nsFrameList& aChildList);
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
2008-04-11 12:44:58 +04:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2012-02-22 03:50:16 +04:00
|
|
|
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
2008-04-11 12:44:58 +04:00
|
|
|
{
|
2012-02-22 03:50:16 +04:00
|
|
|
if (!IsFloating())
|
2008-04-11 12:44:58 +04:00
|
|
|
aFlags = aFlags & ~(nsIFrame::eLineParticipant);
|
2011-12-28 00:18:48 +04:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2008-04-11 12:44:58 +04:00
|
|
|
~(nsIFrame::eBidiInlineContainer));
|
|
|
|
}
|
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
|
|
|
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
2008-04-11 12:44:58 +04:00
|
|
|
InlineMinWidthData *aData);
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
2008-04-11 12:44:58 +04:00
|
|
|
InlinePrefWidthData *aData);
|
2011-04-08 05:04:40 +04:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2008-04-11 12:44:58 +04:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-03-16 22:01:05 +04:00
|
|
|
PRUint32 aFlags) MOZ_OVERRIDE;
|
2008-04-11 12:44:58 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool CanContinueTextRun() const;
|
2010-08-31 22:54:44 +04:00
|
|
|
virtual nscoord GetBaseline() const;
|
2008-04-11 12:44:58 +04:00
|
|
|
|
|
|
|
//override of nsFrame method
|
|
|
|
NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool inHint,
|
2008-04-11 12:44:58 +04:00
|
|
|
PRInt32* outFrameContentOffset,
|
|
|
|
nsIFrame **outChildFrame);
|
|
|
|
|
|
|
|
nscoord GetFirstLetterBaseline() const { return mBaseline; }
|
|
|
|
|
2010-03-17 20:30:30 +03:00
|
|
|
// For floating first letter frames, create a continuation for aChild and
|
|
|
|
// place it in the correct place. aContinuation is an outparam for the
|
|
|
|
// continuation that is created. aIsFluid determines if the continuation is
|
|
|
|
// fluid or not.
|
|
|
|
nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aChild,
|
|
|
|
nsIFrame** aContinuation,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsFluid);
|
2010-03-17 20:30:30 +03:00
|
|
|
|
2008-04-11 12:44:58 +04:00
|
|
|
protected:
|
|
|
|
nscoord mBaseline;
|
|
|
|
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
|
|
|
void DrainOverflowFrames(nsPresContext* aPresContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsFirstLetterFrame_h__ */
|