2008-04-11 01:44:58 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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 01:44:58 -07:00
|
|
|
|
|
|
|
#ifndef nsFirstLetterFrame_h__
|
|
|
|
#define nsFirstLetterFrame_h__
|
|
|
|
|
|
|
|
/* rendering object for CSS :first-letter pseudo-element */
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2008-04-11 01:44:58 -07:00
|
|
|
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsFirstLetterFrame : public nsContainerFrame {
|
2008-04-11 01:44:58 -07:00
|
|
|
public:
|
2010-11-27 07:21:00 -08:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2011-12-27 12:18:48 -08:00
|
|
|
nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2012-09-14 09:10:08 -07:00
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2012-06-25 12:59:42 -07:00
|
|
|
#ifdef DEBUG
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
#endif
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
2012-02-21 15:50:16 -08:00
|
|
|
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const
|
2008-04-11 01:44:58 -07:00
|
|
|
{
|
2012-02-21 15:50:16 -08:00
|
|
|
if (!IsFloating())
|
2008-04-11 01:44:58 -07:00
|
|
|
aFlags = aFlags & ~(nsIFrame::eLineParticipant);
|
2011-12-27 12:18:48 -08:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2008-04-11 01:44:58 -07:00
|
|
|
~(nsIFrame::eBidiInlineContainer));
|
|
|
|
}
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
2012-09-14 09:10:08 -07:00
|
|
|
InlineMinWidthData *aData) MOZ_OVERRIDE;
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
2012-09-14 09:10:08 -07:00
|
|
|
InlinePrefWidthData *aData) MOZ_OVERRIDE;
|
2011-04-07 18:04:40 -07:00
|
|
|
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
|
2008-04-11 01:44:58 -07:00
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder, nsSize aPadding,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
|
2010-08-31 11:54:44 -07:00
|
|
|
virtual nscoord GetBaseline() const;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
|
|
|
//override of nsFrame method
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetChildFrameContainingOffset(int32_t inContentOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool inHint,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* outFrameContentOffset,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIFrame **outChildFrame) MOZ_OVERRIDE;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
|
|
|
nscoord GetFirstLetterBaseline() const { return mBaseline; }
|
|
|
|
|
2010-03-17 10:30:30 -07: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-28 23:19:26 -07:00
|
|
|
bool aIsFluid);
|
2010-03-17 10:30:30 -07:00
|
|
|
|
2008-04-11 01:44:58 -07:00
|
|
|
protected:
|
|
|
|
nscoord mBaseline;
|
|
|
|
|
2012-08-09 00:09:40 -07:00
|
|
|
virtual int GetSkipSides() const;
|
2008-04-11 01:44:58 -07:00
|
|
|
|
|
|
|
void DrainOverflowFrames(nsPresContext* aPresContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsFirstLetterFrame_h__ */
|