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