Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(pptx-to-svg): reject gradient tile flips

hugohe31ff9328c8c88
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 6add4127..b31c384a 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -770,6 +770,10 @@ The local SVG gradient rotates with its containing geometry. Imported
base default or be the exact XML booleans `1` / `true`. Explicit `0` / `false`
and malformed booleans stop import instead of detaching the gradient direction
from the shape during rotation.
+Project SVG has no gradient-tile flip mapping. Imported `a:gradFill@flip` may
+therefore be omitted for the documented Office `none` baseline or be exactly
+`none`; `x`, `y`, `xy`, malformed, and unknown values stop import instead of
+becoming an ordinary unflipped gradient.
The quality checker and exporter preflight both validate definition location,
references, gradient structure, and paint context from the same closed contract.
diff --git a/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py
index e5fc8764..b1c6449d 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py
@@ -120,6 +120,7 @@ def _resolve_grad_fill(elem: ET.Element, palette: ColorPalette | None,
prefix: str, seq, placeholder_hex: str | None) -> FillResult:
"""Convert <a:gradFill> to an SVG linearGradient or radialGradient."""
_validate_gradient_rotation(elem)
+ _validate_gradient_flip(elem)
if seq is None:
seq = [0]
seq[0] += 1
@@ -273,6 +274,13 @@ def _validate_gradient_rotation(gradient: ET.Element) -> None:
)
+def _validate_gradient_flip(gradient: ET.Element) -> None:
+ """Reject gradient tile flipping absent from project SVG."""
+ flip = gradient.get("flip", "none")
+ if flip != "none":
+ raise ValueError(f"Unsupported DrawingML gradient flip: {flip!r}")
+
+
def _parse_ooxml_boolean(
raw: str | None,
*,
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 275c0c6e..de361ee2 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -3076,6 +3076,32 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
):
resolve_rotation(rotates)
+ def test_native_gradient_flip_must_be_none(self):
+ def resolve_flip(flip: str | None):
+ flip_attr = '' if flip is None else f' flip="{flip}"'
+ sp_pr = ET.fromstring(f'''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:gradFill{flip_attr}>
+ <a:gsLst>
+ <a:gs pos="0"><a:srgbClr val="112233"/></a:gs>
+ </a:gsLst>
+ </a:gradFill>
+</p:spPr>''')
+ return resolve_fill(sp_pr, None)
+
+ for flip in (None, 'none'):
+ with self.subTest(valid_flip=flip):
+ self.assertTrue(resolve_flip(flip).defs)
+
+ for flip in ('', 'x', 'y', 'xy', 'None', 'futureFlip'):
+ with self.subTest(unsupported_flip=flip):
+ with self.assertRaisesRegex(
+ ValueError,
+ 'Unsupported DrawingML gradient flip',
+ ):
+ resolve_flip(flip)
+
def test_compound_native_line_is_rejected_on_import(self):
for compound in ('dbl', 'thickThin', 'thinThick', 'tri'):
with self.subTest(compound=compound):