NumericUpDown.Value is a decimal?, so changing it while a UI Automation
client is attached raised an automation property-changed event whose boxed
decimal hit no case in ComVariant.Create and threw an unhandled
ArgumentException that crashed the process. The event only fires when a UIA
client is listening, so it reproduced only on "some machines".
Mirror the BCL System.Runtime.InteropServices.Marshalling.ComVariant (which
this type is based on): overlay a decimal field on the variant, write it
before setting the VT_DECIMAL discriminator in Create (the discriminator
overlaps the decimal's unused leading bytes), and clear that discriminator on
a copy before reading the value back in AsObject.
Fixes#21491
* check permissions before reading or writing to clipboard
* throw UnauthorizedAccessException when permission is not granted for clipboard
* handle unauthorized access exceptions for clipboard in textbox
* check only for denied errors on clipboard
* addressed review
* wasm - use marshal methods instead when reading clipboard
* log unauthorized read clipboard error
* Improve logging
* Also log in MaskedTextBox
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* AT-SPI: add to the selection in Selection.SelectChild instead of replacing it
* AT-SPI: expose list item containers as accessible children
Index selectable items directly under the selection container so the
Selection interface's SelectChild/DeselectChild address them by index.
* Expose ListBox selection to accessibility via a selection peer
ListBox used ItemsControlAutomationPeer, which is not an ISelectionProvider,
so it never exposed the Selection interface (AT-SPI) for multi-select.
* Address review: expose item containers from the base ItemsControl peer
Move the GetChildrenCore container override down to ItemsControlAutomationPeer so every ItemsControl returns its containers, and return null directly when there are no items instead of calling the base algorithm.
* Use file-scoped namespace in ListBoxAutomationPeer
* Fix cross-platform regression: move child flattening from the peer to the AT-SPI selection handler
* Trigger rebuild
* AT-SPI: flatten selection container item children in the node layer, not the shared peer
Present a SelectingItemsControl's realized item containers as its direct AT-SPI children inside AtSpiNode so SelectChild-by-index and a selectable item's parent lookup resolve to the Selection container. Doing this in the FreeDesktop AT-SPI layer keeps the macOS AX and Windows UIA peer trees intact, avoiding the item-frame and tree-collapse regressions the shared ItemsControlAutomationPeer override caused.
* Fix TopMost handling for Popups on Windows
* Properly handle TopMost property changes
* Call SetTopMost in PopupRoot constructor (similar to SetWindowManagerAddShadowHint)
* Make sure the parent is focused when the popup is clicked directly to activate the app.
* Move PopupsPage to IntegrationTestApp
* Move Popup code to the XAML, making visual/logical management implicit
* Add popup integration tests
* Fix MenuTests+Default.Click_Grandchild by delaying popup activation
* Kill input focus when input element on popup is focused element
* try to fix tests
* try to fix test v2
* Integration tests: ensure menus get closed after testing
* run popup tests only on windows
* WIP: Removing the hack to see if anything changes.
* WIP: Removing the second hack.
I'm guessing this will fix it.
* fix to make transparent window integration app work on macOS
* fix menu tests
* Fix warning in MenuTests
* Add a background to integration test popup
---------
Co-authored-by: Maxwell Katz <maxkatz6@outlook.com>
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* Use CompiledBinding.Create where possible in sample code
* Avoid "FullyQualifiedName" hacks, use AppContext.BaseDirectory
* Avoid ambigious binding to methods in the sample code
* Use ProcessPath, there are no "dll" in aot
* Disable devtools in release
* Remove "DefineDynamicAssembly" used for persistent assemblies output, we don't target net framework anymore
* Add RequiresDynamicCode to the runtime XAML loader
* Bump XAML
* Bump XAML
* Adding TransparencyLevel property to CompositionTarget
* Try to pass the WindowTransparencyLevel to surface
* Enable change the AlphaMode in WinUI window.
* Support disable transparency explicitly;
* Adding the test demo code.
* Fix ICompositionDrawingSurfaceInterop.BeginDraw fail. Because the surface do not set size.
* Merge the same code
* Fix compile
* Add test demo code
* Put the re create surface to trycatch block.
Solve the `transaction` do not be disposed when CreateSurface exception.
* Add the dynamic Transparency alpha mode support to DirectComposited
* Revert "Adding TransparencyLevel property to CompositionTarget"
This reverts commit da0af790b1.
* Adding TransparencyLevel property to CompositionTarget
* Adding TransparencyLevel to RenderTargetSceneInfo
* Try remove the pass level
* Finish pass RenderTargetSceneInfo to create surface.
* Remove the unuse argument
* Remove the unuse code
* Bring the comments closer to the code
* Revert sort using
* Remove the unuse using
* Try fix compile error
* Remove the unuse namespace using.
* Try fix API changed
* Try fix compile
* Update api
* Gate macOS setAccessibilityValue on value read-only state
A read-only value provider must not advertise the setAccessibilityValue selector, so AX clients see the value as not settable.
* Gate macOS read-only range value mutations
Report a read-only IRangeValueProvider (ProgressBar, read-only NumericUpDown) as not settable, and stop advertising setAccessibilityValue/increment/decrement for it; keep min/max exposed.
* Support deselect and toggle expand/collapse in macOS AX
setAccessibilitySelected:NO now removes from selection, and AXPress toggles an expand/collapse provider instead of always expanding.
* Harden macOS AX select, value-set, and disabled-control actions
setAccessibilitySelected:YES now adds to the selection instead of replacing it, the value setter respects read-only, and mutating actions are gated on IsEnabled.
TreeViewItemAutomationPeer implements ISelectionItemProvider, and AvnAccessibilityElement maps setAccessibilitySelected to it, so AX clients can select a TreeViewItem.
AvnAccessibilityElement answers accessibilityIsAttributeSettable for the value attribute using IValueProvider.IsReadOnly, so AX clients see a read-only TextBox as not settable.
* Post macOS AXLayoutChanged on the changed peer's templated parent
The changed peer is usually a template-internal layout container that AppKit will not deliver notifications for; post on its templated parent (the owning control), falling back to the nearest exposed ancestor when there is none.
* Update with comment
* Workaround for nvidia EGL driver quirk with invalid draw/read/write buffers if surfaceless context was ever used
* X11: Fixed desktop EGL support for nvidia drivers
ScrollViewer.Offset and ScrollContentPresenter.Offset form a two-way coerced
binding whose convergence is decided with the default equality comparer. Because
NaN != NaN, a NaN offset is reported "changed" on every pass, so the coerce/raise
cycle never converges and recurses until the stack overflows -- an unrecoverable
crash (on Mono/AOT targets such as Android it surfaces as a native SIGSEGV).
CoerceOffset's Clamp passed NaN straight through (NaN < min and NaN > max are
both false), so a NaN component survived coercion. Sanitize it to the lower
bound so the coerce always converges, regardless of where the NaN came from.
Fixes#21444
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* Add render data opcode enum
First step of the Drawing/Nodes binary stream refactor.
* Add render data resource table
* Add render data stream writer and reader
Encodes the opcode stream field-by-field via BinaryPrimitives to
avoid unsafe and blittability assumptions.
* Add RenderDataStream with recording and replay
* Add hit-test walker to RenderDataStream
* Add bounds walker to RenderDataStream
* Add render data stream serialization
* Switch render data to the binary stream
* Move node level test coverage to the stream
* Delete the render data node classes
* Small optimization, stackalloc the render data walker scope stacks
* Optimize serialization for blittable types
* Encode render data via payload structs, add render data visitor
* Rename RenderDataResources.Add to AppendDeserialized
* Add effect support to render data stream
* Simplify render data read/write with MemoryMarshal
* Move "AdditionalFiles Include="@(AvaloniaXaml)"" to common AvaloniaBuildTasks
* Add AdditionalFiles Include="@(AvaloniaResource)"
* Add a comment
* Add extra CompilerVisibleProperty
* Rename _InjectAvaloniaAdditionalFiles, make it more specific...
* Do not duplicate AdditionalFiles with AvaloniaXaml AvaloniaResource
* Support Value pattern on editable ComboBox automation peer
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Add CalendarDayButtonAutomationPeer with SelectionItem pattern
* Guard day button selection against None mode and blackout days, add peer tests
* Use NotNullWhen instead of null-forgiving out parameter
* Implement IToggleProvider on MenuItemAutomationPeer
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Add ShouldRenderOnUIThread//Fps options to the AvaloniaHeadlessPlatformOptions, allowing SleepLoopRenderTimer to be enabled
* Don't throw from ForceRenderTimerTick
* Run DispatcherFrame on RequestCommitAsync, when HeadlessRenderTimer is not available
* This method apparently was public
* Fix BiDi correctness across TextCollapsingProperties implementations
Audit and fix logical-vs-visual ordering bugs in every text-collapsing
implementation and the helpers they share, so trimming always operates in
logical order (the consumer re-runs the BiDi reorderer in FinalizeLine, so
pre-applying visual order would be reordered a second time).
- LogicalTextRunEnumerator returned the first run on every MoveNext when
_indexedTextRuns was null.
- TextLeadingPrefixCharacterEllipsis: walked visual-order runs while splitting
at logical offsets, guarded the wrong field in the ctor, hardcoded
LeftToRight for the symbol, appended the suffix in reverse-logical order, and
mis-tracked the width budget across multi-run lines.
- TextPathSegmentEllipsis: crashed via Split(0) in the fallback path, and
measured RTL segments as ~0 width (it assumed ascending cluster ids).
- ShapedTextRun.TryMeasureCharacters/Backwards returned visual-order counts for
RTL runs.
ShapedBuffer gains logical-order, cluster-cache-backed width helpers
(GetCharRangeWidth, FindLeading/FindTrailingCharCountWithinWidth) that are
safe in the one-char-per-cluster simple mode (null _clusterStartChars). Adds a
BiDi characterization test suite and documents the logical-order Collapse
contract.
* Align text width comparisons to epsilon-tolerant MathUtilities
Several width-fit comparisons in the measure/collapse path used raw operators
with no epsilon, while the cluster-cache hot path (MeasureCharactersThatFit)
and the ShapedTextRun branch of MeasureLength already went through
MathUtilities. Replace the raw float comparisons with their epsilon-aware
equivalents (<= -> LessThanOrClose, < -> LessThan, > -> GreaterThan) in
ShapedBuffer.FindLeading/FindTrailingCharCountWithinWidth,
TextPathSegmentEllipsis, and TextLeadingPrefixCharacterEllipsis.
Also unify the DrawableTextRun branch of TextFormatterImpl.MeasureLength with
the ShapedTextRun branch (>= -> GreaterThan) so the "whole run fits" boundary
is identical for both run types: a run fits when width <= remaining (tolerant)
and overflows only when strictly greater.
Integer char-offset/index comparisons and the availableWidth <= 0 positivity
guards are intentionally left as raw comparisons.
* Cleanup some comments
* Fix Split(0) crash in TextLeadingPrefixCharacterEllipsis suffix collection
When a logical-tail run fits entirely within the remaining suffix budget,
TryMeasureCharactersBackwards returns suffixCount == run.Length, so
Split(run.Length - suffixCount) evaluated to Split(0), which throws
ArgumentOutOfRangeException. This was reachable on multi-run lines whose
post-split tail contains a small later run that fully fits.
Guard the split on splitAt > 0 and use the whole run as-is when it fully fits
(dropping it only when suffixCount == 0) — the same boundary pattern already
applied to TextPathSegmentEllipsis. Add a multi-run regression test.
* Remove duplicate ShapedBuffer.MeasureCharactersThatFit
MeasureCharactersThatFit and FindLeadingCharCountWithinWidth ran the
identical cluster-prefix binary search; the only functional difference
was the unused `out widthConsumed`. Drop the former and repoint its
callers (TextFormatterImpl.MeasureLength and the benchmark) at
FindLeadingCharCountWithinWidth, which also unifies the availableWidth<=0
guard. The one test that asserted the consumed width now recovers it via
GetCharRangeWidth(0, fit).
Also tidy GetCharRangeWidth's simple-mode bounds to use Math.Clamp.