layout/generic/nsFirstLetterFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/nsFirstLetterFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,88 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsFirstLetterFrame_h__
    1.10 +#define nsFirstLetterFrame_h__
    1.11 +
    1.12 +/* rendering object for CSS :first-letter pseudo-element */
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "nsContainerFrame.h"
    1.16 +
    1.17 +class nsFirstLetterFrame MOZ_FINAL : public nsContainerFrame {
    1.18 +public:
    1.19 +  NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
    1.20 +  NS_DECL_QUERYFRAME
    1.21 +  NS_DECL_FRAMEARENA_HELPERS
    1.22 +
    1.23 +  nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
    1.24 +
    1.25 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    1.26 +                                const nsRect&           aDirtyRect,
    1.27 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    1.28 +
    1.29 +  virtual void Init(nsIContent*      aContent,
    1.30 +                    nsIFrame*        aParent,
    1.31 +                    nsIFrame*        aPrevInFlow) MOZ_OVERRIDE;
    1.32 +  virtual nsresult SetInitialChildList(ChildListID     aListID,
    1.33 +                                       nsFrameList&    aChildList) MOZ_OVERRIDE;
    1.34 +#ifdef DEBUG_FRAME_DUMP
    1.35 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
    1.36 +#endif
    1.37 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    1.38 +
    1.39 +  bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
    1.40 +
    1.41 +  virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    1.42 +  {
    1.43 +    if (!IsFloating())
    1.44 +      aFlags = aFlags & ~(nsIFrame::eLineParticipant);
    1.45 +    return nsContainerFrame::IsFrameOfType(aFlags &
    1.46 +      ~(nsIFrame::eBidiInlineContainer));
    1.47 +  }
    1.48 +
    1.49 +  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.50 +  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    1.51 +  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
    1.52 +                                 InlineMinWidthData *aData) MOZ_OVERRIDE;
    1.53 +  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
    1.54 +                                  InlinePrefWidthData *aData) MOZ_OVERRIDE;
    1.55 +  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
    1.56 +                             nsSize aCBSize, nscoord aAvailableWidth,
    1.57 +                             nsSize aMargin, nsSize aBorder, nsSize aPadding,
    1.58 +                             uint32_t aFlags) MOZ_OVERRIDE;
    1.59 +  virtual nsresult Reflow(nsPresContext*           aPresContext,
    1.60 +                          nsHTMLReflowMetrics&     aDesiredSize,
    1.61 +                          const nsHTMLReflowState& aReflowState,
    1.62 +                          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    1.63 +
    1.64 +  virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
    1.65 +  virtual nscoord GetBaseline() const MOZ_OVERRIDE;
    1.66 +  virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE;
    1.67 +
    1.68 +//override of nsFrame method
    1.69 +  virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
    1.70 +                                                 bool inHint,
    1.71 +                                                 int32_t* outFrameContentOffset,
    1.72 +                                                 nsIFrame** outChildFrame) MOZ_OVERRIDE;
    1.73 +
    1.74 +  nscoord GetFirstLetterBaseline() const { return mBaseline; }
    1.75 +
    1.76 +  // For floating first letter frames, create a continuation for aChild and
    1.77 +  // place it in the correct place. aContinuation is an outparam for the
    1.78 +  // continuation that is created. aIsFluid determines if the continuation is
    1.79 +  // fluid or not.
    1.80 +  nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
    1.81 +                                               nsIFrame* aChild,
    1.82 +                                               nsIFrame** aContinuation,
    1.83 +                                               bool aIsFluid);
    1.84 +
    1.85 +protected:
    1.86 +  nscoord mBaseline;
    1.87 +
    1.88 +  void DrainOverflowFrames(nsPresContext* aPresContext);
    1.89 +};
    1.90 +
    1.91 +#endif /* nsFirstLetterFrame_h__ */

mercurial