if (!use_custom_device_scale_factor_for_testing_)
UpdateDeviceScaleFactor();
+#if BUILDFLAG(IS_TIZEN_TV)
+ // if blur event, last_focused_node_ should be set to root or nullptr
+ // for next focus change event. And it may be already set to nullptr
+ // in OnAtomicUpdateFinished, do not reset it here in this case.
+ // for case: blur -> change content -> refocus on the same node
+ for (const ui::AXEvent& event : details.events) {
+ if (event.event_type == ax::mojom::Event::kBlur && GetLastFocusedNode())
+ SetLastFocusedNode(GetRoot());
+ }
+#endif
+
// Optionally merge multiple tree updates into fewer updates.
const std::vector<ui::AXTreeUpdate>* tree_updates = &details.updates;
std::vector<ui::AXTreeUpdate> merged_tree_updates;
#if defined(USE_AURA)
if (renderer_preferences_.use_custom_colors) {
+#if !BUILDFLAG(IS_TIZEN_TV)
+ // It will set focus ring color to default, but for tizen TV,
+ // focus ring color will be set in layout_theme_chromium_tizen.cc.
SetFocusRingColor(renderer_preferences_.focus_ring_color);
+#endif
SetSelectionColors(renderer_preferences_.active_selection_bg_color,
renderer_preferences_.active_selection_fg_color,
renderer_preferences_.inactive_selection_bg_color,
}
#endif
+#if !BUILDFLAG(IS_TIZEN_TV)
+ // It will set focus ring color to default, but for tizen TV,
+ // focus ring color will be set in layout_theme_chromium_tizen.cc.
if (renderer_preferences_.use_custom_colors) {
SetFocusRingColor(renderer_preferences_.focus_ring_color);
}
+#endif
if (old_accept_languages != renderer_preferences_.accept_languages)
AcceptLanguagesChanged();
#include "ui/base/ui_base_features.h"
#include "ui/native_theme/native_theme.h"
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "third_party/blink/public/platform/web_application_type.h"
+#endif
+
// The methods in this file are shared by all themes on every platform.
namespace blink {
bool LayoutTheme::ShouldDrawDefaultFocusRing(const Node* node,
const ComputedStyle& style) const {
+#if BUILDFLAG(IS_TIZEN)
+ bool should_draw = false;
+ if (node) {
+ LocalFrame* frame = node->GetDocument().GetFrame();
+ Settings* settings = nullptr;
+ if (frame)
+ settings = frame->GetSettings();
+#if BUILDFLAG(IS_TIZEN_TV)
+ if (IsWebBrowser() && settings && settings->GetSpatialNavigationEnabled())
+ should_draw = true;
+#endif
+ }
+ if (!should_draw)
+ return false;
+#endif
+
if (!node)
return true;
if (!style.HasEffectiveAppearance() && !node->IsLink())
AXObjectVector description_objects;
String description =
Description(name_from, description_from, &description_objects);
+#if BUILDFLAG(IS_TIZEN_TV)
+ // If description string is identical with name string, abandon it.
+ // Delete leading and trailing white space characters before comparing.
+ if (!description.empty() &&
+ base::TrimWhitespaceASCII(description.Utf8(), base::TRIM_ALL) !=
+ base::TrimWhitespaceASCII(name.Utf8(), base::TRIM_ALL)) {
+#else
if (!description.empty()) {
+#endif
DCHECK(description_from != ax::mojom::blink::DescriptionFrom::kNone);
TruncateAndAddStringAttribute(
node_data, ax::mojom::blink::StringAttribute::kDescription,
if (old_focused_element) {
DeferTreeUpdate(TreeUpdateReason::kNodeLostFocus, old_focused_element);
}
+#if BUILDFLAG(IS_TIZEN_TV)
+ else {
+ // If old_focused_element's ax object is nullptr, set it to root,
+ // or else the blur event can not be sent to browser process.
+ // for case: blur -> change content -> refocus on the same node
+ PostNotification(Root(), ax::mojom::Event::kBlur);
+ }
+#endif
UpdateActiveAriaModalDialog(new_focused_element);
// AX_ATTR_NAME attribute value which contains link or heading contents will
// be read by screen-reader anyway as it is returned from get_name atk
// interface.
- switch (GetData().role) {
- case ax::mojom::Role::kHeading:
- case ax::mojom::Role::kLink:
- return;
- }
+ if (GetData().role == ax::mojom::Role::kHeading ||
+ GetData().role == ax::mojom::Role::kLink)
+ return;
+
if (IsTextObjectType() || IsColorWell() || IsSection())
interface_mask.Add(ImplementedAtkInterfaces::Value::kText);
GetData().GetStringAttribute(ax::mojom::StringAttribute::kValue);
if (!value.empty())
return value;
- for (uint32_t i = 0; i < GetChildCount(); i++) {
+ for (int i = 0; i < GetChildCount(); i++) {
AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl(
AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i)));
if (obj) {
case ax::mojom::Role::kRootWebArea:
case ax::mojom::Role::kPdfRoot:
return true;
+ default:
+ return false;
}
- return false;
}
bool AXPlatformNodeEfl::IsAccessible() const {
std::string AXPlatformNodeEfl::GetChildrenText() const {
std::string text;
- for (uint32_t i = 0; i < GetChildCount(); i++) {
+ for (int i = 0; i < GetChildCount(); i++) {
AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl(
AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i)));
if (obj) {
}
bool AXPlatformNodeEfl::HasOnlyTextChildren() const {
- for (uint32_t i = 0; i < GetChildCount(); i++) {
+ for (int i = 0; i < GetChildCount(); i++) {
AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl(
AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i)));
if (obj && !obj->IsTextObjectType())
}
bool AXPlatformNodeEfl::HasOnlyTextAndImageChildren() const {
- for (uint32_t i = 0; i < GetChildCount(); i++) {
+ for (int i = 0; i < GetChildCount(); i++) {
AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl(
AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i)));
if (obj && !obj->IsTextObjectType() &&
std::string result;
// if name from contents, will get it from children
- if (static_cast<ax::mojom::NameFrom>(
- GetData().GetIntAttribute(ax::mojom::IntAttribute::kNameFrom)) !=
- ax::mojom::NameFrom::kContents &&
- !GetData()
+ if (!GetData()
.GetStringAttribute(ax::mojom::StringAttribute::kName)
.empty()) {
result.append(
result.append(" ");
}
- for (uint32_t i = 0; i < GetChildCount(); i++) {
+ // if name from contents, children contents have already been merged in name
+ if (static_cast<ax::mojom::NameFrom>(
+ GetData().GetIntAttribute(ax::mojom::IntAttribute::kNameFrom)) ==
+ ax::mojom::NameFrom::kContents)
+ return result;
+
+ for (int i = 0; i < GetChildCount(); i++) {
AXPlatformNodeEfl* obj = ToAXPlatformNodeEfl(
AXPlatformNode::FromNativeViewAccessible(ChildAtIndex(i)));
if (obj) {
if (!obj)
return;
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Checking one radio button alway happened when uncheck another button,
+ // Sometimes the uncheck event comes after the check event and interrupt
+ // the reading of check event (see browser setting page), so ignore it
+ if (ax::mojom::Role::kRadioButton == GetData().role &&
+ GetData().GetCheckedState() == ax::mojom::CheckedState::kFalse)
+ return;
+#endif
+
atk_object_notify_state_change(
ATK_OBJECT(obj), GetAtkStateTypeForCheckableNode(),
GetData().GetCheckedState() != ax::mojom::CheckedState::kFalse);
return;
}
+#if !BUILDFLAG(IS_TIZEN_TV)
if (atk_object == g_current_focused)
return;
+#endif
SetActiveViewsDialog();
}
void AXPlatformNodeAuraLinux::OnSubtreeWillBeDeleted() {
+#if BUILDFLAG(IS_TIZEN_TV)
+ // Tizen screen reader not support children-changed event and after
+ // "children-changed::remove" sent, ATK have a callback to get state
+ // that could cause crash in GetFocusFromThisOrDescendantFrame
+ return;
+#else
// There is a chance there won't be a parent as we're in the deletion process.
// We also don't want to notify if this is an ignored node
if (!GetParent() || GetData().IsIgnored())
: -1;
g_signal_emit_by_name(GetParent(), "children-changed::remove", index_gint,
atk_object);
+#endif
}
void AXPlatformNodeAuraLinux::OnParentChanged() {