From 250b89bc6adc55d4b6fb45b9ef9035657e34ecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20Wang?= Date: Thu, 29 Nov 2012 17:52:02 -0500 Subject: [PATCH] Bug 459363 - Fix computation of intrinsic width for and elements. r=karlt --- layout/mathml/nsMathMLmpaddedFrame.cpp | 8 +++++ layout/mathml/nsMathMLmpaddedFrame.h | 4 +++ layout/mathml/nsMathMLmspaceFrame.cpp | 12 +++++++ layout/mathml/nsMathMLmspaceFrame.h | 4 +++ layout/reftests/mathml/dir-3.html | 4 +-- .../munderover-align-accent-false-ref.html | 16 ++++----- .../mathml/munderover-align-accent-false.html | 18 +++++----- .../munderover-align-accent-true-ref.html | 16 ++++----- .../mathml/munderover-align-accent-true.html | 18 +++++----- layout/reftests/mathml/reftest.list | 1 + layout/reftests/mathml/table-width-2-ref.html | 36 +++++++++++++++++++ layout/reftests/mathml/table-width-2.html | 36 +++++++++++++++++++ 12 files changed, 137 insertions(+), 36 deletions(-) create mode 100644 layout/reftests/mathml/table-width-2-ref.html create mode 100644 layout/reftests/mathml/table-width-2.html diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index b72b13c8a042..835ae89da6f1 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -444,3 +444,11 @@ nsMathMLmpaddedFrame::Place(nsRenderingContext& aRenderingContext, return NS_OK; } + +/* virtual */ nsresult +nsMathMLmpaddedFrame::MeasureForWidth(nsRenderingContext& aRenderingContext, + nsHTMLReflowMetrics& aDesiredSize) +{ + ProcessAttributes(); + return Place(aRenderingContext, false, aDesiredSize); +} diff --git a/layout/mathml/nsMathMLmpaddedFrame.h b/layout/mathml/nsMathMLmpaddedFrame.h index 8c9e0f08eb33..80e4a0a703f5 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.h +++ b/layout/mathml/nsMathMLmpaddedFrame.h @@ -45,6 +45,10 @@ protected: virtual int GetSkipSides() const { return 0; } + virtual nsresult + MeasureForWidth(nsRenderingContext& aRenderingContext, + nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; + private: nsCSSValue mWidth; nsCSSValue mHeight; diff --git a/layout/mathml/nsMathMLmspaceFrame.cpp b/layout/mathml/nsMathMLmspaceFrame.cpp index bfad75d05420..338f46cb0efb 100644 --- a/layout/mathml/nsMathMLmspaceFrame.cpp +++ b/layout/mathml/nsMathMLmspaceFrame.cpp @@ -125,3 +125,15 @@ nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext, NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize); return NS_OK; } + +/* virtual */ nsresult +nsMathMLmspaceFrame::MeasureForWidth(nsRenderingContext& aRenderingContext, + nsHTMLReflowMetrics& aDesiredSize) +{ + ProcessAttributes(PresContext()); + mBoundingMetrics = nsBoundingMetrics(); + mBoundingMetrics.width = NS_MAX(0, mWidth); + aDesiredSize.width = mBoundingMetrics.width; + aDesiredSize.mBoundingMetrics = mBoundingMetrics; + return NS_OK; +} diff --git a/layout/mathml/nsMathMLmspaceFrame.h b/layout/mathml/nsMathMLmspaceFrame.h index c92d4a7f5261..fbf4ebecb6c7 100644 --- a/layout/mathml/nsMathMLmspaceFrame.h +++ b/layout/mathml/nsMathMLmspaceFrame.h @@ -42,6 +42,10 @@ protected: virtual int GetSkipSides() const { return 0; } + virtual nsresult + MeasureForWidth(nsRenderingContext& aRenderingContext, + nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; + private: nscoord mWidth; nscoord mHeight; diff --git a/layout/reftests/mathml/dir-3.html b/layout/reftests/mathml/dir-3.html index 43d9f410e56a..e2d2f3813a73 100644 --- a/layout/reftests/mathml/dir-3.html +++ b/layout/reftests/mathml/dir-3.html @@ -73,7 +73,7 @@ - +
@@ -91,7 +91,7 @@ - +
diff --git a/layout/reftests/mathml/munderover-align-accent-false-ref.html b/layout/reftests/mathml/munderover-align-accent-false-ref.html index e500ce29d3be..2cb30b028276 100644 --- a/layout/reftests/mathml/munderover-align-accent-false-ref.html +++ b/layout/reftests/mathml/munderover-align-accent-false-ref.html @@ -9,35 +9,35 @@
- + Over < Base < Under - + - + Over > Base > Under - + - + Over = Under < Base - + - + Over = Under > Base - + diff --git a/layout/reftests/mathml/munderover-align-accent-false.html b/layout/reftests/mathml/munderover-align-accent-false.html index 1dd316c5c825..4c9ac4376cfe 100644 --- a/layout/reftests/mathml/munderover-align-accent-false.html +++ b/layout/reftests/mathml/munderover-align-accent-false.html @@ -9,35 +9,35 @@ - + Over < Base < Under - + - + Over > Base > Under - + - + Over = Under < Base - + - + Over = Under > Base - + @@ -49,7 +49,7 @@ - + diff --git a/layout/reftests/mathml/munderover-align-accent-true-ref.html b/layout/reftests/mathml/munderover-align-accent-true-ref.html index 2ca5eb30454f..acfe1d9f02ab 100644 --- a/layout/reftests/mathml/munderover-align-accent-true-ref.html +++ b/layout/reftests/mathml/munderover-align-accent-true-ref.html @@ -9,35 +9,35 @@ - + Over < Base < Under - + - + Over > Base > Under - + - + Over = Under < Base - + - + Over = Under > Base - + diff --git a/layout/reftests/mathml/munderover-align-accent-true.html b/layout/reftests/mathml/munderover-align-accent-true.html index d2f2795f20ae..dd1e44c94737 100644 --- a/layout/reftests/mathml/munderover-align-accent-true.html +++ b/layout/reftests/mathml/munderover-align-accent-true.html @@ -9,35 +9,35 @@ - + Over < Base < Under - + - + Over > Base > Under - + - + Over = Under < Base - + - + Over = Under > Base - + @@ -49,7 +49,7 @@ - + diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list index 42d4a40d189c..b09b479634b7 100644 --- a/layout/reftests/mathml/reftest.list +++ b/layout/reftests/mathml/reftest.list @@ -37,6 +37,7 @@ fails-if(winWidget) == mfenced-10.html mfenced-10-ref.html == quotes-1.xhtml quotes-1-ref.xhtml != stretchy-underbar-1.xhtml stretchy-underbar-1-ref.xhtml == table-width-1.xhtml table-width-1-ref.xhtml +== table-width-2.html table-width-2-ref.html == underbar-width-1.xhtml underbar-width-1-ref.xhtml == mathml-type-supported.xhtml mathml-type-supported-ref.xml == mtable-align-negative-rownumber.html mtable-align-negative-rownumber-ref.html diff --git a/layout/reftests/mathml/table-width-2-ref.html b/layout/reftests/mathml/table-width-2-ref.html new file mode 100644 index 000000000000..8b2c09bb7955 --- /dev/null +++ b/layout/reftests/mathml/table-width-2-ref.html @@ -0,0 +1,36 @@ + + + + table-width-2 + + + + + + +

+ + + + | + + | + + + +

+ +

+ + + + | + + | + + + +

+ + + diff --git a/layout/reftests/mathml/table-width-2.html b/layout/reftests/mathml/table-width-2.html new file mode 100644 index 000000000000..a66eaa5ef993 --- /dev/null +++ b/layout/reftests/mathml/table-width-2.html @@ -0,0 +1,36 @@ + + + + table-width-2 + + + + + + +

+ + + + | + + | + + + +

+ +

+ + + + | + + | + + + +

+ + +