mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1918989 - Remove disabled SHOW_BOUNDING_BOX MathML code. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D222260
This commit is contained in:
parent
1073967876
commit
0e828932f8
@ -3,7 +3,6 @@
|
||||
/* 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/. */
|
||||
// #define SHOW_BOUNDING_BOX 1
|
||||
#ifndef nsIMathMLFrame_h___
|
||||
#define nsIMathMLFrame_h___
|
||||
|
||||
@ -294,12 +293,6 @@ struct nsPresentationData {
|
||||
// a bit used for debug
|
||||
#define NS_MATHML_STRETCH_DONE 0x20000000U
|
||||
|
||||
// This bit is used for visual debug. When set, the bounding box
|
||||
// of your frame is painted. This visual debug enable to ensure that
|
||||
// you have properly filled your mReference and mBoundingMetrics in
|
||||
// Place().
|
||||
#define NS_MATHML_SHOW_BOUNDING_METRICS 0x10000000U
|
||||
|
||||
// Macros that retrieve those bits
|
||||
|
||||
#define NS_MATHML_IS_COMPRESSED(_flags) \
|
||||
@ -322,10 +315,6 @@ struct nsPresentationData {
|
||||
#define NS_MATHML_STRETCH_WAS_DONE(_flags) \
|
||||
(NS_MATHML_STRETCH_DONE == ((_flags) & NS_MATHML_STRETCH_DONE))
|
||||
|
||||
#define NS_MATHML_PAINT_BOUNDING_METRICS(_flags) \
|
||||
(NS_MATHML_SHOW_BOUNDING_METRICS == \
|
||||
((_flags) & NS_MATHML_SHOW_BOUNDING_METRICS))
|
||||
|
||||
// ==========================================================================
|
||||
// Bits used for the embellish flags -- these bits are set
|
||||
// in their relevant situation as they become available
|
||||
|
@ -1809,12 +1809,6 @@ void nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
|
||||
if (isSelected) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayMathMLSelectionRect>(
|
||||
aBuilder, aForFrame, *aSelectedRect);
|
||||
} else if (mRect.width && mRect.height) {
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
// for visual debug
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayMathMLCharDebug>(
|
||||
aBuilder, aForFrame, mRect);
|
||||
#endif
|
||||
}
|
||||
aLists.Content()->AppendNewToTopWithIndex<nsDisplayMathMLCharForeground>(
|
||||
aBuilder, aForFrame, aIndex, this, isSelected);
|
||||
|
@ -569,16 +569,6 @@ void nsMathMLContainerFrame::PropagatePresentationDataFromChildAt(
|
||||
void nsMathMLContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
BuildDisplayListForInline(aBuilder, aLists);
|
||||
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
// for visual debug
|
||||
// ----------------
|
||||
// if you want to see your bounding box, make sure to properly fill
|
||||
// your mBoundingMetrics and mReference point, and set
|
||||
// mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS
|
||||
// in the Init() of your sub-class
|
||||
DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Note that this method re-builds the automatic data in the children -- not
|
||||
|
@ -53,10 +53,6 @@ nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent) {
|
||||
nsPresentationData parentData;
|
||||
GetPresentationDataFrom(aParent, parentData);
|
||||
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -258,46 +254,6 @@ void nsMathMLFrame::ParseNumericValue(const nsString& aString,
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
class nsDisplayMathMLBoundingMetrics final : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayMathMLBoundingMetrics(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, const nsRect& aRect)
|
||||
: nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
|
||||
MOZ_COUNT_CTOR(nsDisplayMathMLBoundingMetrics);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLBoundingMetrics)
|
||||
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
NS_DISPLAY_DECL_NAME("MathMLBoundingMetrics", TYPE_MATHML_BOUNDING_METRICS)
|
||||
private:
|
||||
nsRect mRect;
|
||||
};
|
||||
|
||||
void nsDisplayMathMLBoundingMetrics::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
DrawTarget* drawTarget = aCtx->GetDrawTarget();
|
||||
Rect r = NSRectToRect(mRect + ToReferenceFrame(),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
ColorPattern blue(ToDeviceColor(Color(0.f, 0.f, 1.f, 1.f)));
|
||||
drawTarget->StrokeRect(r, blue);
|
||||
}
|
||||
|
||||
void nsMathMLFrame::DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, const nsPoint& aPt,
|
||||
const nsBoundingMetrics& aMetrics,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!NS_MATHML_PAINT_BOUNDING_METRICS(mPresentationData.flags)) return;
|
||||
|
||||
nscoord x = aPt.x + aMetrics.leftBearing;
|
||||
nscoord y = aPt.y - aMetrics.ascent;
|
||||
nscoord w = aMetrics.rightBearing - aMetrics.leftBearing;
|
||||
nscoord h = aMetrics.ascent + aMetrics.descent;
|
||||
|
||||
aLists.Content()->AppendNewToTop<nsDisplayMathMLBoundingMetrics>(
|
||||
aBuilder, aFrame, nsRect(x, y, w, h));
|
||||
}
|
||||
#endif
|
||||
|
||||
class nsDisplayMathMLBar final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
|
@ -268,13 +268,6 @@ class nsMathMLFrame : public nsIMathMLFrame {
|
||||
nscoord& aRadicalVerticalGap);
|
||||
|
||||
protected:
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
void DisplayBoundingMetrics(mozilla::nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, const nsPoint& aPt,
|
||||
const nsBoundingMetrics& aMetrics,
|
||||
const nsDisplayListSet& aLists);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Display a solid rectangle in the frame's text color. Used for drawing
|
||||
* fraction separators and root/sqrt overbars.
|
||||
|
@ -84,12 +84,6 @@ void nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
mMathMLChar.Display(aBuilder, this, aLists, 0,
|
||||
isSelected ? &selectedRect : nullptr);
|
||||
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
// for visual debug
|
||||
DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics,
|
||||
aLists);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,15 +83,6 @@ void nsMathMLmrootFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
mSqrChar.Display(aBuilder, this, aLists, 0);
|
||||
|
||||
DisplayBar(aBuilder, this, mBarRect, aLists);
|
||||
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
// for visual debug
|
||||
nsRect rect;
|
||||
mSqrChar.GetRect(rect);
|
||||
nsBoundingMetrics bm;
|
||||
mSqrChar.GetBoundingMetrics(bm);
|
||||
DisplayBoundingMetrics(aBuilder, this, rect.TopLeft(), bm, aLists);
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsMathMLmrootFrame::GetRadicalXOffsets(nscoord aIndexWidth,
|
||||
|
Loading…
Reference in New Issue
Block a user