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
|
|
|
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsFrame.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsStyleContext.h"
|
1999-09-21 06:12:01 +04:00
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
|
|
|
|
#include "nsMathMLmstyleFrame.h"
|
|
|
|
|
|
|
|
//
|
|
|
|
// <mstyle> -- style change
|
|
|
|
//
|
|
|
|
|
2005-11-11 05:36:29 +03:00
|
|
|
nsIFrame*
|
2006-03-27 01:30:36 +04:00
|
|
|
NS_NewMathMLmstyleFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1999-09-21 06:12:01 +04:00
|
|
|
{
|
2006-03-27 01:30:36 +04:00
|
|
|
return new (aPresShell) nsMathMLmstyleFrame(aContext);
|
1999-09-21 06:12:01 +04:00
|
|
|
}
|
|
|
|
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmstyleFrame)
|
|
|
|
|
1999-09-21 06:12:01 +04:00
|
|
|
nsMathMLmstyleFrame::~nsMathMLmstyleFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// mstyle needs special care for its scriptlevel and displaystyle attributes
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:57:50 +03:00
|
|
|
nsMathMLmstyleFrame::InheritAutomaticData(nsIFrame* aParent)
|
1999-09-21 06:12:01 +04:00
|
|
|
{
|
2002-02-01 18:10:50 +03:00
|
|
|
// let the base class get the default from our parent
|
2005-02-07 04:57:50 +03:00
|
|
|
nsMathMLContainerFrame::InheritAutomaticData(aParent);
|
2002-02-01 18:10:50 +03:00
|
|
|
|
|
|
|
// sync with our current state
|
2002-02-07 07:38:08 +03:00
|
|
|
mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
|
2000-01-14 11:38:25 +03:00
|
|
|
mPresentationData.mstyle = this;
|
|
|
|
|
1999-09-21 06:12:01 +04:00
|
|
|
// see if the displaystyle attribute is there
|
2006-09-19 08:43:14 +04:00
|
|
|
nsMathMLFrame::FindAttrDisplaystyle(mContent, mPresentationData);
|
1999-09-21 06:12:01 +04:00
|
|
|
|
2002-02-01 18:10:50 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:57:50 +03:00
|
|
|
nsMathMLmstyleFrame::TransmitAutomaticData()
|
2002-02-01 18:10:50 +03:00
|
|
|
{
|
2011-03-25 06:38:59 +03:00
|
|
|
return TransmitAutomaticDataForMrowLikeElement();
|
1999-09-21 06:12:01 +04:00
|
|
|
}
|
|
|
|
|
2006-09-19 08:43:14 +04:00
|
|
|
// displaystyle and scriptlevel are special in <mstyle>...
|
|
|
|
// Since UpdatePresentation() and UpdatePresentationDataFromChildAt() can be called
|
|
|
|
// by a parent, ensure that the explicit attributes of <mstyle> take precedence
|
1999-09-21 06:12:01 +04:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsMathMLmstyleFrame::UpdatePresentationData(uint32_t aFlagsValues,
|
|
|
|
uint32_t aWhichFlags)
|
1999-09-21 06:12:01 +04:00
|
|
|
{
|
2006-09-19 08:43:14 +04:00
|
|
|
if (NS_MATHML_HAS_EXPLICIT_DISPLAYSTYLE(mPresentationData.flags)) {
|
|
|
|
// our current state takes precedence, disallow updating the displastyle
|
|
|
|
aWhichFlags &= ~NS_MATHML_DISPLAYSTYLE;
|
|
|
|
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
|
1999-09-21 06:12:01 +04:00
|
|
|
}
|
2002-01-10 07:42:55 +03:00
|
|
|
|
2008-01-09 12:38:28 +03:00
|
|
|
return nsMathMLContainerFrame::UpdatePresentationData(aFlagsValues, aWhichFlags);
|
1999-09-21 06:12:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsMathMLmstyleFrame::UpdatePresentationDataFromChildAt(int32_t aFirstIndex,
|
|
|
|
int32_t aLastIndex,
|
|
|
|
uint32_t aFlagsValues,
|
|
|
|
uint32_t aWhichFlags)
|
1999-09-21 06:12:01 +04:00
|
|
|
{
|
2006-09-19 08:43:14 +04:00
|
|
|
if (NS_MATHML_HAS_EXPLICIT_DISPLAYSTYLE(mPresentationData.flags)) {
|
|
|
|
// our current state takes precedence, disallow updating the displastyle
|
|
|
|
aWhichFlags &= ~NS_MATHML_DISPLAYSTYLE;
|
|
|
|
aFlagsValues &= ~NS_MATHML_DISPLAYSTYLE;
|
2001-02-02 12:38:48 +03:00
|
|
|
}
|
|
|
|
|
1999-09-21 06:12:01 +04:00
|
|
|
// let the base class worry about the update
|
2001-02-02 12:38:48 +03:00
|
|
|
return
|
|
|
|
nsMathMLContainerFrame::UpdatePresentationDataFromChildAt(
|
2008-01-09 12:38:28 +03:00
|
|
|
aFirstIndex, aLastIndex, aFlagsValues, aWhichFlags);
|
1999-09-21 06:12:01 +04:00
|
|
|
}
|
2002-01-10 07:42:55 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
nsMathMLmstyleFrame::AttributeChanged(int32_t aNameSpaceID,
|
2002-01-10 07:42:55 +03:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType)
|
2002-01-10 07:42:55 +03:00
|
|
|
{
|
2005-08-03 03:25:22 +04:00
|
|
|
// Other attributes can affect too many things, ask our parent to re-layout
|
2002-02-07 07:38:08 +03:00
|
|
|
// its children so that we can pick up changes in our attributes & transmit
|
|
|
|
// them in our subtree. However, our siblings will be re-laid too. We used
|
|
|
|
// to have a more speedier but more verbose alternative that didn't re-layout
|
|
|
|
// our siblings. See bug 114909 - attachment 67668.
|
2009-02-11 01:05:27 +03:00
|
|
|
return ReLayoutChildren(mParent);
|
2002-01-10 07:42:55 +03:00
|
|
|
}
|