layout/generic/nsFirstLetterFrame.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsFirstLetterFrame_h__
     7 #define nsFirstLetterFrame_h__
     9 /* rendering object for CSS :first-letter pseudo-element */
    11 #include "mozilla/Attributes.h"
    12 #include "nsContainerFrame.h"
    14 class nsFirstLetterFrame MOZ_FINAL : public nsContainerFrame {
    15 public:
    16   NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
    17   NS_DECL_QUERYFRAME
    18   NS_DECL_FRAMEARENA_HELPERS
    20   nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
    22   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    23                                 const nsRect&           aDirtyRect,
    24                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    26   virtual void Init(nsIContent*      aContent,
    27                     nsIFrame*        aParent,
    28                     nsIFrame*        aPrevInFlow) MOZ_OVERRIDE;
    29   virtual nsresult SetInitialChildList(ChildListID     aListID,
    30                                        nsFrameList&    aChildList) MOZ_OVERRIDE;
    31 #ifdef DEBUG_FRAME_DUMP
    32   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
    33 #endif
    34   virtual nsIAtom* GetType() const MOZ_OVERRIDE;
    36   bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
    38   virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
    39   {
    40     if (!IsFloating())
    41       aFlags = aFlags & ~(nsIFrame::eLineParticipant);
    42     return nsContainerFrame::IsFrameOfType(aFlags &
    43       ~(nsIFrame::eBidiInlineContainer));
    44   }
    46   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    47   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
    48   virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
    49                                  InlineMinWidthData *aData) MOZ_OVERRIDE;
    50   virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
    51                                   InlinePrefWidthData *aData) MOZ_OVERRIDE;
    52   virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
    53                              nsSize aCBSize, nscoord aAvailableWidth,
    54                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
    55                              uint32_t aFlags) MOZ_OVERRIDE;
    56   virtual nsresult Reflow(nsPresContext*           aPresContext,
    57                           nsHTMLReflowMetrics&     aDesiredSize,
    58                           const nsHTMLReflowState& aReflowState,
    59                           nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    61   virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
    62   virtual nscoord GetBaseline() const MOZ_OVERRIDE;
    63   virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE;
    65 //override of nsFrame method
    66   virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
    67                                                  bool inHint,
    68                                                  int32_t* outFrameContentOffset,
    69                                                  nsIFrame** outChildFrame) MOZ_OVERRIDE;
    71   nscoord GetFirstLetterBaseline() const { return mBaseline; }
    73   // For floating first letter frames, create a continuation for aChild and
    74   // place it in the correct place. aContinuation is an outparam for the
    75   // continuation that is created. aIsFluid determines if the continuation is
    76   // fluid or not.
    77   nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
    78                                                nsIFrame* aChild,
    79                                                nsIFrame** aContinuation,
    80                                                bool aIsFluid);
    82 protected:
    83   nscoord mBaseline;
    85   void DrainOverflowFrames(nsPresContext* aPresContext);
    86 };
    88 #endif /* nsFirstLetterFrame_h__ */

mercurial