MWImageNode: getHashObject -> getHashObjectForRendering

The latter was introduced for this very purpose: defining
which attributes affect the rendering (in this case the
thumbnail URL). getHashObject should be reserved for making
full semantic comparisons.

Bonus: Don't distinguish between block/inline images
for URL caching purposes.

Change-Id: I6e6d2547a0d110f07c4d18b8179c168d8c251059
This commit is contained in:
Ed Sanders 2018-02-24 12:15:55 +00:00
parent 3d93d195c7
commit d17121d1f3
2 changed files with 9 additions and 4 deletions

View file

@ -76,9 +76,14 @@ ve.dm.MWImageNode.static.getRdfa = function ( mediaClass, frameType ) {
}[ frameType ];
};
ve.dm.MWImageNode.static.getHashObject = function ( dataElement ) {
/**
* @inheritdoc ve.dm.GeneratedContentNode
*/
ve.dm.MWImageNode.static.getHashObjectForRendering = function ( dataElement ) {
// "Rendering" is just the URL of the thumbnail, so we only
// care about src & dimensions
return {
type: dataElement.type,
type: 'mwImage',
resource: dataElement.attributes.resource,
width: dataElement.attributes.width,
height: dataElement.attributes.height

View file

@ -280,7 +280,7 @@ ve.dm.mwExample.MWBlockImage = {
{ type: '/mwBlockImage' }
],
storeItems: {
heedc6ea02e1424e1: ve.ce.minImgDataUri
h5ca4c84da870e58f: ve.ce.minImgDataUri
}
};
@ -308,7 +308,7 @@ ve.dm.mwExample.MWInlineImage = {
}
},
storeItems: {
h9e4c46abce8374a6: 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
hbb0aeb2b8e907b74: 'http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
}
};