Closed Bug 569125 (mstyle) Opened 15 years ago Closed 14 years ago

Complete/Improve implementation of mstyle

Categories

(Core :: MathML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla6

People

(Reporter: fredw, Assigned: fredw)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(9 files, 5 obsolete files)

(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
karlt
: review-
Details | Diff | Splinter Review
(deleted), patch
karlt
: review+
Details | Diff | Splinter Review
(deleted), patch
Details | Diff | Splinter Review
(deleted), application/xhtml+xml
Details
MathML3 says: "The mstyle element is used to make style changes that affect the rendering of its contents. It can be given any attribute accepted by any other presentation element, except for the attributes described below. In addition, the mstyle element can be given certain special attributes listed in the next subsection." The exceptions are: - attributes height, depth or width on mstyle apply to mspace, not to mglyph, mpadded, or mtable. - attributes rowalign, columnalign, or groupalign on mstyle apply to mtable, not to mtr, mlabeledtr, mtd, and maligngroup. - attribute lspace on mstyle applies to mo, not to mpadded. - attribute voffset on mstyle does not apply to mpadded. - attribute fontfamily on mstyle does not apply to mglyph. - attribute index cannot be set on mstyle. - attribute align on mstyle applies to the munder, mover, and munderover, not mtable and mstack. - attributes src, alt on mglyph and actiontype on maction cannot be set on mstyle. The additional attributes are: - scriptlevel - displaystyle - scriptsizemultiplier - scriptminsize - infixlinebreakstyle - decimal point It is quite complicated and apparently our implementation does not always follow these rules. I suggest to add a comment each time we use a MathML attribute to explicitly say whether the attribute may be taken from a mstyle or if we are in the case of one of the exception above. This will prevent interrogation such that http://mxr.mozilla.org/mozilla-central/source/layout/mathml/nsMathMLmtableFrame.cpp#587 Also, we should add reftests for mstyle (I already have a patch with some tests for that). Apparently, there are currently problems with * mfenced: open, close, separators * mfrac: bevelled * menclose: notation * mover/munder/munderover: accent, accentunder and probably other attributes defined in mathml.css such that those of tabular elements...
Alias: mstyle
Blocks: mathml-2
Attached patch Add reftests for mstyle (obsolete) (deleted) — Splinter Review
I attach a patch adding reftests for attributes that are currently accessed by GetAttribute, FindAttrValueIn or GetAttr (not all of nsMathMLmtableFrame and nsMathMLTokenFrame, though).
(In reply to comment #1) > Created attachment 450334 [details] [diff] [review] > Add reftests for mstyle These tests look good, thanks. Did you mean them for landing now? I sent them to try server but got some failures. http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1280365345.1280367211.25331.gz (Load layout/tools/reftest/reftest-analyzer.xhtml in the browser and paste the REFTEST output of the failures.)
> Did you mean them for landing now? I think my intention was to fix the mstyle's bugs before. But maybe we can already send a patch with the failing tests disabled. > I sent them to try server but got some failures. > http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1280365345.1280367211.25331.gz Yes, that's what I say here: > Apparently, there are currently problems with > > * mfenced: open, close, separators > * mfrac: bevelled > * menclose: notation > * mover/munder/munderover: accent, accentunder and apparently, there are also problems with maction and the lquote/rquote of ms. Sometimes we obviously don't use GetAttribute (for example to catch the notation of menclose) and sometimes it is not placed correctly (for mfrac, it seems that mIsBevelled should be updated in nsMathMLmfracFrame::PlaceInternal, just like mLineThickness).
Attached patch Add reftests for mstyle (V2) (obsolete) (deleted) — Splinter Review
Attachment #450334 - Attachment is obsolete: true
Attached patch Patch - part 1 (obsolete) (deleted) — Splinter Review
Attached patch Patch - part 2 (deleted) — Splinter Review
Attached patch Patch - part 3 (deleted) — Splinter Review
Attached patch Patch - part 4 (obsolete) (deleted) — Splinter Review
Attached patch Patch - part 5 (deleted) — Splinter Review
Attached patch Patch - part 6 (deleted) — Splinter Review
Keywords: dev-doc-needed
Attached patch Patch - part 7 (obsolete) (deleted) — Splinter Review
Attached patch Add reftests for mstyle (V3) (deleted) — Splinter Review
Attachment #500681 - Attachment is obsolete: true
Blocks: 449396
No longer depends on: 449396
Attachment #500685 - Attachment is obsolete: true
Attached patch Patch - part 7 (mathvariant) (deleted) — Splinter Review
Attachment #500814 - Attachment is obsolete: true
Attachment #500682 - Flags: review?(karlt)
Attachment #500683 - Flags: review?(karlt)
Attachment #500684 - Flags: review?(karlt)
Attachment #525326 - Flags: review?(karlt)
Attachment #500686 - Flags: review?(karlt)
Attachment #500687 - Flags: review?(karlt)
Attachment #525327 - Flags: review?(karlt)
Attachment #500815 - Flags: review?(karlt)
Comment on attachment 500682 [details] [diff] [review] Patch - part 1 I assume the extra () is unintentional?
Attachment #500682 - Flags: review?(karlt) → review+
Attachment #500683 - Flags: review?(karlt) → review+
Comment on attachment 500684 [details] [diff] [review] Patch - part 3 Yes, InheritAutomaticData seems a better place to check for attribute changes than Place/Reflow.
Attachment #500684 - Flags: review?(karlt) → review+
(In reply to comment #15) > Comment on attachment 500682 [details] [diff] [review] [review] > Patch - part 1 > > I assume the extra () is unintentional? Yes, it seems I copy it from a if statement.
Comment on attachment 525326 [details] [diff] [review] Patch - part 4 ("lquote" and "rquote") ># HG changeset patch ># Parent bb6d5c8592dd5061392e23d8f8d082355b4b3ba7 ># User Frédéric Wang <fred.wang@free.fr> >Support for attribute "lquote" and "rquote" on mstyle (bug 569125). r=karlt >+nsMathMLTokenFrame::InheritAutomaticData(nsIFrame* aParent) >+{ >+ // let the base class get the default from our parent >+ nsMathMLContainerFrame::InheritAutomaticData(aParent); >+ >+ SetQuotes(PR_TRUE); Is it necessary to have aNotify == PR_TRUE here? nsGenericDOMDataNode uses RunDOMEventWhenSafe() so I guess that's OK if necessary. I don't understand why it is necessary in AttributeChanged() either and I didn't find an explanation in bug 476547.
Attachment #500686 - Flags: review?(karlt) → review+
> Is it necessary to have aNotify == PR_TRUE here? > > nsGenericDOMDataNode uses RunDOMEventWhenSafe() so I guess that's OK if > necessary. I think I tried with aNotify == PR_FALSE but it didn't work (not 100% sure, just a memory that I suspected aNotify == PR_TRUE could be less efficient) > I don't understand why it is necessary in AttributeChanged() either and I > didn't find an explanation in bug 476547. Robert may know.
Comment on attachment 525327 [details] [diff] [review] Patch - part 7 (mathvariant) Looks like the mathvariant change is correct. I'm not sure whether or not we should do the same with fontstyle. Did mstyle affect defaults on all presentation element attributes prior to the deprecation of fontstyle.
Attachment #500687 - Flags: review?(karlt) → review+
> I'm not sure whether or not we should do the same with fontstyle. > Did mstyle affect defaults on all presentation element attributes prior to > the deprecation of fontstyle. I think so, but I guess we don't need to bother about deprecated attributes. We didn't in the content part: http://hg.mozilla.org/mozilla-central/file/a45b5cf1d625/content/mathml/content/src/nsMathMLElement.cpp#l123
Comment on attachment 500815 [details] [diff] [review] Add reftests for mstyle (V3) Nice and comprehensive, thanks!
Attachment #500815 - Flags: review?(karlt) → review+
Comment on attachment 525327 [details] [diff] [review] Patch - part 7 (mathvariant) (In reply to comment #21) > I think so, but I guess we don't need to bother about deprecated attributes. > We didn't in the content part: I'm fine with including fontstyle, especially since you already have the patch. "fontfamily" is specifically mentioned, which implies that fontstyle should have the default behavior.
Attachment #525327 - Flags: review?(karlt) → review+
Attached patch Patch - part 1 ("selection") (deleted) — Splinter Review
Attachment #500682 - Attachment is obsolete: true
Attached file testcase lquote rquote (deleted) —
It seems to work without aNotify = PR_TRUE in both functions. However, I think nsMathMLTokenFrame::SetQuotes should also set the quote to the default value " when an attribute is removed.
(In reply to comment #18) > Is it necessary to have aNotify == PR_TRUE here? > > nsGenericDOMDataNode uses RunDOMEventWhenSafe() so I guess that's OK if > necessary. > I don't understand why it is necessary in AttributeChanged() either and I > didn't find an explanation in bug 476547. We have to make sure nsGenericDOMDataNode::SetTextInternal fires its nsNodeUtils::CharacterDataWillChange and nsNodeUtils::CharacterDataChanged notifications, otherwise the nsTextFrames for the quotes will get out of sync with the DOM text, which can cause bad crashes, such as in bug 476547.
OK, so I guess aNotify == PR_TRUE should also be used in InheritAutomaticData. I've opened bug 656391 for the issue indicated in comment 25.
(In reply to comment #26) > We have to make sure nsGenericDOMDataNode::SetTextInternal fires its > nsNodeUtils::CharacterDataWillChange and nsNodeUtils::CharacterDataChanged > notifications, otherwise the nsTextFrames for the quotes will get out of > sync with the DOM text, which can cause bad crashes, such as in bug 476547. Thanks. Is it safe to have CharacterDataWillChange/CharacterDataChanged run during AppendFrames/InsertFrames/RemoveFrame?
Comment on attachment 525326 [details] [diff] [review] Patch - part 4 ("lquote" and "rquote") Apparently it is not safe during SetInitialChildList anyway. This is while loading mstyle-1.xhtml: ###!!! ASSERTION: recurring into frame construction: 'mPresContext->mLayoutPhaseCount[eLayoutPhase_FrameC] == 0', file ../../../layout/base/nsPresContext.h, line 1407 nsAutoLayoutPhase::Enter [nsPresContext.h:1408] nsAutoLayoutPhase::nsAutoLayoutPhase [nsPresContext.h:1374] nsCSSFrameConstructor::CharacterDataChanged [nsCSSFrameConstructor.cpp:7870] PresShell::CharacterDataChanged [nsPresShell.cpp:4943] nsNodeUtils::CharacterDataChanged [nsNodeUtils.cpp:111] nsGenericDOMDataNode::SetTextInternal [nsGenericDOMDataNode.cpp:394] nsGenericDOMDataNode::SetText [nsGenericDOMDataNode.cpp:1048] nsIContent::SetText [nsIContent.h:548] SetQuote [nsMathMLTokenFrame.cpp:416] nsMathMLTokenFrame::SetQuotes [nsMathMLTokenFrame.cpp:433] nsMathMLTokenFrame::InheritAutomaticData [nsMathMLTokenFrame.cpp:68] nsMathMLContainerFrame::RebuildAutomaticDataForChildren [nsMathMLContainerFrame.cpp:702] nsMathMLContainerFrame::RebuildAutomaticDataForChildren [nsMathMLContainerFrame.cpp:703] nsMathMLmathInlineFrame::SetInitialChildList [nsMathMLContainerFrame.h:486] nsCSSFrameConstructor::ConstructFrameFromItemInternal [nsCSSFrameConstructor.cpp:3780] nsCSSFrameConstructor::ConstructFramesFromItem [nsCSSFrameConstructor.cpp:5476] nsCSSFrameConstructor::ConstructFramesFromItemList [nsCSSFrameConstructor.cpp:9486] nsCSSFrameConstructor::ProcessChildren [nsCSSFrameConstructor.cpp:9626] nsCSSFrameConstructor::ConstructTableCell [nsCSSFrameConstructor.cpp:2145] nsCSSFrameConstructor::ConstructFrameFromItemInternal [nsCSSFrameConstructor.cpp:3708] nsCSSFrameConstructor::ConstructFramesFromItem [nsCSSFrameConstructor.cpp:5476] nsCSSFrameConstructor::ConstructFramesFromItemList [nsCSSFrameConstructor.cpp:9486] nsCSSFrameConstructor::ProcessChildren [nsCSSFrameConstructor.cpp:9626] nsCSSFrameConstructor::ConstructTableRow [nsCSSFrameConstructor.cpp:2006] nsCSSFrameConstructor::ConstructFrameFromItemInternal [nsCSSFrameConstructor.cpp:3708] nsCSSFrameConstructor::ConstructFramesFromItem [nsCSSFrameConstructor.cpp:5476] nsCSSFrameConstructor::ConstructFramesFromItemList [nsCSSFrameConstructor.cpp:9486] nsCSSFrameConstructor::ProcessChildren [nsCSSFrameConstructor.cpp:9626] nsCSSFrameConstructor::ConstructFrameFromItemInternal [nsCSSFrameConstructor.cpp:3797] nsCSSFrameConstructor::ConstructFramesFromItem [nsCSSFrameConstructor.cpp:5476] nsCSSFrameConstructor::ConstructFramesFromItemList [nsCSSFrameConstructor.cpp:9486] nsCSSFrameConstructor::ProcessChildren [nsCSSFrameConstructor.cpp:9626] nsCSSFrameConstructor::ConstructTable [nsCSSFrameConstructor.cpp:1952] nsCSSFrameConstructor::ConstructFrameFromItemInternal [nsCSSFrameConstructor.cpp:3708] nsCSSFrameConstructor::ConstructFramesFromItem [nsCSSFrameConstructor.cpp:5476] nsCSSFrameConstructor::ConstructFramesFromItemList [nsCSSFrameConstructor.cpp:9486] nsCSSFrameConstructor::ContentAppended [nsCSSFrameConstructor.cpp:6675] nsCSSFrameConstructor::CreateNeededFrames [nsCSSFrameConstructor.cpp:6332] nsCSSFrameConstructor::CreateNeededFrames [nsCSSFrameConstructor.cpp:6335] nsCSSFrameConstructor::CreateNeededFrames [nsCSSFrameConstructor.cpp:6354] PresShell::FlushPendingNotifications [nsPresShell.cpp:4829] I think we should land the rest of the changes. quotes seem more difficult.
Attachment #525326 - Flags: review?(karlt) → review-
> I think we should land the rest of the changes. quotes seem more difficult. That sounds good. Probably, the best way to deal with the case of quotes is bug 560100. Should mstyle-1 reftest be marked as "fails"?
Depends on: 560100
Assignee: nobody → fred.wang
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla6
Flags: in-testsuite+
Depends on: 787215
No longer depends on: 560100
No longer depends on: 787215
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: