1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/mathml/nsMathMLmpaddedFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 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 nsMathMLmpaddedFrame_h___ 1.10 +#define nsMathMLmpaddedFrame_h___ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsMathMLContainerFrame.h" 1.14 + 1.15 +// 1.16 +// <mpadded> -- adjust space around content 1.17 +// 1.18 + 1.19 +class nsMathMLmpaddedFrame : public nsMathMLContainerFrame { 1.20 +public: 1.21 + NS_DECL_FRAMEARENA_HELPERS 1.22 + 1.23 + friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 1.24 + 1.25 + NS_IMETHOD 1.26 + InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE; 1.27 + 1.28 + NS_IMETHOD 1.29 + TransmitAutomaticData() MOZ_OVERRIDE { 1.30 + return TransmitAutomaticDataForMrowLikeElement(); 1.31 + } 1.32 + 1.33 + virtual nsresult 1.34 + Reflow(nsPresContext* aPresContext, 1.35 + nsHTMLReflowMetrics& aDesiredSize, 1.36 + const nsHTMLReflowState& aReflowState, 1.37 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.38 + 1.39 + virtual nsresult 1.40 + Place(nsRenderingContext& aRenderingContext, 1.41 + bool aPlaceOrigin, 1.42 + nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; 1.43 + 1.44 + bool 1.45 + IsMrowLike() MOZ_OVERRIDE { 1.46 + return mFrames.FirstChild() != mFrames.LastChild() || 1.47 + !mFrames.FirstChild(); 1.48 + } 1.49 + 1.50 +protected: 1.51 + nsMathMLmpaddedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {} 1.52 + virtual ~nsMathMLmpaddedFrame(); 1.53 + 1.54 + virtual nsresult 1.55 + MeasureForWidth(nsRenderingContext& aRenderingContext, 1.56 + nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; 1.57 + 1.58 +private: 1.59 + nsCSSValue mWidth; 1.60 + nsCSSValue mHeight; 1.61 + nsCSSValue mDepth; 1.62 + nsCSSValue mLeadingSpace; 1.63 + nsCSSValue mVerticalOffset; 1.64 + 1.65 + int32_t mWidthSign; 1.66 + int32_t mHeightSign; 1.67 + int32_t mDepthSign; 1.68 + int32_t mLeadingSpaceSign; 1.69 + int32_t mVerticalOffsetSign; 1.70 + 1.71 + int32_t mWidthPseudoUnit; 1.72 + int32_t mHeightPseudoUnit; 1.73 + int32_t mDepthPseudoUnit; 1.74 + int32_t mLeadingSpacePseudoUnit; 1.75 + int32_t mVerticalOffsetPseudoUnit; 1.76 + 1.77 + // helpers to process the attributes 1.78 + void 1.79 + ProcessAttributes(); 1.80 + 1.81 + static bool 1.82 + ParseAttribute(nsString& aString, 1.83 + int32_t& aSign, 1.84 + nsCSSValue& aCSSValue, 1.85 + int32_t& aPseudoUnit); 1.86 + 1.87 + void 1.88 + UpdateValue(int32_t aSign, 1.89 + int32_t aPseudoUnit, 1.90 + const nsCSSValue& aCSSValue, 1.91 + const nsHTMLReflowMetrics& aDesiredSize, 1.92 + nscoord& aValueToUpdate) const; 1.93 +}; 1.94 + 1.95 +#endif /* nsMathMLmpaddedFrame_h___ */