Split out of #3.
Shapes wrapped in mc:AlternateContent are never drawn. They survive a load and save because we keep unknown XML verbatim, but the layout engine never sees them, so nothing is rendered and no space is reserved.
Cause
Word writes a shape as a compatibility block. The modern DrawingML version goes in mc:Choice and a VML fallback goes in mc:Fallback:
<mc:AlternateContent>
<mc:Choice Requires="wps"><w:drawing>...</w:drawing></mc:Choice>
<mc:Fallback><w:pict><v:shape .../></w:pict></mc:Fallback>
</mc:AlternateContent>
CT_R::from_xml knows about w:drawing but not about mc:AlternateContent, so the whole block falls into the unknown element branch and is captured as raw XML. The w:drawing inside it is never parsed into a RunContent::Drawing, so it never reaches layout.
In the file attached to #3 there are five of these, and every one of them is invisible in our output.
Fix
Handle mc:AlternateContent in the run parser. Descend into mc:Choice when we support what it requires, and fall back to mc:Fallback otherwise. Keeping the raw copy for write back is still fine, the point is to also parse the content so layout can use it.
Rendering the shape geometry itself is a separate and larger job. This issue is only about the drawing inside mc:Choice becoming visible to layout, which also fixes the reserved space.
Split out of #3.
Shapes wrapped in
mc:AlternateContentare never drawn. They survive a load and save because we keep unknown XML verbatim, but the layout engine never sees them, so nothing is rendered and no space is reserved.Cause
Word writes a shape as a compatibility block. The modern DrawingML version goes in
mc:Choiceand a VML fallback goes inmc:Fallback:CT_R::from_xmlknows aboutw:drawingbut not aboutmc:AlternateContent, so the whole block falls into the unknown element branch and is captured as raw XML. Thew:drawinginside it is never parsed into aRunContent::Drawing, so it never reaches layout.In the file attached to #3 there are five of these, and every one of them is invisible in our output.
Fix
Handle
mc:AlternateContentin the run parser. Descend intomc:Choicewhen we support what it requires, and fall back tomc:Fallbackotherwise. Keeping the raw copy for write back is still fine, the point is to also parse the content so layout can use it.Rendering the shape geometry itself is a separate and larger job. This issue is only about the drawing inside
mc:Choicebecoming visible to layout, which also fixes the reserved space.