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