diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /layout/mathml | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/mathml')
-rw-r--r-- | layout/mathml/nsIMathMLFrame.h | 8 | ||||
-rw-r--r-- | layout/mathml/nsMathMLContainerFrame.cpp | 57 | ||||
-rw-r--r-- | layout/mathml/nsMathMLTokenFrame.cpp | 2 | ||||
-rw-r--r-- | layout/mathml/nsMathMLmencloseFrame.cpp | 4 | ||||
-rw-r--r-- | layout/mathml/nsMathMLmoFrame.cpp | 2 | ||||
-rw-r--r-- | layout/mathml/nsMathMLmpaddedFrame.cpp | 3 | ||||
-rw-r--r-- | layout/mathml/nsMathMLmrootFrame.cpp | 19 | ||||
-rw-r--r-- | layout/mathml/nsMathMLmspaceFrame.cpp | 1 | ||||
-rw-r--r-- | layout/mathml/tests/chrome.toml | 9 |
9 files changed, 22 insertions, 83 deletions
diff --git a/layout/mathml/nsIMathMLFrame.h b/layout/mathml/nsIMathMLFrame.h index f27ef806e9..efe550e0fa 100644 --- a/layout/mathml/nsIMathMLFrame.h +++ b/layout/mathml/nsIMathMLFrame.h @@ -291,11 +291,6 @@ struct nsPresentationData { // feature setting. #define NS_MATHML_DTLS 0x00000080U -// This bit is set when the frame cannot be formatted due to an -// error (e.g., invalid markup such as a <msup> without an overscript). -// When set, a visual feedback will be provided to the user. -#define NS_MATHML_ERROR 0x80000000U - // a bit used for debug #define NS_MATHML_STRETCH_DONE 0x20000000U @@ -324,9 +319,6 @@ struct nsPresentationData { #define NS_MATHML_IS_DTLS_SET(_flags) \ (NS_MATHML_DTLS == ((_flags) & NS_MATHML_DTLS)) -#define NS_MATHML_HAS_ERROR(_flags) \ - (NS_MATHML_ERROR == ((_flags) & NS_MATHML_ERROR)) - #define NS_MATHML_STRETCH_WAS_DONE(_flags) \ (NS_MATHML_STRETCH_DONE == ((_flags) & NS_MATHML_STRETCH_DONE)) diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index 7a62146504..b63792c288 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -33,45 +33,6 @@ NS_QUERYFRAME_HEAD(nsMathMLContainerFrame) NS_QUERYFRAME_ENTRY(nsMathMLContainerFrame) NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame) -// ============================================================================= - -namespace mozilla { - -class nsDisplayMathMLError : public nsPaintedDisplayItem { - public: - nsDisplayMathMLError(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) - : nsPaintedDisplayItem(aBuilder, aFrame) { - MOZ_COUNT_CTOR(nsDisplayMathMLError); - } - MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLError) - - virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override; - NS_DISPLAY_DECL_NAME("MathMLError", TYPE_MATHML_ERROR) -}; - -void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder, - gfxContext* aCtx) { - // Set color and font ... - RefPtr<nsFontMetrics> fm = - nsLayoutUtils::GetFontMetricsForFrame(mFrame, 1.0f); - - nsPoint pt = ToReferenceFrame(); - int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel(); - DrawTarget* drawTarget = aCtx->GetDrawTarget(); - Rect rect = NSRectToSnappedRect(nsRect(pt, mFrame->GetSize()), - appUnitsPerDevPixel, *drawTarget); - ColorPattern red(ToDeviceColor(sRGBColor(1.f, 0.f, 0.f, 1.f))); - drawTarget->FillRect(rect, red); - - aCtx->SetColor(sRGBColor::OpaqueWhite()); - nscoord ascent = fm->MaxAscent(); - constexpr auto errorMsg = u"invalid-markup"_ns; - nsLayoutUtils::DrawUniDirString(errorMsg.get(), uint32_t(errorMsg.Length()), - nsPoint(pt.x, pt.y + ascent), *fm, *aCtx); -} - -} // namespace mozilla - /* ///////////// * nsIMathMLFrame - support methods for stretchy elements * ============================================================================= @@ -244,11 +205,6 @@ nsMathMLContainerFrame::Stretch(DrawTarget* aDrawTarget, } mPresentationData.flags |= NS_MATHML_STRETCH_DONE; - if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) { - NS_WARNING("it is wrong to fire stretch on a erroneous frame"); - return NS_OK; - } - // Pass the stretch to the base child ... nsIFrame* baseFrame = mPresentationData.baseFrame; @@ -341,7 +297,7 @@ nsMathMLContainerFrame::Stretch(DrawTarget* aDrawTarget, // re-position all our children nsresult rv = Place(aDrawTarget, true, aDesiredStretchSize); - if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) { + if (NS_FAILED(rv)) { // Make sure the child frames get their DidReflow() calls. DidReflowChildren(mFrames.FirstChild()); } @@ -430,7 +386,7 @@ nsresult nsMathMLContainerFrame::FinalizeReflow(DrawTarget* aDrawTarget, // that still needs it here (or we may crash - bug 366012). // If placeOrigin is false we should reach Place() with aPlaceOrigin == true // through Stretch() eventually. - if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) { + if (NS_FAILED(rv)) { GatherAndStoreOverflow(&aDesiredSize); DidReflowChildren(PrincipalChildList().FirstChild()); return rv; @@ -566,14 +522,6 @@ void nsMathMLContainerFrame::PropagatePresentationDataFromChildAt( void nsMathMLContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { - // report an error if something wrong was found in this frame - if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) { - if (!IsVisibleForPainting()) return; - - aLists.Content()->AppendNewToTop<nsDisplayMathMLError>(aBuilder, this); - return; - } - BuildDisplayListForInline(aBuilder, aLists); #if defined(DEBUG) && defined(SHOW_BOUNDING_BOX) @@ -798,7 +746,6 @@ void nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext, MarkInReflow(); MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); - mPresentationData.flags &= ~NS_MATHML_ERROR; aDesiredSize.Width() = aDesiredSize.Height() = 0; aDesiredSize.SetBlockStartAscent(0); aDesiredSize.mBoundingMetrics = nsBoundingMetrics(); diff --git a/layout/mathml/nsMathMLTokenFrame.cpp b/layout/mathml/nsMathMLTokenFrame.cpp index 5481e6faec..61cb65ef87 100644 --- a/layout/mathml/nsMathMLTokenFrame.cpp +++ b/layout/mathml/nsMathMLTokenFrame.cpp @@ -116,8 +116,6 @@ void nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext, MarkInReflow(); MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); - mPresentationData.flags &= ~NS_MATHML_ERROR; - // initializations needed for empty markup like <mtag></mtag> aDesiredSize.ClearSize(); aDesiredSize.SetBlockStartAscent(0); diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index 1b8a03991b..9f0afc9857 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -206,8 +206,6 @@ void nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // paint the menclosed content nsMathMLContainerFrame::BuildDisplayList(aBuilder, aLists); - if (NS_MATHML_HAS_ERROR(mPresentationData.flags)) return; - nsRect mencloseRect = nsIFrame::GetRect(); mencloseRect.x = mencloseRect.y = 0; @@ -322,7 +320,7 @@ nsresult nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget, ReflowOutput baseSize(aDesiredSize.GetWritingMode()); nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, false, baseSize); - if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) { + if (NS_FAILED(rv)) { DidReflowChildren(PrincipalChildList().FirstChild()); return rv; } diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index 45c61124df..e0d68234ae 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -732,7 +732,7 @@ nsMathMLmoFrame::Stretch(DrawTarget* aDrawTarget, // Place our children using the default method // This will allow our child text frame to get its DidReflow() nsresult rv = Place(aDrawTarget, true, aDesiredStretchSize); - if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) { + if (NS_FAILED(rv)) { // Make sure the child frames get their DidReflow() calls. DidReflowChildren(mFrames.FirstChild()); } diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index 07711fefa9..930a87f698 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -303,7 +303,6 @@ void nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext, nsReflowStatus& aStatus) { MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); - mPresentationData.flags &= ~NS_MATHML_ERROR; ProcessAttributes(); /////////////// @@ -317,7 +316,7 @@ void nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext, nsresult nsMathMLmpaddedFrame::Place(DrawTarget* aDrawTarget, bool aPlaceOrigin, ReflowOutput& aDesiredSize) { nsresult rv = nsMathMLContainerFrame::Place(aDrawTarget, false, aDesiredSize); - if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) { + if (NS_FAILED(rv)) { DidReflowChildren(PrincipalChildList().FirstChild()); return rv; } diff --git a/layout/mathml/nsMathMLmrootFrame.cpp b/layout/mathml/nsMathMLmrootFrame.cpp index c74767d777..5e8d65f8a8 100644 --- a/layout/mathml/nsMathMLmrootFrame.cpp +++ b/layout/mathml/nsMathMLmrootFrame.cpp @@ -80,20 +80,18 @@ void nsMathMLmrootFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, ///////////// // paint the sqrt symbol - if (!NS_MATHML_HAS_ERROR(mPresentationData.flags)) { - mSqrChar.Display(aBuilder, this, aLists, 0); + mSqrChar.Display(aBuilder, this, aLists, 0); - DisplayBar(aBuilder, this, mBarRect, aLists); + 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); + // 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, @@ -162,7 +160,6 @@ void nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext, MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); nsReflowStatus childStatus; - mPresentationData.flags &= ~NS_MATHML_ERROR; aDesiredSize.ClearSize(); aDesiredSize.SetBlockStartAscent(0); diff --git a/layout/mathml/nsMathMLmspaceFrame.cpp b/layout/mathml/nsMathMLmspaceFrame.cpp index 49746df8e4..1f87c095df 100644 --- a/layout/mathml/nsMathMLmspaceFrame.cpp +++ b/layout/mathml/nsMathMLmspaceFrame.cpp @@ -93,7 +93,6 @@ void nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext, MarkInReflow(); MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); - mPresentationData.flags &= ~NS_MATHML_ERROR; ProcessAttributes(aPresContext); auto borderPadding = aReflowInput.ComputedPhysicalBorderPadding(); diff --git a/layout/mathml/tests/chrome.toml b/layout/mathml/tests/chrome.toml index ec3d54556e..f3c23766f1 100644 --- a/layout/mathml/tests/chrome.toml +++ b/layout/mathml/tests/chrome.toml @@ -1,6 +1,15 @@ +# WARNING: This directory was used for MathML mochitests and is only preserved +# for the ones that cannot be rewritten as web-platform-tests. +# If you want to add new tests for MathML, please instead consider adding them +# to `testing/web-platform/tests/mathml` (for MathML Core tests) or to +# `testing/web-platform/mozilla/tests/mathml/` (for Gecko-specific tests). + [DEFAULT] support-files = ["test_disabled_chrome_iframe.html"] prefs = ["mathml.disabled=true"] +# FIXME(bug 1847206): Rather than a chrome mochitest, this should probably be a +# browser mochitest, because the goal was to check `mathml.disabled` doesn't +# apply to the user interface. ["test_disabled_chrome.html"] |