1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

WebBrowserComponent: Windows: Add accessibility integration

This commit is contained in:
attila 2023-04-17 10:21:48 +02:00 committed by Attila Szarvas
parent 6ef45eb20c
commit 7657efd227
12 changed files with 381 additions and 29 deletions

View file

@ -2182,7 +2182,7 @@ void Component::internalMouseDown (MouseInputSource source,
if (! flags.dontFocusOnMouseClickFlag)
{
grabKeyboardFocusInternal (focusChangedByMouseClick, true);
grabKeyboardFocusInternal (focusChangedByMouseClick, true, FocusChangeDirection::unknown);
if (checker.shouldBailOut())
return;
@ -2435,17 +2435,20 @@ void Component::internalBroughtToFront()
//==============================================================================
void Component::focusGained (FocusChangeType) {}
void Component::focusGainedWithDirection (FocusChangeType, FocusChangeDirection) {}
void Component::focusLost (FocusChangeType) {}
void Component::focusOfChildComponentChanged (FocusChangeType) {}
void Component::internalKeyboardFocusGain (FocusChangeType cause)
{
internalKeyboardFocusGain (cause, WeakReference<Component> (this));
internalKeyboardFocusGain (cause, WeakReference<Component> (this), FocusChangeDirection::unknown);
}
void Component::internalKeyboardFocusGain (FocusChangeType cause,
const WeakReference<Component>& safePointer)
const WeakReference<Component>& safePointer,
FocusChangeDirection direction)
{
focusGainedWithDirection (cause, direction);
focusGained (cause);
if (safePointer == nullptr)
@ -2585,7 +2588,7 @@ std::unique_ptr<ComponentTraverser> Component::createKeyboardFocusTraverser()
return parentComponent->createKeyboardFocusTraverser();
}
void Component::takeKeyboardFocus (FocusChangeType cause)
void Component::takeKeyboardFocus (FocusChangeType cause, FocusChangeDirection direction)
{
if (currentlyFocusedComponent == this)
return;
@ -2614,11 +2617,11 @@ void Component::takeKeyboardFocus (FocusChangeType cause)
componentLosingFocus->internalKeyboardFocusLoss (cause);
if (currentlyFocusedComponent == this)
internalKeyboardFocusGain (cause, safePointer);
internalKeyboardFocusGain (cause, safePointer, direction);
}
}
void Component::grabKeyboardFocusInternal (FocusChangeType cause, bool canTryParent)
void Component::grabKeyboardFocusInternal (FocusChangeType cause, bool canTryParent, FocusChangeDirection direction)
{
if (! isShowing())
return;
@ -2626,7 +2629,7 @@ void Component::grabKeyboardFocusInternal (FocusChangeType cause, bool canTryPar
if (flags.wantsKeyboardFocusFlag
&& (isEnabled() || parentComponent == nullptr))
{
takeKeyboardFocus (cause);
takeKeyboardFocus (cause, direction);
return;
}
@ -2637,7 +2640,7 @@ void Component::grabKeyboardFocusInternal (FocusChangeType cause, bool canTryPar
{
if (auto* defaultComp = traverser->getDefaultComponent (this))
{
defaultComp->grabKeyboardFocusInternal (cause, false);
defaultComp->grabKeyboardFocusInternal (cause, false, direction);
return;
}
}
@ -2645,7 +2648,7 @@ void Component::grabKeyboardFocusInternal (FocusChangeType cause, bool canTryPar
// if no children want it and we're allowed to try our parent comp,
// then pass up to parent, which will try our siblings.
if (canTryParent && parentComponent != nullptr)
parentComponent->grabKeyboardFocusInternal (cause, true);
parentComponent->grabKeyboardFocusInternal (cause, true, direction);
}
void Component::grabKeyboardFocus()
@ -2654,7 +2657,7 @@ void Component::grabKeyboardFocus()
// thread, you'll need to use a MessageManagerLock object to make sure it's thread-safe.
JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
grabKeyboardFocusInternal (focusChangedDirectly, true);
grabKeyboardFocusInternal (focusChangedDirectly, true, FocusChangeDirection::unknown);
// A component can only be focused when it's actually on the screen!
// If this fails then you're probably trying to grab the focus before you've
@ -2730,7 +2733,10 @@ void Component::moveKeyboardFocusToSibling (bool moveToNext)
return;
}
nextComp->grabKeyboardFocusInternal (focusChangedByTabKey, true);
nextComp->grabKeyboardFocusInternal (focusChangedByTabKey,
true,
moveToNext ? FocusChangeDirection::forward
: FocusChangeDirection::backward);
return;
}
}