ranger-compiler 3.5.1 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1064 -20
- package/LICENSE +3 -1
- package/README.md +123 -28
- package/dist/Lang.rgr +1188 -290
- package/dist/api.d.ts +2343 -879
- package/dist/api.js +79923 -56921
- package/dist/lib/JSON.rgr +102 -91
- package/dist/lib/Shell.rgr +4 -4
- package/dist/lib/apple/AppleToolchain.rgr +4 -4
- package/dist/lib/apple/README.md +5 -4
- package/dist/lib/apple/apple_test.rgr +1 -1
- package/dist/lib/core/README.md +1 -1
- package/dist/lib/evg/EVG.rgr +12 -0
- package/dist/lib/evg/EVGA11yFromTree.rgr +302 -0
- package/dist/lib/evg/EVGA11yTree.rgr +894 -0
- package/dist/lib/evg/EVGBox.rgr +267 -0
- package/dist/lib/evg/EVGBoxShorthandTest.rgr +220 -0
- package/dist/lib/evg/EVGCodepoint.rgr +316 -0
- package/dist/lib/evg/EVGColor.rgr +700 -0
- package/dist/lib/evg/EVGCommands.rgr +177 -0
- package/dist/lib/evg/EVGComponent.rgr +331 -0
- package/dist/lib/evg/EVGComponentTest.rgr +387 -0
- package/dist/lib/evg/EVGConnector.rgr +541 -0
- package/dist/lib/evg/EVGConnectorTest.rgr +306 -0
- package/dist/lib/evg/EVGDisplayList.rgr +4186 -0
- package/dist/lib/evg/EVGEasing.rgr +370 -0
- package/dist/lib/evg/EVGEffectTest.rgr +253 -0
- package/dist/lib/evg/EVGElement.rgr +4914 -0
- package/dist/lib/evg/EVGFixedTest.rgr +289 -0
- package/dist/lib/evg/EVGFlexRulesTest.rgr +317 -0
- package/dist/lib/evg/EVGFlexWrapTest.rgr +246 -0
- package/dist/lib/evg/EVGFling.rgr +244 -0
- package/dist/lib/evg/EVGFocus.rgr +400 -0
- package/dist/lib/evg/EVGFocusTest.rgr +399 -0
- package/dist/lib/evg/EVGGradient.rgr +322 -0
- package/dist/lib/evg/EVGGrapheme.rgr +190 -0
- package/dist/lib/evg/EVGGrid.rgr +975 -0
- package/dist/lib/evg/EVGHitTest.rgr +208 -0
- package/dist/lib/evg/EVGHoles.rgr +294 -0
- package/dist/lib/evg/EVGHostMeasurerTest.rgr +281 -0
- package/dist/lib/evg/EVGHostTextMeasurer.rgr +331 -0
- package/dist/lib/evg/EVGHostTree.rgr +834 -0
- package/dist/lib/evg/EVGHostTreeTest.rgr +447 -0
- package/dist/lib/evg/EVGImageDecode.rgr +117 -0
- package/dist/lib/evg/EVGImageMeasurer.rgr +86 -0
- package/dist/lib/evg/EVGInspect.rgr +883 -0
- package/dist/lib/evg/EVGInvalidateTest.rgr +432 -0
- package/dist/lib/evg/EVGJsonTest.rgr +535 -0
- package/dist/lib/evg/EVGLayout.rgr +4220 -0
- package/dist/lib/evg/EVGMeasure.rgr +1267 -0
- package/dist/lib/evg/EVGOverlayTest.rgr +626 -0
- package/dist/lib/evg/EVGPatch.rgr +1721 -0
- package/dist/lib/evg/EVGPatchTest.rgr +692 -0
- package/dist/lib/evg/EVGPopoverTest.rgr +395 -0
- package/dist/lib/evg/EVGReconcile.rgr +226 -0
- package/dist/lib/evg/EVGReconcileTest.rgr +421 -0
- package/dist/lib/evg/EVGReject.rgr +126 -0
- package/dist/lib/evg/EVGRelayoutTest.rgr +375 -0
- package/dist/lib/evg/EVGRtlLayoutTest.rgr +319 -0
- package/dist/lib/evg/EVGRuler.rgr +232 -0
- package/dist/lib/evg/EVGRulerTest.rgr +172 -0
- package/dist/lib/evg/EVGSelectChrome.rgr +178 -0
- package/dist/lib/evg/EVGStyleCacheTest.rgr +419 -0
- package/dist/lib/evg/EVGStyleSheet.rgr +2148 -0
- package/dist/lib/evg/EVGStyleStateTest.rgr +407 -0
- package/dist/lib/evg/EVGStyleVarTest.rgr +471 -0
- package/dist/lib/evg/EVGText.rgr +105 -0
- package/dist/lib/evg/EVGTextEngine.rgr +536 -0
- package/dist/lib/evg/EVGTextMeasurer.rgr +720 -0
- package/dist/lib/evg/EVGTimingTest.rgr +1417 -0
- package/dist/lib/evg/EVGToolbar.rgr +1369 -0
- package/dist/lib/evg/EVGTransition.rgr +728 -0
- package/dist/lib/evg/EVGTreeJson.rgr +721 -0
- package/dist/lib/evg/EVGUnit.rgr +554 -0
- package/dist/lib/evg/EVGViewportUnitTest.rgr +236 -0
- package/dist/lib/evg/EvgApp.rgr +189 -0
- package/dist/lib/evg/EvgBitmapTracer.rgr +4277 -0
- package/dist/lib/evg/EvgBitmapTracerTest.rgr +2119 -0
- package/dist/lib/evg/EvgHost.rgr +451 -0
- package/dist/lib/evg/EvgTest.rgr +91 -0
- package/dist/lib/evg/EvgTraceColor.rgr +236 -0
- package/dist/lib/evg/EvgTraceCurve.rgr +648 -0
- package/dist/lib/evg/EvgTraceFit.rgr +767 -0
- package/dist/lib/evg/EvgTracePath.rgr +435 -0
- package/dist/lib/evg/EvgTraceTypes.rgr +559 -0
- package/dist/lib/evg/EvgViewport.rgr +313 -0
- package/dist/lib/evg/FxDemoDoc.rgr +185 -0
- package/dist/lib/evg/HOSTS.md +227 -0
- package/dist/lib/evg/ISSUES.md +835 -0
- package/dist/lib/evg/PLAN_ACCESSIBILITY.md +650 -0
- package/dist/lib/evg/PLAN_CSS_LAYOUT_AND_FONTS.md +1124 -0
- package/dist/lib/evg/PLAN_EFFECTS.md +431 -0
- package/dist/lib/evg/PLAN_EVG.md +518 -0
- package/dist/lib/evg/PLAN_EVG_RENDERER.md +1674 -0
- package/dist/lib/evg/PLAN_INSPECTOR.md +788 -0
- package/dist/lib/evg/PLAN_LINKS_AND_FORMS.md +157 -0
- package/dist/lib/evg/PLAN_NATIVE_HOSTS.md +671 -0
- package/dist/lib/evg/PLAN_VECTOR_IR.md +664 -0
- package/dist/lib/evg/PLAN_VIEW_TRANSFORM.md +322 -0
- package/dist/lib/evg/PathBuilder.rgr +333 -0
- package/dist/lib/evg/README.md +1236 -0
- package/dist/lib/evg/SPEC.md +1252 -0
- package/dist/lib/evg/SVGPathParser.rgr +1199 -0
- package/dist/lib/evg/SvgParser.rgr +1736 -0
- package/dist/lib/evg/TODO_EVG_RENDERER.md +595 -0
- package/dist/lib/evg/VectorShapes.rgr +331 -0
- package/dist/lib/evg/VectorStroke.rgr +107 -0
- package/dist/lib/evg/VectorViewBox.rgr +380 -0
- package/dist/lib/evg/agent/README.md +290 -0
- package/dist/lib/evg/agent/evg_agent.rgr +899 -0
- package/dist/lib/evg/agent/fixtures/broken.evg.json +7 -0
- package/dist/lib/evg/agent/fixtures/card.evg.json +9 -0
- package/dist/lib/evg/agent/fixtures/connector.css +63 -0
- package/dist/lib/evg/agent/fixtures/connector.evg.json +14 -0
- package/dist/lib/evg/agent/fixtures/drawn.evg.json +129 -0
- package/dist/lib/evg/agent/fixtures/gradient.evg.json +4 -0
- package/dist/lib/evg/agent/fixtures/popover.css +99 -0
- package/dist/lib/evg/agent/fixtures/popover.evg.json +30 -0
- package/dist/lib/evg/agent/roundtrip.sh +74 -0
- package/dist/lib/evg/agent/smoke.sh +230 -0
- package/dist/lib/evg/android/README.md +97 -0
- package/dist/lib/evg/android/androidstubs/AndroidStubs.kt +175 -0
- package/dist/lib/evg/android/androidstubs/Annotation.kt +10 -0
- package/dist/lib/evg/android/androidstubs/App.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Content.kt +41 -0
- package/dist/lib/evg/android/androidstubs/ContentRes.kt +12 -0
- package/dist/lib/evg/android/androidstubs/InputMethod.kt +46 -0
- package/dist/lib/evg/android/androidstubs/Net.kt +6 -0
- package/dist/lib/evg/android/androidstubs/Os.kt +30 -0
- package/dist/lib/evg/android/androidstubs/Util.kt +15 -0
- package/dist/lib/evg/android/androidstubs/View.kt +113 -0
- package/dist/lib/evg/android/androidstubs/Widget.kt +16 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidEvgSurface.kt +323 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/AndroidTextMeasurer.kt +56 -0
- package/dist/lib/evg/android/src/android/kotlin/fi/ranger/evg/RippleEffect.kt +262 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtEvgSurface.kt +238 -0
- package/dist/lib/evg/android/src/awt/kotlin/fi/ranger/evg/AwtTextMeasurer.kt +85 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgEngineThread.kt +115 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgPainter.kt +231 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/EvgSurface.kt +117 -0
- package/dist/lib/evg/android/src/main/kotlin/fi/ranger/evg/RecordingSurface.kt +94 -0
- package/dist/lib/evg/apple/README.md +128 -0
- package/dist/lib/evg/apple/Sources/CoreGraphicsEvgSurface.swift +329 -0
- package/dist/lib/evg/apple/Sources/CoreTextMeasurer.swift +70 -0
- package/dist/lib/evg/apple/Sources/EvgEngineQueue.swift +105 -0
- package/dist/lib/evg/apple/Sources/EvgPainter.swift +225 -0
- package/dist/lib/evg/apple/Sources/EvgSurface.swift +163 -0
- package/dist/lib/evg/apple/Sources/RecordingSurface.swift +110 -0
- package/dist/lib/evg/bench/EvgLayoutBench.rgr +34 -0
- package/dist/lib/evg/bench/README.md +64 -0
- package/dist/lib/evg/bench/layout-bench.mjs +316 -0
- package/dist/lib/evg/bench/layout-cases.mjs +510 -0
- package/dist/lib/evg/bench/layout-conformance.mjs +254 -0
- package/dist/lib/evg/bin/.gitignore +17 -0
- package/dist/lib/evg/evg_test.rgr +313 -0
- package/dist/lib/evg/gl/README.md +198 -0
- package/dist/lib/evg/gl/a11y-paint-check.mjs +73 -0
- package/dist/lib/evg/gl/blur-check.mjs +399 -0
- package/dist/lib/evg/gl/boxmodel.json +1 -0
- package/dist/lib/evg/gl/demo.html +46 -0
- package/dist/lib/evg/gl/effect-presets.css +285 -0
- package/dist/lib/evg/gl/effect-presets.js +63 -0
- package/dist/lib/evg/gl/effect-shots.mjs +135 -0
- package/dist/lib/evg/gl/evg-a11y.js +566 -0
- package/dist/lib/evg/gl/evg-binary.js +160 -0
- package/dist/lib/evg/gl/evg-engine.js +296 -0
- package/dist/lib/evg/gl/evg-fx.js +237 -0
- package/dist/lib/evg/gl/evg-gestures.js +209 -0
- package/dist/lib/evg/gl/evg-list.js +167 -0
- package/dist/lib/evg/gl/evg-measure.js +186 -0
- package/dist/lib/evg/gl/evg-textinput.js +303 -0
- package/dist/lib/evg/gl/evg-view.js +144 -0
- package/dist/lib/evg/gl/evg-webgl.js +3942 -0
- package/dist/lib/evg/gl/fx-check.mjs +998 -0
- package/dist/lib/evg/gl/fx-demo.html +166 -0
- package/dist/lib/evg/gl/fx-demo.js +2 -0
- package/dist/lib/evg/gl/fx-serve.mjs +47 -0
- package/dist/lib/evg/gl/gestures-check.mjs +189 -0
- package/dist/lib/evg/gl/list-binary-check.mjs +152 -0
- package/dist/lib/evg/gl/measure-check.mjs +135 -0
- package/dist/lib/evg/gl/rotation-check.mjs +207 -0
- package/dist/lib/evg/gl/shift-check.mjs +113 -0
- package/dist/lib/evg/gl/stroke-check.mjs +168 -0
- package/dist/lib/evg/gl/text-snap-check.mjs +139 -0
- package/dist/lib/evg/gl/view-check.mjs +343 -0
- package/dist/lib/evg/gl/view-policy-check.mjs +184 -0
- package/dist/lib/evg/html/evg-dom.js +318 -0
- package/dist/lib/evg/html/evg-html.js +600 -0
- package/dist/lib/evg/inspect/README.md +415 -0
- package/dist/lib/evg/inspect/browser-smoke.mjs +115 -0
- package/dist/lib/evg/inspect/evg-inspect.js +947 -0
- package/dist/lib/evg/inspect/shots/css.png +0 -0
- package/dist/lib/evg/inspect/shots/dashboard.png +0 -0
- package/dist/lib/evg/inspect/shots/pptx-slide.png +0 -0
- package/dist/lib/evg/inspect/shots/state.png +0 -0
- package/dist/lib/evg/inspect/shots.mjs +226 -0
- package/dist/lib/evg/oracle/css-blur.json +576 -0
- package/dist/lib/evg/oracle/css-box.json +157 -0
- package/dist/lib/evg/oracle/css-timing.json +709 -0
- package/dist/lib/evg/oracle/css_blur_oracle.mjs +529 -0
- package/dist/lib/evg/oracle/css_box_oracle.mjs +106 -0
- package/dist/lib/evg/oracle/css_timing_oracle.mjs +389 -0
- package/dist/lib/evg/original/EVGColor.clj +310 -0
- package/dist/lib/evg/original/EVGColorContext.rgr +178 -0
- package/dist/lib/evg/original/SVGPath.rgr +627 -0
- package/dist/lib/evg/original/Vec2.crgr +103 -0
- package/dist/lib/evg/ranger.json +9 -0
- package/dist/lib/evg/showcase/README.md +246 -0
- package/dist/lib/evg/showcase/assets/emblem.svg +30 -0
- package/dist/lib/evg/showcase/assets/rosette.svg +22 -0
- package/dist/lib/evg/showcase/build.mjs +651 -0
- package/dist/lib/evg/showcase/pages/album.tsx +30 -0
- package/dist/lib/evg/showcase/pages/boxmodel.tsx +37 -0
- package/dist/lib/evg/showcase/pages/cards.tsx +41 -0
- package/dist/lib/evg/showcase/pages/chart_api.tsx +170 -0
- package/dist/lib/evg/showcase/pages/charts.tsx +219 -0
- package/dist/lib/evg/showcase/pages/drawing.tsx +160 -0
- package/dist/lib/evg/showcase/pages/emoji.tsx +91 -0
- package/dist/lib/evg/showcase/pages/flex.tsx +46 -0
- package/dist/lib/evg/showcase/pages/more.tsx +332 -0
- package/dist/lib/evg/showcase/pages/plots.tsx +262 -0
- package/dist/lib/evg/showcase/pages/svg.tsx +63 -0
- package/dist/lib/evg/showcase/pages/tables.tsx +209 -0
- package/dist/lib/evg/showcase/pages/typography.tsx +43 -0
- package/dist/lib/evg/showcase/pages/units.tsx +35 -0
- package/dist/lib/evg/showcase/pages/variants.tsx +233 -0
- package/dist/lib/evg/showcase/pages/vector.tsx +75 -0
- package/dist/lib/evg/showcase/pages/views.tsx +223 -0
- package/dist/lib/evg/showcase/tests/chart_api_smoke.mjs +339 -0
- package/dist/lib/evg/showcase/tests/gl_smoke.mjs +125 -0
- package/dist/lib/evg/showcase/themes/chart_api-default.css +15 -0
- package/dist/lib/evg/showcase/themes/charts-default.css +29 -0
- package/dist/lib/evg/showcase/themes/drawing-default.css +35 -0
- package/dist/lib/evg/showcase/themes/more-default.css +128 -0
- package/dist/lib/evg/showcase/themes/plots-default.css +18 -0
- package/dist/lib/evg/showcase/themes/showcase.css +508 -0
- package/dist/lib/evg/showcase/themes/tables-default.css +123 -0
- package/dist/lib/evg/showcase/themes/variants-default.css +15 -0
- package/dist/lib/evg/showcase/themes/views-default.css +15 -0
- package/dist/lib/evg/tools/bench_vs_potrace.mjs +290 -0
- package/dist/lib/evg/tools/evg_image_tool.rgr +488 -0
- package/dist/lib/evg/tools/evg_trace_bench.rgr +114 -0
- package/dist/lib/evg/tools/evg_trace_cli.rgr +662 -0
- package/dist/lib/evg/tools/evg_trace_cpp_bench.rgr +83 -0
- package/dist/lib/evg/tools/run_trace_bench.sh +74 -0
- package/dist/lib/evg/tools/run_trace_cli_smoke.sh +128 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveCheck.rgr +271 -0
- package/dist/lib/evg/web/responsive/EvgResponsiveDemo.rgr +531 -0
- package/dist/lib/evg/web/responsive/README.md +97 -0
- package/dist/lib/evg/web/responsive/build.mjs +90 -0
- package/dist/lib/evg/web/responsive/dom-check.mjs +169 -0
- package/dist/lib/evg/web/responsive/index.html +177 -0
- package/dist/lib/evg/web/responsive/smoke.mjs +221 -0
- package/dist/lib/evg/web/tools/assets-client.mjs +95 -0
- package/dist/lib/evg/web/tools/boot-bench.mjs +189 -0
- package/dist/lib/evg/web/tools/inline-assets.mjs +119 -0
- package/dist/lib/evg/web/tools/minify.mjs +60 -0
- package/dist/lib/evg/web/tracer/build.mjs +87 -0
- package/dist/lib/evg/web/tracer/index.html +2805 -0
- package/dist/lib/evg/web/tracer/sample.png +0 -0
- package/dist/lib/evg/web/tracer/smoke.mjs +1162 -0
- package/dist/lib/evgr/Cargo.lock +21 -0
- package/dist/lib/evgr/Cargo.toml +19 -0
- package/dist/lib/evgr/README.md +140 -0
- package/dist/lib/evgr/bench/NativeBench.rgr +246 -0
- package/dist/lib/evgr/bench/compare.mjs +252 -0
- package/dist/lib/evgr/bench/speed.mjs +277 -0
- package/dist/lib/evgr/bin/.gitignore +3 -0
- package/dist/lib/evgr/src/bin/bench.rs +106 -0
- package/dist/lib/evgr/src/bin/smoke.rs +13 -0
- package/dist/lib/evgr/src/grid.rs +730 -0
- package/dist/lib/evgr/src/lib.rs +1003 -0
- package/dist/lib/evgr/src/style.rs +468 -0
- package/dist/lib/evgr/src/text.rs +83 -0
- package/dist/lib/image/BitReader.rgr +171 -0
- package/dist/lib/image/Buffer.rgr +173 -0
- package/dist/lib/image/DCT.rgr +283 -0
- package/dist/lib/image/Deflate.rgr +339 -0
- package/dist/lib/image/HuffmanDecoder.rgr +181 -0
- package/dist/lib/image/ImageBuffer.rgr +706 -0
- package/dist/lib/image/JPEGDecoder.rgr +808 -0
- package/dist/lib/image/PNGDecoder.rgr +544 -0
- package/dist/lib/image/PNGEncoder.rgr +388 -0
- package/dist/lib/image/PPMImage.rgr +224 -0
- package/dist/lib/image/ProgressiveJPEGDecoder.rgr +1154 -0
- package/dist/lib/image/README.md +33 -0
- package/dist/lib/image/RasterBuffer.rgr +294 -0
- package/dist/lib/image/VP8BoolDecoder.rgr +163 -0
- package/dist/lib/image/WebPDecoder.rgr +433 -0
- package/dist/lib/image/WebPLossless.rgr +1035 -0
- package/dist/lib/image/WebPLossy.rgr +1929 -0
- package/dist/lib/image/ranger.json +9 -0
- package/dist/lib/image/testdata/webp/anim_2f_24x16.webp +0 -0
- package/dist/lib/image/testdata/webp/fixtures.txt +33 -0
- package/dist/lib/image/testdata/webp/gen_fixtures.py +261 -0
- package/dist/lib/image/testdata/webp/ll_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_alpha_29x21.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_gradient_64x64.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_meta_32x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_noise_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal11_23x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal2_19x7.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal40_16x16.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_pal4_13x5.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_photo_40x30.webp +0 -0
- package/dist/lib/image/testdata/webp/ll_predictors_64x32.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_1x1.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_raw_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f0_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f1_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f2_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alph_vp8l_f3_21x13.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_alpha_33x17.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_exif_15x11.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_i16_96x80.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_nofilter_24x20.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_odd_17x9.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_photo_48x40.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_q100_20x18.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_sharp_40x36.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_simple_filter_33x31.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_parts8_37x45.webp +0 -0
- package/dist/lib/image/testdata/webp/ly_vpx_skip_96x80.webp +0 -0
- package/dist/lib/image/tests/WebPDecodeTool.rgr +81 -0
- package/dist/lib/image/tests/WebPDecoderTest.rgr +1162 -0
- package/dist/lib/image/tests/run_webp_tests.sh +39 -0
- package/dist/lib/rust/RsJson.rgr +468 -0
- package/dist/lib/rust/RsPrelude.rgr +1663 -0
- package/dist/lib/shell_test.rgr +7 -7
- package/dist/lib/stdlib.rgr +21 -5
- package/dist/lib/zip/ranger.json +6 -0
- package/dist/rgrc.js +87318 -67610
- package/package.json +1010 -1040
- package/dist/README.md +0 -117
- package/dist/package.json +0 -47
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
; SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
; EVGBox.rgr - Box model for EVG layout (margin, padding, border)
|
|
4
|
+
|
|
5
|
+
Import "EVGUnit.rgr"
|
|
6
|
+
Import "EVGColor.rgr"
|
|
7
|
+
|
|
8
|
+
class EVGBox {
|
|
9
|
+
; Margins (outer spacing)
|
|
10
|
+
def marginTop:EVGUnit
|
|
11
|
+
def marginRight:EVGUnit
|
|
12
|
+
def marginBottom:EVGUnit
|
|
13
|
+
def marginLeft:EVGUnit
|
|
14
|
+
|
|
15
|
+
; Padding (inner spacing)
|
|
16
|
+
def paddingTop:EVGUnit
|
|
17
|
+
def paddingRight:EVGUnit
|
|
18
|
+
def paddingBottom:EVGUnit
|
|
19
|
+
def paddingLeft:EVGUnit
|
|
20
|
+
|
|
21
|
+
; Border
|
|
22
|
+
def borderWidth:EVGUnit
|
|
23
|
+
def borderColor:EVGColor
|
|
24
|
+
; The shorthand's uniform value, kept because most boxes have one radius
|
|
25
|
+
; and because every backend but the WebGL painter still reads it.
|
|
26
|
+
def borderRadius:EVGUnit
|
|
27
|
+
; And the four corners, clockwise from the top left — which is the order
|
|
28
|
+
; `border-radius` writes them in and not the order any other box shorthand
|
|
29
|
+
; uses. A title bar that has to sit flush against what is under it cannot
|
|
30
|
+
; be written with one number.
|
|
31
|
+
def borderRadiusTL:EVGUnit
|
|
32
|
+
def borderRadiusTR:EVGUnit
|
|
33
|
+
def borderRadiusBR:EVGUnit
|
|
34
|
+
def borderRadiusBL:EVGUnit
|
|
35
|
+
|
|
36
|
+
; Resolved pixel values
|
|
37
|
+
def marginTopPx:double 0.0
|
|
38
|
+
def marginRightPx:double 0.0
|
|
39
|
+
def marginBottomPx:double 0.0
|
|
40
|
+
def marginLeftPx:double 0.0
|
|
41
|
+
def paddingTopPx:double 0.0
|
|
42
|
+
def paddingRightPx:double 0.0
|
|
43
|
+
def paddingBottomPx:double 0.0
|
|
44
|
+
def paddingLeftPx:double 0.0
|
|
45
|
+
def borderWidthPx:double 0.0
|
|
46
|
+
def borderRadiusPx:double 0.0
|
|
47
|
+
def borderRadiusTLPx:double 0.0
|
|
48
|
+
def borderRadiusTRPx:double 0.0
|
|
49
|
+
def borderRadiusBRPx:double 0.0
|
|
50
|
+
def borderRadiusBLPx:double 0.0
|
|
51
|
+
|
|
52
|
+
Constructor () {
|
|
53
|
+
marginTop = (EVGUnit.unset())
|
|
54
|
+
marginRight = (EVGUnit.unset())
|
|
55
|
+
marginBottom = (EVGUnit.unset())
|
|
56
|
+
marginLeft = (EVGUnit.unset())
|
|
57
|
+
paddingTop = (EVGUnit.unset())
|
|
58
|
+
paddingRight = (EVGUnit.unset())
|
|
59
|
+
paddingBottom = (EVGUnit.unset())
|
|
60
|
+
paddingLeft = (EVGUnit.unset())
|
|
61
|
+
borderWidth = (EVGUnit.unset())
|
|
62
|
+
borderColor = (EVGColor.noColor())
|
|
63
|
+
borderRadius = (EVGUnit.unset())
|
|
64
|
+
borderRadiusTL = (EVGUnit.unset())
|
|
65
|
+
borderRadiusTR = (EVGUnit.unset())
|
|
66
|
+
borderRadiusBR = (EVGUnit.unset())
|
|
67
|
+
borderRadiusBL = (EVGUnit.unset())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fn setMargin:void (all:EVGUnit) {
|
|
71
|
+
marginTop = all
|
|
72
|
+
marginRight = all
|
|
73
|
+
marginBottom = all
|
|
74
|
+
marginLeft = all
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fn setMarginValues:void (top:EVGUnit right:EVGUnit bottom:EVGUnit left:EVGUnit) {
|
|
78
|
+
marginTop = top
|
|
79
|
+
marginRight = right
|
|
80
|
+
marginBottom = bottom
|
|
81
|
+
marginLeft = left
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fn setPadding:void (all:EVGUnit) {
|
|
85
|
+
paddingTop = all
|
|
86
|
+
paddingRight = all
|
|
87
|
+
paddingBottom = all
|
|
88
|
+
paddingLeft = all
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
fn setPaddingValues:void (top:EVGUnit right:EVGUnit bottom:EVGUnit left:EVGUnit) {
|
|
92
|
+
paddingTop = top
|
|
93
|
+
paddingRight = right
|
|
94
|
+
paddingBottom = bottom
|
|
95
|
+
paddingLeft = left
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
fn resolveUnits:void (parentWidth:double parentHeight:double fontSize:double rootFontSize:double viewportW:double viewportH:double) {
|
|
99
|
+
; Resolve all units to pixel values
|
|
100
|
+
|
|
101
|
+
; `rem` resolves against the root's font size and `vw`/`vh` against the
|
|
102
|
+
; layout's page size, neither of which a unit can reach on its own;
|
|
103
|
+
; hand both to each unit before resolving.
|
|
104
|
+
marginTop.setContext(rootFontSize viewportW viewportH)
|
|
105
|
+
marginRight.setContext(rootFontSize viewportW viewportH)
|
|
106
|
+
marginBottom.setContext(rootFontSize viewportW viewportH)
|
|
107
|
+
marginLeft.setContext(rootFontSize viewportW viewportH)
|
|
108
|
+
paddingTop.setContext(rootFontSize viewportW viewportH)
|
|
109
|
+
paddingRight.setContext(rootFontSize viewportW viewportH)
|
|
110
|
+
paddingBottom.setContext(rootFontSize viewportW viewportH)
|
|
111
|
+
paddingLeft.setContext(rootFontSize viewportW viewportH)
|
|
112
|
+
borderWidth.setContext(rootFontSize viewportW viewportH)
|
|
113
|
+
borderRadius.setContext(rootFontSize viewportW viewportH)
|
|
114
|
+
borderRadiusTL.setContext(rootFontSize viewportW viewportH)
|
|
115
|
+
borderRadiusTR.setContext(rootFontSize viewportW viewportH)
|
|
116
|
+
borderRadiusBR.setContext(rootFontSize viewportW viewportH)
|
|
117
|
+
borderRadiusBL.setContext(rootFontSize viewportW viewportH)
|
|
118
|
+
|
|
119
|
+
; Percentage margins and padding resolve against the containing block's
|
|
120
|
+
; WIDTH on all four sides — including top and bottom. That is genuinely
|
|
121
|
+
; what CSS does (it is the rule the padding-bottom aspect-ratio trick
|
|
122
|
+
; relies on), however unintuitive it reads. This used to resolve the
|
|
123
|
+
; vertical ones against the height, under a comment claiming that was
|
|
124
|
+
; "like CSS"; a browser comparison showed it was not.
|
|
125
|
+
marginTop.resolve(parentWidth fontSize)
|
|
126
|
+
marginTopPx = marginTop.pixels
|
|
127
|
+
|
|
128
|
+
marginRight.resolve(parentWidth fontSize)
|
|
129
|
+
marginRightPx = marginRight.pixels
|
|
130
|
+
|
|
131
|
+
marginBottom.resolve(parentWidth fontSize)
|
|
132
|
+
marginBottomPx = marginBottom.pixels
|
|
133
|
+
|
|
134
|
+
marginLeft.resolve(parentWidth fontSize)
|
|
135
|
+
marginLeftPx = marginLeft.pixels
|
|
136
|
+
|
|
137
|
+
; Padding
|
|
138
|
+
paddingTop.resolve(parentWidth fontSize)
|
|
139
|
+
paddingTopPx = paddingTop.pixels
|
|
140
|
+
|
|
141
|
+
paddingRight.resolve(parentWidth fontSize)
|
|
142
|
+
paddingRightPx = paddingRight.pixels
|
|
143
|
+
|
|
144
|
+
paddingBottom.resolve(parentWidth fontSize)
|
|
145
|
+
paddingBottomPx = paddingBottom.pixels
|
|
146
|
+
|
|
147
|
+
paddingLeft.resolve(parentWidth fontSize)
|
|
148
|
+
paddingLeftPx = paddingLeft.pixels
|
|
149
|
+
|
|
150
|
+
; Border
|
|
151
|
+
borderWidth.resolve(parentWidth fontSize)
|
|
152
|
+
borderWidthPx = borderWidth.pixels
|
|
153
|
+
|
|
154
|
+
; Border radius - percentage is relative to smaller dimension
|
|
155
|
+
def smallerDim:double parentWidth
|
|
156
|
+
if (parentHeight < parentWidth) {
|
|
157
|
+
smallerDim = parentHeight
|
|
158
|
+
}
|
|
159
|
+
borderRadius.resolve(smallerDim fontSize)
|
|
160
|
+
borderRadiusPx = borderRadius.pixels
|
|
161
|
+
; Each corner, falling back to the uniform value when the shorthand
|
|
162
|
+
; only gave one. The CSS scale-down — two radii on one side may not add
|
|
163
|
+
; up to more than that side — is NOT applied here: it needs the box's
|
|
164
|
+
; drawn width and height, and this runs before either is settled. It is
|
|
165
|
+
; applied where the command is written, in EVGDisplayList.
|
|
166
|
+
borderRadiusTL.resolve(smallerDim fontSize)
|
|
167
|
+
borderRadiusTR.resolve(smallerDim fontSize)
|
|
168
|
+
borderRadiusBR.resolve(smallerDim fontSize)
|
|
169
|
+
borderRadiusBL.resolve(smallerDim fontSize)
|
|
170
|
+
borderRadiusTLPx = borderRadiusPx
|
|
171
|
+
borderRadiusTRPx = borderRadiusPx
|
|
172
|
+
borderRadiusBRPx = borderRadiusPx
|
|
173
|
+
borderRadiusBLPx = borderRadiusPx
|
|
174
|
+
if borderRadiusTL.isSet { borderRadiusTLPx = borderRadiusTL.pixels }
|
|
175
|
+
if borderRadiusTR.isSet { borderRadiusTRPx = borderRadiusTR.pixels }
|
|
176
|
+
if borderRadiusBR.isSet { borderRadiusBRPx = borderRadiusBR.pixels }
|
|
177
|
+
if borderRadiusBL.isSet { borderRadiusBLPx = borderRadiusBL.pixels }
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
; True when the four corners are not all the same, so a caller can keep
|
|
181
|
+
; emitting one number for the overwhelmingly common case.
|
|
182
|
+
fn hasPerCornerRadius:boolean () {
|
|
183
|
+
if (borderRadiusTLPx != borderRadiusTRPx) { return true }
|
|
184
|
+
if (borderRadiusTLPx != borderRadiusBRPx) { return true }
|
|
185
|
+
if (borderRadiusTLPx != borderRadiusBLPx) { return true }
|
|
186
|
+
return false
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
; Space the padding and border take on each axis. A border box can never be
|
|
190
|
+
; smaller than this, so it is also the floor for the box itself.
|
|
191
|
+
fn getHorizontalChrome:double () {
|
|
192
|
+
return (paddingLeftPx + paddingRightPx + (borderWidthPx * 2.0))
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
fn getVerticalChrome:double () {
|
|
196
|
+
return (paddingTopPx + paddingBottomPx + (borderWidthPx * 2.0))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
fn getInnerWidth:double (outerWidth:double) {
|
|
200
|
+
; Calculate inner width after padding and border. Never negative: a
|
|
201
|
+
; content box of -20px is not a thing, and letting it go negative made
|
|
202
|
+
; children collapse to zero instead of simply having no room.
|
|
203
|
+
def inner:double (outerWidth - (this.getHorizontalChrome()))
|
|
204
|
+
if (inner < 0.0) {
|
|
205
|
+
return 0.0
|
|
206
|
+
}
|
|
207
|
+
return inner
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
fn getInnerHeight:double (outerHeight:double) {
|
|
211
|
+
def inner:double (outerHeight - (this.getVerticalChrome()))
|
|
212
|
+
if (inner < 0.0) {
|
|
213
|
+
return 0.0
|
|
214
|
+
}
|
|
215
|
+
return inner
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
fn getTotalWidth:double (contentWidth:double) {
|
|
219
|
+
; Calculate total width including margin, padding, border
|
|
220
|
+
return (contentWidth + marginLeftPx + marginRightPx + paddingLeftPx + paddingRightPx + (borderWidthPx * 2.0))
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
fn getTotalHeight:double (contentHeight:double) {
|
|
224
|
+
; Calculate total height including margin, padding, border
|
|
225
|
+
return (contentHeight + marginTopPx + marginBottomPx + paddingTopPx + paddingBottomPx + (borderWidthPx * 2.0))
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fn getContentX:double (elementX:double) {
|
|
229
|
+
; Get X position for content area
|
|
230
|
+
return (elementX + marginLeftPx + borderWidthPx + paddingLeftPx)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
fn getContentY:double (elementY:double) {
|
|
234
|
+
; Get Y position for content area
|
|
235
|
+
return (elementY + marginTopPx + borderWidthPx + paddingTopPx)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
fn getHorizontalSpace:double () {
|
|
239
|
+
; Total horizontal space (margin + border + padding on both sides)
|
|
240
|
+
return (marginLeftPx + marginRightPx + paddingLeftPx + paddingRightPx + (borderWidthPx * 2.0))
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
fn getVerticalSpace:double () {
|
|
244
|
+
; Total vertical space (margin + border + padding on both sides)
|
|
245
|
+
return (marginTopPx + marginBottomPx + paddingTopPx + paddingBottomPx + (borderWidthPx * 2.0))
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
fn getMarginHorizontal:double () {
|
|
249
|
+
return (marginLeftPx + marginRightPx)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
fn getMarginVertical:double () {
|
|
253
|
+
return (marginTopPx + marginBottomPx)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
fn getPaddingHorizontal:double () {
|
|
257
|
+
return (paddingLeftPx + paddingRightPx)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
fn getPaddingVertical:double () {
|
|
261
|
+
return (paddingTopPx + paddingBottomPx)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
fn toString:string () {
|
|
265
|
+
return ("Box[margin:" + (to_string marginTopPx) + "/" + (to_string marginRightPx) + "/" + (to_string marginBottomPx) + "/" + (to_string marginLeftPx) + " padding:" + (to_string paddingTopPx) + "/" + (to_string paddingRightPx) + "/" + (to_string paddingBottomPx) + "/" + (to_string paddingLeftPx) + " border:" + (to_string borderWidthPx) + "]")
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
; SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
; ==============================================================================
|
|
4
|
+
; EVGBoxShorthandTest — `padding: 0 16px` means two different numbers
|
|
5
|
+
; ==============================================================================
|
|
6
|
+
;
|
|
7
|
+
; This file exists because of a screenshot. The table demo's rows carried
|
|
8
|
+
; `padding: 0 16px` and their contents sat flush against the card's edge, so
|
|
9
|
+
; the sides were getting nothing. EVG was reading the whole declaration as ONE
|
|
10
|
+
; unit: `EVGUnit.parse("0 16px")` sees the leading `0`, stops, and the box was
|
|
11
|
+
; given zero on all four sides. Every two-, three- and four-value box shorthand
|
|
12
|
+
; in the gallery had been wrong since the day the sheets were written — and it
|
|
13
|
+
; had never been reported, because a padding that is too small does not look
|
|
14
|
+
; like a bug. It looks like a layout someone chose.
|
|
15
|
+
;
|
|
16
|
+
; That is the argument for checking the PAINTED result and not the parse: this
|
|
17
|
+
; is the third defect this month found by looking at pixels and the third that
|
|
18
|
+
; no amount of reading the code would have surfaced.
|
|
19
|
+
;
|
|
20
|
+
; The numbers below are not invented. `oracle/css_box_oracle.mjs` puts each
|
|
21
|
+
; declaration on a real element in a real browser and reads back the four
|
|
22
|
+
; computed sides; `oracle/css-box.json` is what it said. Every case here is a
|
|
23
|
+
; row of that file, the rejections included — a browser drops the whole
|
|
24
|
+
; DECLARATION on a bad component rather than the component, and an element
|
|
25
|
+
; keeps what it had, which is a different observable outcome from zero.
|
|
26
|
+
; ==============================================================================
|
|
27
|
+
|
|
28
|
+
Import "EVGElement.rgr"
|
|
29
|
+
Import "EVGUnit.rgr"
|
|
30
|
+
Import "EVGBox.rgr"
|
|
31
|
+
Import "EVGStyleSheet.rgr"
|
|
32
|
+
Import "EVGLayout.rgr"
|
|
33
|
+
|
|
34
|
+
class BoxCheck {
|
|
35
|
+
def passed:int 0
|
|
36
|
+
def failed:int 0
|
|
37
|
+
|
|
38
|
+
fn ok:void (name:string cond:boolean) {
|
|
39
|
+
if cond {
|
|
40
|
+
passed = (passed + 1)
|
|
41
|
+
print (" PASS " + name)
|
|
42
|
+
} {
|
|
43
|
+
failed = (failed + 1)
|
|
44
|
+
print (" FAIL " + name)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
fn eqStr:void (name:string got:string want:string) {
|
|
49
|
+
def good:boolean (got == want)
|
|
50
|
+
if (good == false) {
|
|
51
|
+
print (" got '" + got + "' want '" + want + "'")
|
|
52
|
+
}
|
|
53
|
+
this.ok(name good)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
class EVGBoxShorthandTest {
|
|
58
|
+
|
|
59
|
+
; The four sides as one string, so a wrong side names itself in the failure
|
|
60
|
+
; rather than making the reader count arguments.
|
|
61
|
+
sfn padOf:string (el:EVGElement) {
|
|
62
|
+
return (((((((to_string el.box.paddingTopPx) + " ")
|
|
63
|
+
+ (to_string el.box.paddingRightPx)) + " ")
|
|
64
|
+
+ (to_string el.box.paddingBottomPx)) + " ")
|
|
65
|
+
+ (to_string el.box.paddingLeftPx))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
sfn marginOf:string (el:EVGElement) {
|
|
69
|
+
return (((((((to_string el.box.marginTopPx) + " ")
|
|
70
|
+
+ (to_string el.box.marginRightPx)) + " ")
|
|
71
|
+
+ (to_string el.box.marginBottomPx)) + " ")
|
|
72
|
+
+ (to_string el.box.marginLeftPx))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
; One declaration, applied through the stylesheet exactly as a page would —
|
|
76
|
+
; not by calling the parser directly. The bug was in what the sheet did with
|
|
77
|
+
; a declaration, so the test has to go the same way in.
|
|
78
|
+
sfn boxFor:EVGElement (decl:string) {
|
|
79
|
+
def s (new EVGStyleSheet())
|
|
80
|
+
s.parse((".b { " + decl) + " }")
|
|
81
|
+
def el:EVGElement (EVGElement.createDiv())
|
|
82
|
+
el.className = "b"
|
|
83
|
+
s.applyTree(el "")
|
|
84
|
+
; 400px of containing block, so a percentage has the same thing to
|
|
85
|
+
; resolve against as the oracle's 400px parent did.
|
|
86
|
+
el.box.resolveUnits(400.0 200.0 16.0 16.0 0.0 0.0)
|
|
87
|
+
return el
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
sfn testPadding:void (c:BoxCheck) {
|
|
91
|
+
print ""
|
|
92
|
+
print "-- padding, one to four values"
|
|
93
|
+
c.eqStr("one value is all four sides"
|
|
94
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 10px;"))))
|
|
95
|
+
"10 10 10 10")
|
|
96
|
+
; The case from the screenshot.
|
|
97
|
+
c.eqStr("two values are vertical then horizontal"
|
|
98
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 0 16px;"))))
|
|
99
|
+
"0 16 0 16")
|
|
100
|
+
c.eqStr("three are top, horizontal, bottom"
|
|
101
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 1px 2px 3px;"))))
|
|
102
|
+
"1 2 3 2")
|
|
103
|
+
c.eqStr("four are top, right, bottom, left"
|
|
104
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 1px 2px 3px 4px;"))))
|
|
105
|
+
"1 2 3 4")
|
|
106
|
+
c.eqStr("a bare zero needs no unit"
|
|
107
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 0;"))))
|
|
108
|
+
"0 0 0 0")
|
|
109
|
+
c.eqStr("the badge's own declaration"
|
|
110
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 2px 10px;"))))
|
|
111
|
+
"2 10 2 10")
|
|
112
|
+
c.eqStr("extra whitespace between components"
|
|
113
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 4px 8px ;"))))
|
|
114
|
+
"4 8 4 8")
|
|
115
|
+
; A percentage resolves against the containing block's WIDTH on every
|
|
116
|
+
; side, top and bottom included. 10% of 400 is 40, four times over.
|
|
117
|
+
c.eqStr("a percentage resolves against the width on all four sides"
|
|
118
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 10%;"))))
|
|
119
|
+
"40 40 40 40")
|
|
120
|
+
c.eqStr("em against the element's own font size"
|
|
121
|
+
(EVGBoxShorthandTest.padOf((EVGBoxShorthandTest.boxFor("padding: 1em 2em;"))))
|
|
122
|
+
"16 32 16 32")
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
sfn testMargin:void (c:BoxCheck) {
|
|
126
|
+
print ""
|
|
127
|
+
print "-- margin, which may go negative"
|
|
128
|
+
c.eqStr("one value is all four sides"
|
|
129
|
+
(EVGBoxShorthandTest.marginOf((EVGBoxShorthandTest.boxFor("margin: 10px;"))))
|
|
130
|
+
"10 10 10 10")
|
|
131
|
+
c.eqStr("four sides in order"
|
|
132
|
+
(EVGBoxShorthandTest.marginOf((EVGBoxShorthandTest.boxFor("margin: 1px 2px 3px 4px;"))))
|
|
133
|
+
"1 2 3 4")
|
|
134
|
+
; The one real difference between the two properties: a negative margin
|
|
135
|
+
; is ordinary CSS and pulls a box outwards.
|
|
136
|
+
c.eqStr("a negative margin survives"
|
|
137
|
+
(EVGBoxShorthandTest.marginOf((EVGBoxShorthandTest.boxFor("margin: -4px 8px;"))))
|
|
138
|
+
"-4 8 -4 8")
|
|
139
|
+
; `auto` parses to no length. EVG has no auto-margin centring, so it
|
|
140
|
+
; lands where an unset margin lands — but the declaration is ACCEPTED,
|
|
141
|
+
; which is what stops `margin: 0 auto` from throwing the `0` away too.
|
|
142
|
+
c.eqStr("margin: 0 auto is accepted, and auto is zero here"
|
|
143
|
+
(EVGBoxShorthandTest.marginOf((EVGBoxShorthandTest.boxFor("margin: 0 auto;"))))
|
|
144
|
+
"0 0 0 0")
|
|
145
|
+
c.eqStr("a percentage margin resolves against the width"
|
|
146
|
+
(EVGBoxShorthandTest.marginOf((EVGBoxShorthandTest.boxFor("margin: 5%;"))))
|
|
147
|
+
"20 20 20 20")
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
; The rejections. Each of these must leave the element with what it already
|
|
151
|
+
; had rather than with zero — the browser drops the declaration, and an
|
|
152
|
+
; element that had 7px on every side still has 7px afterwards. Testing them
|
|
153
|
+
; against a fresh element would prove nothing, because a fresh element is
|
|
154
|
+
; zero either way.
|
|
155
|
+
sfn afterBad:string (decl:string) {
|
|
156
|
+
def s (new EVGStyleSheet())
|
|
157
|
+
s.parse((".b { padding: 7px; " + decl) + " }")
|
|
158
|
+
def el:EVGElement (EVGElement.createDiv())
|
|
159
|
+
el.className = "b"
|
|
160
|
+
s.applyTree(el "")
|
|
161
|
+
el.box.resolveUnits(400.0 200.0 16.0 16.0 0.0 0.0)
|
|
162
|
+
return (EVGBoxShorthandTest.padOf(el))
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
sfn testRejected:void (c:BoxCheck) {
|
|
166
|
+
print ""
|
|
167
|
+
print "-- declarations a browser drops whole"
|
|
168
|
+
c.eqStr("five values is not a shorthand"
|
|
169
|
+
(EVGBoxShorthandTest.afterBad("padding: 1px 2px 3px 4px 5px;")) "7 7 7 7")
|
|
170
|
+
c.eqStr("a component that is not a length"
|
|
171
|
+
(EVGBoxShorthandTest.afterBad("padding: 1px nonsense;")) "7 7 7 7")
|
|
172
|
+
c.eqStr("a negative padding takes the whole declaration with it"
|
|
173
|
+
(EVGBoxShorthandTest.afterBad("padding: -4px;")) "7 7 7 7")
|
|
174
|
+
c.eqStr("and a negative one among good ones"
|
|
175
|
+
(EVGBoxShorthandTest.afterBad("padding: 4px -4px;")) "7 7 7 7")
|
|
176
|
+
c.eqStr("padding: auto is not a thing"
|
|
177
|
+
(EVGBoxShorthandTest.afterBad("padding: auto;")) "7 7 7 7")
|
|
178
|
+
c.eqStr("a unit EVG does not know"
|
|
179
|
+
(EVGBoxShorthandTest.afterBad("padding: 1px 4ch;")) "7 7 7 7")
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
; The layout has to move, not just the box. A row of two children in a
|
|
183
|
+
; container padded `0 16px` starts at 16 and ends 16 short — that is the
|
|
184
|
+
; observable the screenshot was showing, and the box numbers above could all
|
|
185
|
+
; be right while this stayed broken.
|
|
186
|
+
sfn testLaidOut:void (c:BoxCheck) {
|
|
187
|
+
print ""
|
|
188
|
+
print "-- and it reaches the layout"
|
|
189
|
+
def s (new EVGStyleSheet())
|
|
190
|
+
s.parse(".row { display: flex; flex-direction: row; width: 200px; height: 40px; padding: 0 16px; } .kid { width: 50px; height: 20px; }")
|
|
191
|
+
def row:EVGElement (EVGElement.createDiv())
|
|
192
|
+
row.className = "row"
|
|
193
|
+
def kid:EVGElement (EVGElement.createDiv())
|
|
194
|
+
kid.className = "kid"
|
|
195
|
+
row.addChild(kid)
|
|
196
|
+
s.applyTree(row "")
|
|
197
|
+
def layout (new EVGLayout())
|
|
198
|
+
layout.layout(row)
|
|
199
|
+
c.eqStr("the first child starts one padding in"
|
|
200
|
+
(to_string kid.calculatedX) "16")
|
|
201
|
+
c.eqStr("and the row is still its declared width"
|
|
202
|
+
(to_string row.calculatedWidth) "200")
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
sfn main:void () {
|
|
206
|
+
def c (new BoxCheck())
|
|
207
|
+
print "=== EVG box shorthands: one to four values ==="
|
|
208
|
+
EVGBoxShorthandTest.testPadding(c)
|
|
209
|
+
EVGBoxShorthandTest.testMargin(c)
|
|
210
|
+
EVGBoxShorthandTest.testRejected(c)
|
|
211
|
+
EVGBoxShorthandTest.testLaidOut(c)
|
|
212
|
+
print ""
|
|
213
|
+
print ("passed=" + (to_string c.passed) + " failed=" + (to_string c.failed))
|
|
214
|
+
if (c.failed > 0) {
|
|
215
|
+
print "FAILURES"
|
|
216
|
+
} {
|
|
217
|
+
print "ALL PASS"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|