Page MenuHomePhabricator

Incorrect image sizes in Parsoid's gallery output (compared to the php native extension's output)
Closed, DuplicatePublic

Description

Compare the image gallery in native PHP gallery output vs the one in Parsoid gallery output.

The image sizes are different.

@Arlolra thinks this is due to missing JS in Parsoid output. Filing it here just so that we can look at this, and if yes, merge this as a duplicate of another ticket.

Event Timeline

Compare the HTML for PHP,

<ul class="gallery mw-gallery-packed">
<li class="gallerybox" style="width: 198px">
<div style="width: 198px">
<div class="thumb" style="width: 196px;">
<div style="margin:0px auto;"><a href="/wiki/File:Western_Forge_Craftsman_screwdrivers.jpg" class="image"><img alt="" src="//upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/294px-Western_Forge_Craftsman_screwdrivers.jpg" width="196" height="120" srcset="//upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/441px-Western_Forge_Craftsman_screwdrivers.jpg 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/588px-Western_Forge_Craftsman_screwdrivers.jpg 2x" data-file-width="3264" data-file-height="2000" /></a></div>
</div>
<div class="gallerytext">
<p>Two screwdrivers.</p>
</div>
</div>
</li>
...

versus Parsoid,

<ul class="gallery mw-gallery-packed" typeof="mw:Extension/gallery" about="#mwt118" data-mw='{"name":"gallery","attrs":{"mode":"packed"},"body":{"extsrc":"\nImage:Western Forge Craftsman screwdrivers.jpg|Two screwdrivers.\nImage:Craftsman full polish ratchet.jpg|A full polish [[socket wrench|ratchet]].\nImage:Craftsman roundhead ratchet.jpg|A roundhead ratchet.\nImage:Craftsman thin profile ratchet.jpg|A thin profile ratchet.\nImage:Craftsman premium ratchet.jpg|A fine-tooth \"premium\" ratchet.\nImage:Companion wrenches.jpg|Companion [[combination wrench]]es.\nImage:Craftsman raised panel wrenches.jpg|Raised panel combination wrenches.\nImage:Craftsman pawless ratcheting wrenches.jpg|Double box-end ratcheting wrenches.\nImage:Craftsman Professional long pattern combination wrenches.jpg|Craftsman Professional long pattern combination wrenches.\nImage:Craftsman Professional reversible ratcheting wrenches.jpg|Craftsman Professional reversible ratcheting wrenches.\nImage:Craftsman Industrial deep offset wrenches.jpg|Craftsman Industrial deep offset wrenches.\nImage:Western Forge Craftsman adjustable wrenches.jpg|Two [[adjustable wrench]]es.\nImage:Craftsman tool chest.jpg|A Craftsman tool chest.\n"}}' id="mwag">
<li class="gallerybox" style="width: 198px;"><div class="thumb" style="width: 196px;"><span typeof="mw:Image"><a href="./File:Western_Forge_Craftsman_screwdrivers.jpg"><img resource="./File:Western_Forge_Craftsman_screwdrivers.jpg" src="//upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/294px-Western_Forge_Craftsman_screwdrivers.jpg" data-file-width="3264" data-file-height="2000" data-file-type="bitmap" srcset="//upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/588px-Western_Forge_Craftsman_screwdrivers.jpg 2x, //upload.wikimedia.org/wikipedia/en/thumb/d/d9/Western_Forge_Craftsman_screwdrivers.jpg/441px-Western_Forge_Craftsman_screwdrivers.jpg 1.5x" height="120" width="196"/></a></span></div><div class="gallerytext">Two screwdrivers.</div></li>
...

The dimensions are the same.

It's only after a flash of JS that they are computed differently.