mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 838506 - Part 4: Cleanup legacy code. r=roc
This commit is contained in:
parent
f484e6b539
commit
b7efcbe2ab
@ -142,18 +142,13 @@ public:
|
||||
NS_IMETHOD
|
||||
TransmitAutomaticData() = 0;
|
||||
|
||||
/* UpdatePresentationData :
|
||||
* Updates the frame's displaystyle and compression flags. The displaystyle
|
||||
* flag of an environment gets updated according to the MathML specification.
|
||||
/* UpdatePresentationData:
|
||||
* Updates the frame's compression flag.
|
||||
* A frame becomes "compressed" (or "cramped") according to TeX rendering
|
||||
* rules (TeXBook, Ch.17, p.140-141).
|
||||
*
|
||||
* Note that <mstyle> is the only tag which allows to set
|
||||
* <mstyle displaystyle="true|false">
|
||||
* Therefore <mstyle> has its own peculiar version of this method.
|
||||
*
|
||||
* @param aFlagsValues [in]
|
||||
* The new values (e.g., display, compress) that are going to be
|
||||
* The new values (e.g., compress) that are going to be
|
||||
* updated.
|
||||
*
|
||||
* @param aWhichFlags [in]
|
||||
@ -172,15 +167,11 @@ public:
|
||||
uint32_t aWhichFlags) = 0;
|
||||
|
||||
/* UpdatePresentationDataFromChildAt :
|
||||
* Sets displaystyle and compression flags on the whole tree. For child frames
|
||||
* at aFirstIndex up to aLastIndex, this method sets their displaystyle and
|
||||
* Sets compression flag on the whole tree. For child frames
|
||||
* at aFirstIndex up to aLastIndex, this method sets their
|
||||
* compression flags. The update is propagated down the subtrees of each of
|
||||
* these child frames.
|
||||
*
|
||||
* Note that <mstyle> is the only tag which allows
|
||||
* <mstyle displaystyle="true|false">
|
||||
* Therefore <mstyle> has its own peculiar version of this method.
|
||||
*
|
||||
* @param aFirstIndex [in]
|
||||
* Index of the first child from where the update is propagated.
|
||||
*
|
||||
@ -189,7 +180,7 @@ public:
|
||||
* A value of -1 means up to last existing child.
|
||||
*
|
||||
* @param aFlagsValues [in]
|
||||
* The new values (e.g., display, compress) that are going to be
|
||||
* The new values (e.g., compress) that are going to be
|
||||
* assigned in the whole sub-trees.
|
||||
*
|
||||
* @param aWhichFlags [in]
|
||||
@ -243,7 +234,7 @@ struct nsEmbellishData {
|
||||
// transmitted by our ancestors and is kept in sync with changes in our
|
||||
// descendants that affects us.
|
||||
struct nsPresentationData {
|
||||
// bits for: displaystyle, compressed, etc
|
||||
// bits for: compressed, etc
|
||||
uint32_t flags;
|
||||
|
||||
// handy pointer on our base child (the 'nucleus' in TeX), but it may be
|
||||
@ -265,14 +256,6 @@ struct nsPresentationData {
|
||||
// Bits used for the presentation flags -- these bits are set
|
||||
// in their relevant situation as they become available
|
||||
|
||||
// This bit is set if the frame is in the *context* of displaystyle=true.
|
||||
// Note: This doesn't mean that the frame has displaystyle=true as attribute,
|
||||
// the displaystyle attribute is only allowed on <mstyle> and <mtable>.
|
||||
// The bit merely tells the context of the frame. In the context of
|
||||
// displaystyle="false", it is intended to slightly alter how the
|
||||
// rendering is done in inline mode.
|
||||
#define NS_MATHML_DISPLAYSTYLE 0x00000001U
|
||||
|
||||
// This bit is used to emulate TeX rendering.
|
||||
// Internal use only, cannot be set by the user with an attribute.
|
||||
#define NS_MATHML_COMPRESSED 0x00000002U
|
||||
@ -289,11 +272,6 @@ struct nsPresentationData {
|
||||
// horizontal stretch command on all their non-empty children
|
||||
#define NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY 0x00000008U
|
||||
|
||||
// This bit is set if the frame has the explicit attribute
|
||||
// displaystyle="true" or "false". It is only relevant to <mstyle> and <mtable>
|
||||
// because they are the only tags where the attribute is allowed by the spec.
|
||||
#define NS_MATHML_EXPLICIT_DISPLAYSTYLE 0x00000020U
|
||||
|
||||
// This bit is set if the frame is "space-like", as defined by the spec.
|
||||
#define NS_MATHML_SPACE_LIKE 0x00000040U
|
||||
|
||||
@ -313,9 +291,6 @@ struct nsPresentationData {
|
||||
|
||||
// Macros that retrieve those bits
|
||||
|
||||
#define NS_MATHML_IS_DISPLAYSTYLE(_flags) \
|
||||
(NS_MATHML_DISPLAYSTYLE == ((_flags) & NS_MATHML_DISPLAYSTYLE))
|
||||
|
||||
#define NS_MATHML_IS_COMPRESSED(_flags) \
|
||||
(NS_MATHML_COMPRESSED == ((_flags) & NS_MATHML_COMPRESSED))
|
||||
|
||||
@ -325,9 +300,6 @@ struct nsPresentationData {
|
||||
#define NS_MATHML_WILL_STRETCH_ALL_CHILDREN_HORIZONTALLY(_flags) \
|
||||
(NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY == ((_flags) & NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY))
|
||||
|
||||
#define NS_MATHML_HAS_EXPLICIT_DISPLAYSTYLE(_flags) \
|
||||
(NS_MATHML_EXPLICIT_DISPLAYSTYLE == ((_flags) & NS_MATHML_EXPLICIT_DISPLAYSTYLE))
|
||||
|
||||
#define NS_MATHML_IS_SPACE_LIKE(_flags) \
|
||||
(NS_MATHML_SPACE_LIKE == ((_flags) & NS_MATHML_SPACE_LIKE))
|
||||
|
||||
|
@ -30,32 +30,6 @@ nsMathMLFrame::GetMathMLFrameType()
|
||||
return eMathMLFrameType_Ordinary;
|
||||
}
|
||||
|
||||
// snippet of code used by <mstyle>, <mtable> and <math> which are the only
|
||||
// three tags where the displaystyle attribute is allowed by the spec.
|
||||
/* static */ void
|
||||
nsMathMLFrame::FindAttrDisplaystyle(nsIContent* aContent,
|
||||
nsPresentationData& aPresentationData)
|
||||
{
|
||||
NS_ASSERTION(aContent->Tag() == nsGkAtoms::mstyle_ ||
|
||||
aContent->Tag() == nsGkAtoms::mtable_ ||
|
||||
aContent->Tag() == nsGkAtoms::math, "bad caller");
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsGkAtoms::_false, &nsGkAtoms::_true, nullptr};
|
||||
// see if the explicit displaystyle attribute is there
|
||||
switch (aContent->FindAttrValueIn(kNameSpaceID_None,
|
||||
nsGkAtoms::displaystyle_, strings, eCaseMatters)) {
|
||||
case 0:
|
||||
aPresentationData.flags &= ~NS_MATHML_DISPLAYSTYLE;
|
||||
aPresentationData.flags |= NS_MATHML_EXPLICIT_DISPLAYSTYLE;
|
||||
break;
|
||||
case 1:
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
aPresentationData.flags |= NS_MATHML_EXPLICIT_DISPLAYSTYLE;
|
||||
break;
|
||||
}
|
||||
// no reset if the attr isn't found. so be sure to call it on inherited flags
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
|
||||
{
|
||||
@ -73,9 +47,6 @@ nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent)
|
||||
nsPresentationData parentData;
|
||||
GetPresentationDataFrom(aParent, parentData);
|
||||
mPresentationData.mstyle = parentData.mstyle;
|
||||
if (NS_MATHML_IS_DISPLAYSTYLE(parentData.flags)) {
|
||||
mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
@ -88,20 +59,9 @@ NS_IMETHODIMP
|
||||
nsMathMLFrame::UpdatePresentationData(uint32_t aFlagsValues,
|
||||
uint32_t aWhichFlags)
|
||||
{
|
||||
NS_ASSERTION(NS_MATHML_IS_DISPLAYSTYLE(aWhichFlags) ||
|
||||
NS_MATHML_IS_COMPRESSED(aWhichFlags),
|
||||
"aWhichFlags should only be displaystyle or compression flag");
|
||||
NS_ASSERTION(NS_MATHML_IS_COMPRESSED(aWhichFlags),
|
||||
"aWhichFlags should only be compression flag");
|
||||
|
||||
// update flags that are relevant to this call
|
||||
if (NS_MATHML_IS_DISPLAYSTYLE(aWhichFlags)) {
|
||||
// updating the displaystyle flag is allowed
|
||||
if (NS_MATHML_IS_DISPLAYSTYLE(aFlagsValues)) {
|
||||
mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
else {
|
||||
mPresentationData.flags &= ~NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
}
|
||||
if (NS_MATHML_IS_COMPRESSED(aWhichFlags)) {
|
||||
// updating the compression flag is allowed
|
||||
if (NS_MATHML_IS_COMPRESSED(aFlagsValues)) {
|
||||
@ -187,11 +147,6 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
|
||||
break;
|
||||
|
||||
if (content->Tag() == nsGkAtoms::math) {
|
||||
const nsStyleDisplay* display = frame->StyleDisplay();
|
||||
if (display->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
|
||||
aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
|
||||
}
|
||||
FindAttrDisplaystyle(content, aPresentationData);
|
||||
aPresentationData.mstyle = frame->FirstContinuation();
|
||||
break;
|
||||
}
|
||||
|
@ -128,11 +128,6 @@ public:
|
||||
nsPresentationData& aPresentationData,
|
||||
bool aClimbTree = true);
|
||||
|
||||
// helper used by <mstyle> and <mtable> to see if they have a displaystyle attribute
|
||||
static void
|
||||
FindAttrDisplaystyle(nsIContent* aContent,
|
||||
nsPresentationData& aPresentationData);
|
||||
|
||||
// helper to check if a content has an attribute. If content is nullptr or if
|
||||
// the attribute is not there, check if the attribute is on the mstyle hierarchy
|
||||
// @return true --if attribute exists
|
||||
|
Loading…
Reference in New Issue
Block a user