2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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
|
|
|
|
//
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsMathMLmfencedFrame final : public nsMathMLContainerFrame {
|
1999-09-21 06:12:01 +04:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMathMLmfencedFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2018-03-22 21:20:41 +03:00
|
|
|
friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
2000-03-28 13:38:24 +04:00
|
|
|
|
2018-01-10 22:09:18 +03:00
|
|
|
void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
|
|
|
|
2003-02-22 03:32:13 +03:00
|
|
|
virtual void
|
2018-03-22 21:20:41 +03:00
|
|
|
SetAdditionalComputedStyle(int32_t aIndex,
|
|
|
|
ComputedStyle* aComputedStyle) override;
|
|
|
|
virtual ComputedStyle*
|
|
|
|
GetAdditionalComputedStyle(int32_t aIndex) const override;
|
2000-03-28 13:38:24 +04:00
|
|
|
|
1999-09-21 06:12:01 +04:00
|
|
|
NS_IMETHOD
|
2015-03-21 19:28:04 +03:00
|
|
|
InheritAutomaticData(nsIFrame* aParent) 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,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) 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,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
1999-11-22 01:16:47 +03:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
1999-11-22 01:16:47 +03:00
|
|
|
|
2013-11-25 18:20:20 +04:00
|
|
|
virtual void
|
2017-06-09 22:14:53 +03:00
|
|
|
GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize) 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,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) 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
|
2015-03-21 19:28:04 +03:00
|
|
|
ChildListChanged(int32_t aModType) 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
|
2016-07-21 13:36:38 +03:00
|
|
|
FixInterFrameSpacing(ReflowOutput& aDesiredSize) 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
|
2017-07-24 11:11:41 +03:00
|
|
|
nsresult
|
|
|
|
ReflowChar(DrawTarget* aDrawTarget,
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
IsMrowLike() override
|
2014-04-04 19:54:00 +04:00
|
|
|
{
|
|
|
|
// 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:
|
2018-03-22 21:20:41 +03:00
|
|
|
explicit nsMathMLmfencedFrame(ComputedStyle* aStyle)
|
|
|
|
: nsMathMLContainerFrame(aStyle, kClassID)
|
2016-12-01 11:06:50 +03:00
|
|
|
, mOpenChar(nullptr)
|
|
|
|
, mCloseChar(nullptr)
|
|
|
|
, mSeparatorsChar(nullptr)
|
|
|
|
, mSeparatorsCount(0)
|
|
|
|
{}
|
|
|
|
|
2002-01-05 04:15:04 +03:00
|
|
|
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 */
|