RESOLVED FIXED 162824
[MathML] Render tree should be all clean by the end of FrameView::layout().
https://bugs.webkit.org/show_bug.cgi?id=162824
Summary [MathML] Render tree should be all clean by the end of FrameView::layout().
zalan
Reported 2016-09-30 19:20:54 PDT
We fail to clean all the renderers while running the following tests: LayoutTests/mathml/arbitrary-markup.html LayoutTests/mathml/invalid-scripts-crash.html LayoutTests/mathml/mn-as-list-item-assert.html LayoutTests/mathml/msubsup-fuzz.html LayoutTests/mathml/msubsup-no-grandchild.xhtml LayoutTests/mathml/roots-addChild.html LayoutTests/mathml/roots-removeChild.html LayoutTests/mathml/scripts-addChild.html LayoutTests/mathml/scripts-removeChild.html LayoutTests/mathml/wbr-in-mroot-crash.html
Attachments
Patch (4.37 KB, patch)
2016-10-21 13:11 PDT, Frédéric Wang (:fredw)
no flags
Patch (11.90 KB, patch)
2016-11-06 04:51 PST, Frédéric Wang (:fredw)
darin: review+
buildbot: commit-queue-
Archive of layout-test-results from ews117 for mac-yosemite (1.71 MB, application/zip)
2016-11-07 13:23 PST, Build Bot
no flags
Archive of layout-test-results from ews106 for mac-yosemite-wk2 (1.42 MB, application/zip)
2016-11-07 13:44 PST, Build Bot
no flags
Archive of layout-test-results from ews103 for mac-yosemite (1.03 MB, application/zip)
2016-11-07 14:19 PST, Build Bot
no flags
Patch (12.91 KB, patch)
2016-11-08 00:25 PST, Frédéric Wang (:fredw)
no flags
Patch (12.94 KB, patch)
2016-11-10 04:00 PST, Frédéric Wang (:fredw)
commit-queue: commit-queue-
Patch (12.93 KB, patch)
2016-11-12 04:17 PST, Frédéric Wang (:fredw)
no flags
zalan
Comment 1 2016-09-30 19:26:12 PDT
LayoutTests/accessibility/mac/mathml-multiscript.html
Frédéric Wang (:fredw)
Comment 2 2016-10-04 23:45:10 PDT
I see that there are several cases in bug 162834. Can you elaborate on what is meant by "clean the renderer" here? Is it a new concept recently introduced?
zalan
Comment 3 2016-10-05 07:19:29 PDT
(In reply to comment #2) > I see that there are several cases in bug 162834. Can you elaborate on what > is meant by "clean the renderer" here? Is it a new concept recently > introduced? It's the good old needsLayout flag. See https://trac.webkit.org/changeset/206743
Frédéric Wang (:fredw)
Comment 4 2016-10-05 07:35:14 PDT
(In reply to comment #3) > It's the good old needsLayout flag. See > https://trac.webkit.org/changeset/206743 Thanks. So from a quick look into this, the following pattern can be found in several places: https://trac.webkit.org/browser/trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp#L182 i.e. when the markup is invalid, set the needs layout flag to false and do an early return. I guess we should however still call layoutIfNeeded on children. The failing tests mentioned in comment 0 seem to produce some invalid markup, so that's consistent with this idea.
Frédéric Wang (:fredw)
Comment 5 2016-10-21 13:11:01 PDT
Created attachment 292389 [details] Patch @Brent: Can you please give a try to this patch? (I don't have a debug build to check the tests right now)
Frédéric Wang (:fredw)
Comment 6 2016-10-21 13:12:27 PDT
Comment on attachment 292389 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=292389&action=review > Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:252 > +{ Maybe we want to add a reference to https://bugs.webkit.org/show_bug.cgi?id=123348 here.
Frédéric Wang (:fredw)
Comment 7 2016-11-06 04:51:35 PST
Darin Adler
Comment 8 2016-11-06 10:34:00 PST
Comment on attachment 294020 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=294020&action=review > Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:251 > +void RenderMathMLBlock::layoutInvalidMarkup() This continues our unfortunate tradition of treating the noun "layout" as a verb. But, hey, until we rename layoutBlock, layoutIfNeeded and all the many other similarly named functions, I suppose I shouldn’t complain about adding one more. I still am not entirely sure, though, about the name. We are saying here that we need to "lay out invalid markup", but I think that’s not quite right. I think I might name this something more like layOutBlockContainingInvalidContent. Or maybe this could have a short name, but I would like to understand what the best short name would be. > Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:257 > + for (auto child = firstChildBox(); child; child = child->nextSiblingBox()) > + child->layoutIfNeeded(); If this is going to render as an empty box, as the comment above claims, then what are these children? Should we be destroying and removing them instead of calling layoutIfNeeded? > Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp:236 > + setPreferredLogicalWidthsDirty(false); One way to accomplish this without calling setPreferredLogicalWidthsDirty(false) twice would be to add another level of function nesting. The outer function could assert, call the function that does the work, and then set the flag to false. Another way would be to clear the dirty flag at the start of this function. It’s not clear to me if there is a requirement or benefit to clearing it only at the end.
Frédéric Wang (:fredw)
Comment 9 2016-11-06 11:07:19 PST
(In reply to comment #8) > This continues our unfortunate tradition of treating the noun "layout" as a > verb. But, hey, until we rename layoutBlock, layoutIfNeeded and all the many > other similarly named functions, I suppose I shouldn’t complain about adding > one more. > > I still am not entirely sure, though, about the name. We are saying here > that we need to "lay out invalid markup", but I think that’s not quite > right. I think I might name this something more like > layOutBlockContainingInvalidContent. Or maybe this could have a short name, > but I would like to understand what the best short name would be. For example <mfrac><mtext>numerator</mtext></mfrac> is invalid markup because the fraction misses a denominator but <mtext>numerator</mtext> by itself is valid. So the whole renderer (fraction) is invalid, not its content. Maybe layOutBlockForInvalidContent? > > Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:257 > > + for (auto child = firstChildBox(); child; child = child->nextSiblingBox()) > > + child->layoutIfNeeded(); > > If this is going to render as an empty box, as the comment above claims, > then what are these children? Should we be destroying and removing them > instead of calling layoutIfNeeded? Again, see above. We can have an <mfrac> element with an arbitrary number of (valid) MathML subtrees as children but the <mfrac> element itself is valid iff it has exactly two children. So I don't think we should destroy or remove them. At the moment, we basically just make the render tree match the DOM tree, and the renderer can become valid or invalid when children are added or removed (either during normal construction/destruction or when the user modifies the DOM tree).
Simon Fraser (smfr)
Comment 10 2016-11-06 22:06:29 PST
(In reply to comment #9) > <mfrac><mtext>numerator</mtext></mfrac> > > is invalid markup because the fraction misses a denominator but > <mtext>numerator</mtext> by itself is valid. So the whole renderer > (fraction) is invalid, not its content. Why don't we fix this kind of thing up at parsing time? For HTML we create anonymous boxes if necessary, but we don't ever lay out "invalid" markup. Simon
Frédéric Wang (:fredw)
Comment 11 2016-11-07 01:28:43 PST
(In reply to comment #10) > Why don't we fix this kind of thing up at parsing time? > > For HTML we create anonymous boxes if necessary, but we don't ever lay out > "invalid" markup. Sure, we can certainly do that and actually that would probably be the proper way to fix bug 123348 if we ever want to address it. It's not clear to me whether it's a good idea to modify the render tree when passing between valid/invalid states, though. Anyway, I believe this is out of the scope of the present bug for which we just want to call layoutIfNeeded on the whole render tree up, without modifying it.
Build Bot
Comment 12 2016-11-07 13:23:03 PST
Comment on attachment 294020 [details] Patch Attachment 294020 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/2468921 New failing tests: accessibility/mac/mathml-multiscript.html
Build Bot
Comment 13 2016-11-07 13:23:07 PST
Created attachment 294077 [details] Archive of layout-test-results from ews117 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews117 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 14 2016-11-07 13:44:17 PST
Comment on attachment 294020 [details] Patch Attachment 294020 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/2469071 New failing tests: accessibility/mac/mathml-multiscript.html
Build Bot
Comment 15 2016-11-07 13:44:21 PST
Created attachment 294082 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 16 2016-11-07 14:19:08 PST
Comment on attachment 294020 [details] Patch Attachment 294020 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/2469303 New failing tests: accessibility/mac/mathml-multiscript.html
Build Bot
Comment 17 2016-11-07 14:19:12 PST
Created attachment 294083 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Frédéric Wang (:fredw)
Comment 18 2016-11-08 00:25:27 PST
Frédéric Wang (:fredw)
Comment 19 2016-11-10 04:00:26 PST
WebKit Commit Bot
Comment 20 2016-11-12 04:12:15 PST
Comment on attachment 294358 [details] Patch Rejecting attachment 294358 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 294358, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in LayoutTests/ChangeLog contains OOPS!. Full output: http://webkit-queues.webkit.org/results/2503181
Frédéric Wang (:fredw)
Comment 21 2016-11-12 04:17:20 PST
WebKit Commit Bot
Comment 22 2016-11-12 06:53:57 PST
Comment on attachment 294612 [details] Patch Clearing flags on attachment: 294612 Committed r208648: <http://trac.webkit.org/changeset/208648>
WebKit Commit Bot
Comment 23 2016-11-12 06:54:06 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.