2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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 */
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
2008-04-11 12:44:58 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsFirstLetterFrame final : public nsContainerFrame {
|
2008-04-11 12:44:58 +04:00
|
|
|
public:
|
2010-11-27 18:21:00 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsFirstLetterFrame(ComputedStyle* aStyle,
|
|
|
|
nsPresContext* aPresContext)
|
|
|
|
: nsContainerFrame(aStyle, aPresContext, kClassID) {}
|
2011-12-28 00:18:48 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2008-04-11 12:44:58 +04:00
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
2008-04-11 12:44:58 +04:00
|
|
|
#endif
|
|
|
|
|
2012-02-22 03:50:16 +04:00
|
|
|
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2008-04-11 12:44:58 +04:00
|
|
|
if (!IsFloating()) 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));
|
|
|
|
}
|
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
InlineMinISizeData* aData) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
InlinePrefISizeData* aData) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-08-24 18:34:44 +04:00
|
|
|
virtual mozilla::LogicalSize ComputeSize(
|
|
|
|
gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2008-04-11 12:44:58 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool CanContinueTextRun() const override;
|
|
|
|
virtual nscoord GetLogicalBaseline(
|
|
|
|
mozilla::WritingMode aWritingMode) const override;
|
2016-07-21 13:36:39 +03:00
|
|
|
virtual LogicalSides GetLogicalSkipSides(
|
|
|
|
const ReflowInput* aReflowInput = nullptr) const override;
|
2008-04-11 12:44:58 +04:00
|
|
|
|
|
|
|
// override of nsFrame method
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetChildFrameContainingOffset(
|
2014-02-18 12:36:33 +04:00
|
|
|
int32_t inContentOffset, bool inHint, int32_t* outFrameContentOffset,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame** outChildFrame) override;
|
2008-04-11 12:44:58 +04:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
void DrainOverflowFrames(nsPresContext* aPresContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsFirstLetterFrame_h__ */
|