Last modified: 2013-09-30 16:20:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56584, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54584 - VisualEditor: MWExtensionNode/GeneratedContentNode should avoid emitting 'rerender' twice when rendering <img>s
VisualEditor: MWExtensionNode/GeneratedContentNode should avoid emitting 'rer...
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Technical Debt (Other open bugs)
unspecified
All All
: Normal normal
: VE-deploy-2013-10-03
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-25 01:30 UTC by Roan Kattouw
Modified: 2013-09-30 16:20 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Roan Kattouw 2013-09-25 01:30:30 UTC
ce.MWExtensionNode.onParseSuccess contains the following code:

	// Rerender after images load
	this.$.find( 'img' ).on( 'load', ve.bind( function () {
		this.emit( 'rerender' );
	}, this ) );

Problems:
* Why is this in MWExtensionNode? Shouldn't it just be in GCNode?
* This potentially emits multiple rerender events, one for each image
* The first rerender event has already been emitted because we've already resolved the promise and attached the nodes to the DOM

What we should really do is attach the nodes somewhere else (where?) so that the images load, then reattach them to a wrapper and resolve the promise with that. That way we only emit rerender once, and we correctly only resolve the promise once everything has actually loaded.

In practice, this means the math inspector moves around twice after typing LaTeX in certain cases: once because of the 'rerender' event caused by the <img> tag being put on the page (at which point it measures 0x0), and once because of the 'rerender' event caused by the image actually loading (at which point it measures correctly).

Open questions:
* How does this work for images with invalid/unavailable sources?
* Really what we care about here is the dimensions of the images. If those are known, we can render the node without its dimensions changing later
Comment 1 Roan Kattouw 2013-09-26 21:59:05 UTC
https://gerrit.wikimedia.org/r/#/c/86167/ fixes this

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links