2007-06-11 23:10:23 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-11-05 03:57:39 -07:00
|
|
|
#ifndef nsMathMLmfencedFrame_h
|
|
|
|
#define nsMathMLmfencedFrame_h
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsMathMLContainerFrame.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// <mfenced> -- surround content with a pair of fences
|
|
|
|
//
|
|
|
|
|
|
|
|
class nsMathMLmfencedFrame : public nsMathMLContainerFrame {
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|
|
|
|
|
|
|
virtual void
|
2012-08-22 08:56:38 -07:00
|
|
|
SetAdditionalStyleContext(int32_t aIndex,
|
2013-05-14 09:33:23 -07:00
|
|
|
nsStyleContext* aStyleContext) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsStyleContext*
|
2013-05-14 09:33:23 -07:00
|
|
|
GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD
|
2012-09-14 09:10:08 -07:00
|
|
|
InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-28 12:36:58 -07:00
|
|
|
virtual void
|
2011-08-24 13:54:30 -07:00
|
|
|
SetInitialChildList(ChildListID aListID,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void
|
2007-03-22 10:30:00 -07:00
|
|
|
Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-11-25 06:20:20 -08:00
|
|
|
virtual void
|
|
|
|
GetIntrinsicWidthMetrics(nsRenderingContext* aRenderingContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
|
2008-03-13 22:02:49 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult
|
2012-08-22 08:56:38 -07:00
|
|
|
AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-09-14 09:10:08 -07:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// override the base method because we must keep separators in sync
|
|
|
|
virtual nsresult
|
2012-09-14 09:10:08 -07:00
|
|
|
ChildListChanged(int32_t aModType) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// override the base method so that we can deal with fences and separators
|
|
|
|
virtual nscoord
|
2012-09-14 09:10:08 -07:00
|
|
|
FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// helper routines to format the MathMLChars involved here
|
|
|
|
static nsresult
|
|
|
|
ReflowChar(nsPresContext* aPresContext,
|
2011-04-07 18:04:40 -07:00
|
|
|
nsRenderingContext& aRenderingContext,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsMathMLChar* aMathMLChar,
|
|
|
|
nsOperatorFlags aForm,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aScriptLevel,
|
2007-03-22 10:30:00 -07:00
|
|
|
nscoord axisHeight,
|
|
|
|
nscoord leading,
|
|
|
|
nscoord em,
|
|
|
|
nsBoundingMetrics& aContainerSize,
|
|
|
|
nscoord& aAscent,
|
2011-12-21 14:22:00 -08:00
|
|
|
nscoord& aDescent,
|
|
|
|
bool aRTL);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
PlaceChar(nsMathMLChar* aMathMLChar,
|
|
|
|
nscoord aDesiredSize,
|
|
|
|
nsBoundingMetrics& bm,
|
|
|
|
nscoord& dx);
|
|
|
|
|
2014-04-04 08:54:00 -07:00
|
|
|
virtual bool
|
|
|
|
IsMrowLike() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
// Always treated as an mrow with > 1 child as
|
|
|
|
// <mfenced> <mo>%</mo> </mfenced>
|
|
|
|
// renders equivalently to
|
|
|
|
// <mrow> <mo> ( </mo> <mo>%</mo> <mo> ) </mo> </mrow>
|
|
|
|
// This also holds with multiple children. (MathML3 3.3.8.1)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsMathMLmfencedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
|
|
|
|
virtual ~nsMathMLmfencedFrame();
|
|
|
|
|
|
|
|
nsMathMLChar* mOpenChar;
|
|
|
|
nsMathMLChar* mCloseChar;
|
|
|
|
nsMathMLChar* mSeparatorsChar;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mSeparatorsCount;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// clean up
|
|
|
|
void
|
|
|
|
RemoveFencesAndSeparators();
|
|
|
|
|
|
|
|
// add fences and separators when all child frames are known
|
2010-11-05 03:57:39 -07:00
|
|
|
void
|
2007-03-22 10:30:00 -07:00
|
|
|
CreateFencesAndSeparators(nsPresContext* aPresContext);
|
|
|
|
};
|
|
|
|
|
2010-11-05 03:57:39 -07:00
|
|
|
#endif /* nsMathMLmfencedFrame_h */
|