2008-04-11 08:44:58 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 08:44:58 +00:00
|
|
|
|
|
|
|
#ifndef nsFirstLetterFrame_h__
|
|
|
|
#define nsFirstLetterFrame_h__
|
|
|
|
|
|
|
|
/* rendering object for CSS :first-letter pseudo-element */
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 20:18:48 +00:00
|
|
|
#include "nsContainerFrame.h"
|
2008-04-11 08:44:58 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsFirstLetterFrame final : public nsContainerFrame {
|
2008-04-11 08:44:58 +00:00
|
|
|
public:
|
2010-11-27 15:21:00 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
|
2011-12-27 20:18:48 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2008-04-11 08:44:58 +00:00
|
|
|
|
2014-05-24 22:20:40 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-05-28 19:36:58 +00:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsFrameList& aChildList) override;
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2008-04-11 08:44:58 +00:00
|
|
|
#endif
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2008-04-11 08:44:58 +00:00
|
|
|
|
2012-02-21 23:50:16 +00:00
|
|
|
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2008-04-11 08:44:58 +00:00
|
|
|
{
|
2012-02-21 23:50:16 +00:00
|
|
|
if (!IsFloating())
|
2008-04-11 08:44:58 +00:00
|
|
|
aFlags = aFlags & ~(nsIFrame::eLineParticipant);
|
2011-12-27 20:18:48 +00:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2008-04-11 08:44:58 +00:00
|
|
|
~(nsIFrame::eBidiInlineContainer));
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
2014-07-24 17:03:25 +00:00
|
|
|
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
|
2015-03-21 16:28:04 +00:00
|
|
|
InlineMinISizeData *aData) override;
|
2014-07-24 17:03:25 +00:00
|
|
|
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
|
2015-03-21 16:28:04 +00:00
|
|
|
InlinePrefISizeData *aData) override;
|
2014-08-24 14:34:44 +00:00
|
|
|
|
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeSize(nsRenderingContext *aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2015-03-21 16:28:04 +00:00
|
|
|
ComputeSizeFlags aFlags) override;
|
2014-08-24 14:34:44 +00:00
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2008-04-11 08:44:58 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool CanContinueTextRun() const override;
|
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
|
|
|
|
virtual LogicalSides GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const override;
|
2008-04-11 08:44:58 +00:00
|
|
|
|
|
|
|
//override of nsFrame method
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
|
2014-02-18 08:36:33 +00:00
|
|
|
bool inHint,
|
|
|
|
int32_t* outFrameContentOffset,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIFrame** outChildFrame) override;
|
2008-04-11 08:44:58 +00:00
|
|
|
|
|
|
|
nscoord GetFirstLetterBaseline() const { return mBaseline; }
|
|
|
|
|
2010-03-17 17:30:30 +00: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 06:19:26 +00:00
|
|
|
bool aIsFluid);
|
2010-03-17 17:30:30 +00:00
|
|
|
|
2008-04-11 08:44:58 +00:00
|
|
|
protected:
|
|
|
|
nscoord mBaseline;
|
|
|
|
|
|
|
|
void DrainOverflowFrames(nsPresContext* aPresContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsFirstLetterFrame_h__ */
|