Commit 0e9c7c53 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove using directives ("using namespace x") from blink/renderer/modules/.

Bug: 82078
Change-Id: Idf76d2ff85d63c7b26775c3fd9241892d31ff764
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862494
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706342}
parent 2e9477b2
......@@ -113,8 +113,6 @@ bool IsNeutralWithinTable(blink::AXObject* obj) {
namespace blink {
using namespace html_names;
AXLayoutObject::AXLayoutObject(LayoutObject* layout_object,
AXObjectCacheImpl& ax_object_cache)
: AXNodeObject(layout_object->GetNode(), ax_object_cache),
......@@ -515,7 +513,7 @@ AccessibilityGrabbedState AXLayoutObject::IsGrabbed() const {
if (!SupportsARIADragging())
return kGrabbedStateUndefined;
const AtomicString& grabbed = GetAttribute(kAriaGrabbedAttr);
const AtomicString& grabbed = GetAttribute(html_names::kAriaGrabbedAttr);
return EqualIgnoringASCIICase(grabbed, "true") ? kGrabbedStateTrue
: kGrabbedStateFalse;
}
......@@ -761,7 +759,8 @@ bool AXLayoutObject::ComputeAccessibilityIsIgnored(
bool AXLayoutObject::HasAriaCellRole(Element* elem) const {
DCHECK(elem);
const AtomicString& aria_role_str = elem->FastGetAttribute(kRoleAttr);
const AtomicString& aria_role_str =
elem->FastGetAttribute(html_names::kRoleAttr);
if (aria_role_str.IsEmpty())
return false;
......@@ -875,7 +874,7 @@ const AtomicString& AXLayoutObject::AccessKey() const {
auto* element = DynamicTo<Element>(layout_object_->GetNode());
if (!element)
return g_null_atom;
return element->getAttribute(kAccesskeyAttr);
return element->getAttribute(html_names::kAccesskeyAttr);
}
RGBA32 AXLayoutObject::ComputeBackgroundColor() const {
......@@ -1437,7 +1436,8 @@ String AXLayoutObject::StringValue() const {
if (selected_index >= 0 &&
static_cast<size_t>(selected_index) < list_items.size()) {
const AtomicString& overridden_description =
list_items[selected_index]->FastGetAttribute(kAriaLabelAttr);
list_items[selected_index]->FastGetAttribute(
html_names::kAriaLabelAttr);
if (!overridden_description.IsNull())
return overridden_description;
}
......@@ -1604,18 +1604,18 @@ ax::mojom::HasPopup AXLayoutObject::HasPopup() const {
// a future version of WAI-ARIA. After that we will re-implement them
// following new spec.
bool AXLayoutObject::SupportsARIADragging() const {
const AtomicString& grabbed = GetAttribute(kAriaGrabbedAttr);
const AtomicString& grabbed = GetAttribute(html_names::kAriaGrabbedAttr);
return EqualIgnoringASCIICase(grabbed, "true") ||
EqualIgnoringASCIICase(grabbed, "false");
}
void AXLayoutObject::Dropeffects(
Vector<ax::mojom::Dropeffect>& dropeffects) const {
if (!HasAttribute(kAriaDropeffectAttr))
if (!HasAttribute(html_names::kAriaDropeffectAttr))
return;
Vector<String> str_dropeffects;
TokenVectorFromAttribute(str_dropeffects, kAriaDropeffectAttr);
TokenVectorFromAttribute(str_dropeffects, html_names::kAriaDropeffectAttr);
if (str_dropeffects.IsEmpty()) {
dropeffects.push_back(ax::mojom::Dropeffect::kNone);
......@@ -1643,13 +1643,13 @@ ax::mojom::Dropeffect AXLayoutObject::ParseDropeffect(
}
bool AXLayoutObject::SupportsARIAFlowTo() const {
return !GetAttribute(kAriaFlowtoAttr).IsEmpty();
return !GetAttribute(html_names::kAriaFlowtoAttr).IsEmpty();
}
bool AXLayoutObject::SupportsARIAOwns() const {
if (!layout_object_)
return false;
const AtomicString& aria_owns = GetAttribute(kAriaOwnsAttr);
const AtomicString& aria_owns = GetAttribute(html_names::kAriaOwnsAttr);
return !aria_owns.IsEmpty();
}
......@@ -2534,7 +2534,7 @@ bool AXLayoutObject::IsDataTable() const {
valid_cell_count++;
// Any <th> tag -> treat as data table.
if (cell_node->HasTagName(kThTag))
if (cell_node->HasTagName(html_names::kThTag))
return true;
// In this case, the developer explicitly assigned a "data" table
......@@ -2543,7 +2543,7 @@ bool AXLayoutObject::IsDataTable() const {
HTMLTableCellElement& cell_element = ToHTMLTableCellElement(*cell_node);
if (!cell_element.Headers().IsEmpty() ||
!cell_element.Abbr().IsEmpty() || !cell_element.Axis().IsEmpty() ||
!cell_element.FastGetAttribute(kScopeAttr).IsEmpty())
!cell_element.FastGetAttribute(html_names::kScopeAttr).IsEmpty())
return true;
}
......@@ -2791,7 +2791,7 @@ static bool IsNonEmptyNonHeaderCell(const LayoutNGTableCellInterface* cell) {
return false;
if (Node* node = cell->ToLayoutObject()->GetNode())
return node->hasChildren() && node->HasTagName(kTdTag);
return node->hasChildren() && node->HasTagName(html_names::kTdTag);
return false;
}
......@@ -2801,7 +2801,7 @@ static bool IsHeaderCell(const LayoutNGTableCellInterface* cell) {
return false;
if (Node* node = cell->ToLayoutObject()->GetNode())
return node->HasTagName(kThTag);
return node->HasTagName(html_names::kThTag);
return false;
}
......@@ -2884,10 +2884,10 @@ ax::mojom::Role AXLayoutObject::DetermineTableCellRole() const {
if (parent->RoleValue() == ax::mojom::Role::kLayoutTableRow)
return ax::mojom::Role::kLayoutTableCell;
if (!GetNode() || !GetNode()->HasTagName(kThTag))
if (!GetNode() || !GetNode()->HasTagName(html_names::kThTag))
return ax::mojom::Role::kCell;
const AtomicString& scope = GetAttribute(kScopeAttr);
const AtomicString& scope = GetAttribute(html_names::kScopeAttr);
if (EqualIgnoringASCIICase(scope, "row") ||
EqualIgnoringASCIICase(scope, "rowgroup"))
return ax::mojom::Role::kRowHeader;
......
......@@ -34,8 +34,6 @@
namespace blink {
using namespace html_names;
AXList::AXList(LayoutObject* layout_object, AXObjectCacheImpl& ax_object_cache)
: AXLayoutObject(layout_object, ax_object_cache) {}
......@@ -51,7 +49,7 @@ bool AXList::IsDescriptionList() const {
return false;
Node* node = layout_object_->GetNode();
return node && node->HasTagName(kDlTag);
return node && node->HasTagName(html_names::kDlTag);
}
ax::mojom::Role AXList::RoleValue() const {
......
......@@ -68,8 +68,6 @@
namespace blink {
using namespace html_names;
namespace {
struct RoleHashTraits : HashTraits<ax::mojom::Role> {
......@@ -1100,7 +1098,7 @@ const AXObject* AXObject::InertRoot() const {
element = FlatTreeTraversal::ParentElement(*node);
while (element) {
if (element->hasAttribute(kInertAttr))
if (element->hasAttribute(html_names::kInertAttr))
return AXObjectCache().GetOrCreate(element);
element = FlatTreeTraversal::ParentElement(*element);
}
......@@ -1239,7 +1237,7 @@ bool AXObject::ComputeAccessibilityIsIgnoredButIncludedInTree() const {
// aria-labelledby or aria-describedby.
if (RuntimeEnabledFeatures::AccessibilityExposeDisplayNoneEnabled()) {
if (Element* element = GetElement()) {
if (element->FastHasAttribute(kIdAttr) &&
if (element->FastHasAttribute(html_names::kIdAttr) &&
IsHiddenForTextAlternativeCalculation()) {
return true;
}
......@@ -1323,7 +1321,7 @@ bool AXObject::CanReceiveAccessibilityFocus() const {
return true;
// aria-activedescendant focus
return elem->FastHasAttribute(kIdAttr) && CanBeActiveDescendant();
return elem->FastHasAttribute(html_names::kIdAttr) && CanBeActiveDescendant();
}
bool AXObject::CanSetValueAttribute() const {
......@@ -1676,9 +1674,10 @@ String AXObject::AriaTextAlternative(bool recursive,
// Check ARIA attributes.
const QualifiedName& attr =
HasAttribute(kAriaLabeledbyAttr) && !HasAttribute(kAriaLabelledbyAttr)
? kAriaLabeledbyAttr
: kAriaLabelledbyAttr;
HasAttribute(html_names::kAriaLabeledbyAttr) &&
!HasAttribute(html_names::kAriaLabelledbyAttr)
? html_names::kAriaLabeledbyAttr
: html_names::kAriaLabelledbyAttr;
if (name_sources) {
name_sources->push_back(NameSource(*found_text_alternative, attr));
......@@ -1721,7 +1720,7 @@ String AXObject::AriaTextAlternative(bool recursive,
name_from = ax::mojom::NameFrom::kAttribute;
if (name_sources) {
name_sources->push_back(
NameSource(*found_text_alternative, kAriaLabelAttr));
NameSource(*found_text_alternative, html_names::kAriaLabelAttr));
name_sources->back().type = name_from;
}
const AtomicString& aria_label =
......@@ -1808,9 +1807,9 @@ void AXObject::AriaLabelledbyElementVector(
HeapVector<Member<Element>>& elements,
Vector<String>& ids) const {
// Try both spellings, but prefer aria-labelledby, which is the official spec.
ElementsFromAttribute(elements, kAriaLabelledbyAttr, ids);
ElementsFromAttribute(elements, html_names::kAriaLabelledbyAttr, ids);
if (!ids.size())
ElementsFromAttribute(elements, kAriaLabeledbyAttr, ids);
ElementsFromAttribute(elements, html_names::kAriaLabeledbyAttr, ids);
}
String AXObject::TextFromAriaLabelledby(AXObjectSet& visited,
......@@ -1825,7 +1824,7 @@ String AXObject::TextFromAriaDescribedby(AXRelatedObjectVector* related_objects,
Vector<String>& ids) const {
AXObjectSet visited;
HeapVector<Member<Element>> elements;
ElementsFromAttribute(elements, kAriaDescribedbyAttr, ids);
ElementsFromAttribute(elements, html_names::kAriaDescribedbyAttr, ids);
return TextFromElements(true, visited, elements, related_objects);
}
......@@ -2615,7 +2614,7 @@ AtomicString AXObject::Language() const {
// 2. The list of languages the browser sends in the [Accept-Language] header.
// 3. The browser's default language.
const AtomicString& lang = GetAttribute(kLangAttr);
const AtomicString& lang = GetAttribute(html_names::kLangAttr);
if (!lang.IsEmpty())
return lang;
......
......@@ -92,8 +92,6 @@
namespace blink {
using namespace html_names;
namespace {
// Return a node for the current layout object or ancestor layout object.
Node* GetClosestNodeForLayoutObject(LayoutObject* layout_object) {
......@@ -393,7 +391,8 @@ static bool NodeHasRole(Node* node, const String& role) {
return false;
// TODO(accessibility) support role strings with multiple roles.
return EqualIgnoringASCIICase(element->getAttribute(kRoleAttr), role);
return EqualIgnoringASCIICase(element->getAttribute(html_names::kRoleAttr),
role);
}
AXObject* AXObjectCacheImpl::CreateFromRenderer(LayoutObject* layout_object) {
......@@ -1317,12 +1316,14 @@ bool AXObjectCacheImpl::HandleAttributeChanged(const QualifiedName& attr_name,
DeferTreeUpdate(&AXObjectCacheImpl::HandleAttributeChangedWithCleanLayout,
attr_name, element);
if (attr_name != kRoleAttr && attr_name != kTypeAttr &&
attr_name != kSizeAttr && attr_name != kAltAttr &&
attr_name != kTitleAttr &&
(attr_name != kForAttr && !IsA<HTMLLabelElement>(*element)) &&
attr_name != kIdAttr && attr_name != kTabindexAttr &&
attr_name != kDisabledAttr &&
if (attr_name != html_names::kRoleAttr &&
attr_name != html_names::kTypeAttr &&
attr_name != html_names::kSizeAttr && attr_name != html_names::kAltAttr &&
attr_name != html_names::kTitleAttr &&
(attr_name != html_names::kForAttr && !IsA<HTMLLabelElement>(*element)) &&
attr_name != html_names::kIdAttr &&
attr_name != html_names::kTabindexAttr &&
attr_name != html_names::kDisabledAttr &&
!attr_name.LocalName().StartsWith("aria-")) {
return false;
}
......@@ -1351,26 +1352,32 @@ void AXObjectCacheImpl::HandleAttributeChangedWithCleanLayout(
Element* element) {
DCHECK(element);
DCHECK(!element->GetDocument().NeedsLayoutTreeUpdateForNode(*element));
if (attr_name == kRoleAttr || attr_name == kTypeAttr) {
if (attr_name == html_names::kRoleAttr ||
attr_name == html_names::kTypeAttr) {
HandleRoleChangeWithCleanLayout(element);
} else if (attr_name == kSizeAttr || attr_name == kAriaHaspopupAttr) {
} else if (attr_name == html_names::kSizeAttr ||
attr_name == html_names::kAriaHaspopupAttr) {
// Role won't change on edits.
HandleRoleChangeIfNotEditableWithCleanLayout(element);
} else if (attr_name == kAltAttr || attr_name == kTitleAttr) {
} else if (attr_name == html_names::kAltAttr ||
attr_name == html_names::kTitleAttr) {
TextChangedWithCleanLayout(element);
} else if (attr_name == kForAttr && IsA<HTMLLabelElement>(*element)) {
} else if (attr_name == html_names::kForAttr &&
IsA<HTMLLabelElement>(*element)) {
LabelChangedWithCleanLayout(element);
} else if (attr_name == kIdAttr) {
} else if (attr_name == html_names::kIdAttr) {
MaybeNewRelationTarget(element, Get(element));
} else if (attr_name == kTabindexAttr) {
} else if (attr_name == html_names::kTabindexAttr) {
FocusableChangedWithCleanLayout(element);
} else if (attr_name == kDisabledAttr || attr_name == kReadonlyAttr) {
} else if (attr_name == html_names::kDisabledAttr ||
attr_name == html_names::kReadonlyAttr) {
MarkElementDirty(element, false);
} else if (attr_name == kValueAttr) {
} else if (attr_name == html_names::kValueAttr) {
HandleValueChanged(element);
} else if (attr_name == kMinAttr || attr_name == kMaxAttr) {
} else if (attr_name == html_names::kMinAttr ||
attr_name == html_names::kMaxAttr) {
MarkElementDirty(element, false);
} else if (attr_name == kStepAttr) {
} else if (attr_name == html_names::kStepAttr) {
MarkElementDirty(element, false);
}
......@@ -1378,30 +1385,32 @@ void AXObjectCacheImpl::HandleAttributeChangedWithCleanLayout(
return;
// Perform updates specific to each attribute.
if (attr_name == kAriaActivedescendantAttr) {
if (attr_name == html_names::kAriaActivedescendantAttr) {
HandleActiveDescendantChangedWithCleanLayout(element);
} else if (attr_name == kAriaValuenowAttr ||
attr_name == kAriaValuetextAttr) {
} else if (attr_name == html_names::kAriaValuenowAttr ||
attr_name == html_names::kAriaValuetextAttr) {
HandleValueChanged(element);
} else if (attr_name == kAriaLabelAttr || attr_name == kAriaLabeledbyAttr ||
attr_name == kAriaLabelledbyAttr) {
} else if (attr_name == html_names::kAriaLabelAttr ||
attr_name == html_names::kAriaLabeledbyAttr ||
attr_name == html_names::kAriaLabelledbyAttr) {
TextChangedWithCleanLayout(element);
} else if (attr_name == kAriaDescribedbyAttr) {
} else if (attr_name == html_names::kAriaDescribedbyAttr) {
// TODO do we need a DescriptionChanged() ?
TextChangedWithCleanLayout(element);
} else if (attr_name == kAriaCheckedAttr || attr_name == kAriaPressedAttr) {
} else if (attr_name == html_names::kAriaCheckedAttr ||
attr_name == html_names::kAriaPressedAttr) {
CheckedStateChanged(element);
} else if (attr_name == kAriaSelectedAttr) {
} else if (attr_name == html_names::kAriaSelectedAttr) {
HandleAriaSelectedChangedWithCleanLayout(element);
} else if (attr_name == kAriaExpandedAttr) {
} else if (attr_name == html_names::kAriaExpandedAttr) {
HandleAriaExpandedChangeWithCleanLayout(element);
} else if (attr_name == kAriaHiddenAttr) {
} else if (attr_name == html_names::kAriaHiddenAttr) {
ChildrenChangedWithCleanLayout(element->parentNode());
} else if (attr_name == kAriaInvalidAttr) {
} else if (attr_name == html_names::kAriaInvalidAttr) {
PostNotification(element, ax::mojom::Event::kInvalidStatusChanged);
} else if (attr_name == kAriaErrormessageAttr) {
} else if (attr_name == html_names::kAriaErrormessageAttr) {
MarkElementDirty(element, false);
} else if (attr_name == kAriaOwnsAttr) {
} else if (attr_name == html_names::kAriaOwnsAttr) {
ChildrenChangedWithCleanLayout(element);
// Ensure aria-owns update fires on original parent as well
if (AXObject* obj = GetOrCreate(element)) {
......
......@@ -10,8 +10,6 @@
namespace blink {
using namespace html_names;
AXRelationCache::AXRelationCache(AXObjectCacheImpl* object_cache)
: object_cache_(object_cache) {}
......@@ -22,11 +20,11 @@ void AXRelationCache::Init() {
Document& document = object_cache_->GetDocument();
for (Element& element :
ElementTraversal::DescendantsOf(*document.documentElement())) {
const auto& id = element.FastGetAttribute(kForAttr);
const auto& id = element.FastGetAttribute(html_names::kForAttr);
if (!id.IsEmpty())
all_previously_seen_label_target_ids_.insert(id);
if (element.FastHasAttribute(kAriaOwnsAttr)) {
if (element.FastHasAttribute(html_names::kAriaOwnsAttr)) {
if (AXObject* obj = object_cache_->GetOrCreate(&element)) {
obj->ClearChildren();
obj->AddChildren();
......@@ -289,7 +287,8 @@ void AXRelationCache::TextChanged(AXObject* object) {
}
void AXRelationCache::LabelChanged(Node* node) {
const auto& id = To<HTMLElement>(node)->FastGetAttribute(kForAttr);
const auto& id =
To<HTMLElement>(node)->FastGetAttribute(html_names::kForAttr);
if (!id.IsEmpty()) {
all_previously_seen_label_target_ids_.insert(id);
if (auto* control = To<HTMLLabelElement>(node)->control())
......
......@@ -7,8 +7,6 @@
namespace blink {
using namespace html_names;
class BoolAttributeSetter : public AXSparseAttributeSetter {
public:
BoolAttributeSetter(AXBoolAttribute attribute) : attribute_(attribute) {}
......@@ -145,45 +143,47 @@ AXSparseAttributeSetterMap& GetSparseAttributeSetterMap() {
ax_sparse_attribute_setter_map, ());
if (ax_sparse_attribute_setter_map.IsEmpty()) {
ax_sparse_attribute_setter_map.Set(
kAriaActivedescendantAttr,
html_names::kAriaActivedescendantAttr,
new ObjectAttributeSetter(AXObjectAttribute::kAriaActiveDescendant));
ax_sparse_attribute_setter_map.Set(
kAriaControlsAttr, new ObjectVectorAttributeSetter(
AXObjectVectorAttribute::kAriaControls));
html_names::kAriaControlsAttr,
new ObjectVectorAttributeSetter(
AXObjectVectorAttribute::kAriaControls));
ax_sparse_attribute_setter_map.Set(
kAriaFlowtoAttr,
html_names::kAriaFlowtoAttr,
new ObjectVectorAttributeSetter(AXObjectVectorAttribute::kAriaFlowTo));
ax_sparse_attribute_setter_map.Set(
kAriaDetailsAttr,
html_names::kAriaDetailsAttr,
new ObjectAttributeSetter(AXObjectAttribute::kAriaDetails));
ax_sparse_attribute_setter_map.Set(
kAriaErrormessageAttr,
html_names::kAriaErrormessageAttr,
new ObjectAttributeSetter(AXObjectAttribute::kAriaErrorMessage));
ax_sparse_attribute_setter_map.Set(
kAriaKeyshortcutsAttr,
html_names::kAriaKeyshortcutsAttr,
new StringAttributeSetter(AXStringAttribute::kAriaKeyShortcuts));
ax_sparse_attribute_setter_map.Set(
kAriaRoledescriptionAttr,
html_names::kAriaRoledescriptionAttr,
new StringAttributeSetter(AXStringAttribute::kAriaRoleDescription));
ax_sparse_attribute_setter_map.Set(
kAriaBusyAttr, new BoolAttributeSetter(AXBoolAttribute::kAriaBusy));
html_names::kAriaBusyAttr,
new BoolAttributeSetter(AXBoolAttribute::kAriaBusy));
ax_sparse_attribute_setter_map.Set(
kAriaColcountAttr,
html_names::kAriaColcountAttr,
new IntAttributeSetter(AXIntAttribute::kAriaColumnCount));
ax_sparse_attribute_setter_map.Set(
kAriaColindexAttr,
html_names::kAriaColindexAttr,
new UIntAttributeSetter(AXUIntAttribute::kAriaColumnIndex));
ax_sparse_attribute_setter_map.Set(
kAriaColspanAttr,
html_names::kAriaColspanAttr,
new UIntAttributeSetter(AXUIntAttribute::kAriaColumnSpan));
ax_sparse_attribute_setter_map.Set(
kAriaRowcountAttr,
html_names::kAriaRowcountAttr,
new IntAttributeSetter(AXIntAttribute::kAriaRowCount));
ax_sparse_attribute_setter_map.Set(
kAriaRowindexAttr,
html_names::kAriaRowindexAttr,
new UIntAttributeSetter(AXUIntAttribute::kAriaRowIndex));
ax_sparse_attribute_setter_map.Set(
kAriaRowspanAttr,
html_names::kAriaRowspanAttr,
new UIntAttributeSetter(AXUIntAttribute::kAriaRowSpan));
}
return ax_sparse_attribute_setter_map;
......
......@@ -34,8 +34,7 @@ using protocol::Accessibility::AXRelatedNode;
using protocol::Accessibility::AXValue;
using protocol::Maybe;
using protocol::Response;
using namespace html_names;
namespace AXPropertyNameEnum = protocol::Accessibility::AXPropertyNameEnum;
namespace {
......@@ -450,13 +449,14 @@ class SparseAttributeAXPropertyAdapter
HeapVector<Member<AXObject>>& objects) override {
switch (attribute) {
case AXObjectVectorAttribute::kAriaControls:
properties_.emplace_back(
CreateRelatedNodeListProperty(AXPropertyNameEnum::Controls, objects,
kAriaControlsAttr, *ax_object_));
properties_.emplace_back(CreateRelatedNodeListProperty(
AXPropertyNameEnum::Controls, objects,
html_names::kAriaControlsAttr, *ax_object_));
break;
case AXObjectVectorAttribute::kAriaFlowTo:
properties_.emplace_back(CreateRelatedNodeListProperty(
AXPropertyNameEnum::Flowto, objects, kAriaFlowtoAttr, *ax_object_));
AXPropertyNameEnum::Flowto, objects, html_names::kAriaFlowtoAttr,
*ax_object_));
break;
}
}
......@@ -467,16 +467,17 @@ void FillRelationships(AXObject& ax_object,
AXObject::AXObjectVector results;
ax_object.AriaDescribedbyElements(results);
if (!results.IsEmpty()) {
properties.emplace_back(
CreateRelatedNodeListProperty(AXPropertyNameEnum::Describedby, results,
kAriaDescribedbyAttr, ax_object));
properties.emplace_back(CreateRelatedNodeListProperty(
AXPropertyNameEnum::Describedby, results,
html_names::kAriaDescribedbyAttr, ax_object));
}
results.clear();
ax_object.AriaOwnsElements(results);
if (!results.IsEmpty()) {
properties.emplace_back(CreateRelatedNodeListProperty(
AXPropertyNameEnum::Owns, results, kAriaOwnsAttr, ax_object));
properties.emplace_back(
CreateRelatedNodeListProperty(AXPropertyNameEnum::Owns, results,
html_names::kAriaOwnsAttr, ax_object));
}
results.clear();
}
......
......@@ -11,8 +11,7 @@
namespace blink {
using namespace html_names;
using namespace protocol::Accessibility;
using protocol::Accessibility::AXRelatedNode;
std::unique_ptr<AXProperty> CreateProperty(const String& name,
std::unique_ptr<AXValue> value) {
......@@ -167,43 +166,46 @@ std::unique_ptr<AXValue> CreateRelatedNodeListValue(
}
String ValueSourceType(ax::mojom::NameFrom name_from) {
namespace SourceType = protocol::Accessibility::AXValueSourceTypeEnum;
switch (name_from) {
case ax::mojom::NameFrom::kAttribute:
case ax::mojom::NameFrom::kAttributeExplicitlyEmpty:
case ax::mojom::NameFrom::kTitle:
case ax::mojom::NameFrom::kValue:
return AXValueSourceTypeEnum::Attribute;
return SourceType::Attribute;
case ax::mojom::NameFrom::kContents:
return AXValueSourceTypeEnum::Contents;
return SourceType::Contents;
case ax::mojom::NameFrom::kPlaceholder:
return AXValueSourceTypeEnum::Placeholder;
return SourceType::Placeholder;
case ax::mojom::NameFrom::kCaption:
case ax::mojom::NameFrom::kRelatedElement:
return AXValueSourceTypeEnum::RelatedElement;
return SourceType::RelatedElement;
default:
return AXValueSourceTypeEnum::Implicit; // TODO(aboxhall): what to do
// here?
return SourceType::Implicit; // TODO(aboxhall): what to do here?
}
}
String NativeSourceType(AXTextFromNativeHTML native_source) {
namespace SourceType = protocol::Accessibility::AXValueNativeSourceTypeEnum;
switch (native_source) {
case kAXTextFromNativeHTMLFigcaption:
return AXValueNativeSourceTypeEnum::Figcaption;
return SourceType::Figcaption;
case kAXTextFromNativeHTMLLabel:
return AXValueNativeSourceTypeEnum::Label;
return SourceType::Label;
case kAXTextFromNativeHTMLLabelFor:
return AXValueNativeSourceTypeEnum::Labelfor;
return SourceType::Labelfor;
case kAXTextFromNativeHTMLLabelWrapped:
return AXValueNativeSourceTypeEnum::Labelwrapped;
return SourceType::Labelwrapped;
case kAXTextFromNativeHTMLTableCaption:
return AXValueNativeSourceTypeEnum::Tablecaption;
return SourceType::Tablecaption;
case kAXTextFromNativeHTMLLegend:
return AXValueNativeSourceTypeEnum::Legend;
return SourceType::Legend;
case kAXTextFromNativeHTMLTitleElement:
return AXValueNativeSourceTypeEnum::Title;
return SourceType::Title;
default:
return AXValueNativeSourceTypeEnum::Other;
return SourceType::Other;
}
}
......@@ -212,8 +214,8 @@ std::unique_ptr<AXValueSource> CreateValueSource(NameSource& name_source) {
std::unique_ptr<AXValueSource> value_source =
AXValueSource::create().setType(type).build();
if (!name_source.related_objects.IsEmpty()) {
if (name_source.attribute == kAriaLabelledbyAttr ||
name_source.attribute == kAriaLabeledbyAttr) {
if (name_source.attribute == html_names::kAriaLabelledbyAttr ||
name_source.attribute == html_names::kAriaLabeledbyAttr) {
std::unique_ptr<AXValue> attribute_value = CreateRelatedNodeListValue(
name_source.related_objects, AXValueTypeEnum::IdrefList);
if (!name_source.attribute_value.IsNull())
......
......@@ -12,7 +12,10 @@
namespace blink {
using namespace protocol::Accessibility;
using protocol::Accessibility::AXProperty;
using protocol::Accessibility::AXValue;
using protocol::Accessibility::AXValueSource;
namespace AXValueTypeEnum = protocol::Accessibility::AXValueTypeEnum;
std::unique_ptr<AXProperty> CreateProperty(const String& name,
std::unique_ptr<AXValue>);
......
......@@ -40,8 +40,6 @@ using testing::Return;
namespace blink {
using namespace html_names;
namespace {
class MockVideoWebMediaPlayer : public EmptyWebMediaPlayer {
......@@ -111,7 +109,7 @@ class MediaControlsRotateToFullscreenDelegateTest
SetupPageWithClients(&clients,
MakeGarbageCollected<StubLocalFrameClient>());
video_ = MakeGarbageCollected<HTMLVideoElement>(GetDocument());
GetVideo().setAttribute(kControlsAttr, g_empty_atom);
GetVideo().setAttribute(html_names::kControlsAttr, g_empty_atom);
// Most tests should call GetDocument().body()->AppendChild(&GetVideo());
// This is not done automatically, so that tests control timing of `Attach`.
}
......@@ -148,7 +146,7 @@ class MediaControlsRotateToFullscreenDelegateTest
// If scripts are not enabled, controls will always be shown.
GetFrame().GetSettings()->SetScriptEnabled(true);
GetVideo().removeAttribute(kControlsAttr);
GetVideo().removeAttribute(html_names::kControlsAttr);
}
void DispatchEvent(EventTarget& target, const AtomicString& type) {
......
......@@ -17,12 +17,10 @@
namespace blink {
using namespace device::mojom::blink;
const char SensorProxy::kDefaultErrorDescription[] =
"Could not connect to a sensor";
SensorProxy::SensorProxy(SensorType sensor_type,
SensorProxy::SensorProxy(device::mojom::blink::SensorType sensor_type,
SensorProviderProxy* provider,
Page* page)
: PageVisibilityObserver(page),
......@@ -132,7 +130,7 @@ bool SensorProxy::ShouldSuspendUpdates() const {
return !focused_frame_origin->CanAccess(this_origin);
}
SensorProvider* SensorProxy::sensor_provider() const {
device::mojom::blink::SensorProvider* SensorProxy::sensor_provider() const {
return provider_->sensor_provider();
}
......
......@@ -11,11 +11,11 @@
#include "third_party/blink/renderer/modules/sensor/sensor_reading_remapper.h"
#include "third_party/blink/renderer/platform/mojo/mojo_helper.h"
namespace blink {
using device::mojom::blink::SensorCreationResult;
using namespace device::mojom::blink;
namespace blink {
SensorProxyImpl::SensorProxyImpl(SensorType sensor_type,
SensorProxyImpl::SensorProxyImpl(device::mojom::blink::SensorType sensor_type,
SensorProviderProxy* provider,
Page* page)
: SensorProxy(sensor_type, provider, page),
......@@ -50,7 +50,7 @@ void SensorProxyImpl::Initialize() {
}
void SensorProxyImpl::AddConfiguration(
SensorConfigurationPtr configuration,
device::mojom::blink::SensorConfigurationPtr configuration,
base::OnceCallback<void(bool)> callback) {
DCHECK(IsInitialized());
AddActiveFrequency(configuration->frequency);
......@@ -59,7 +59,7 @@ void SensorProxyImpl::AddConfiguration(
}
void SensorProxyImpl::RemoveConfiguration(
SensorConfigurationPtr configuration) {
device::mojom::blink::SensorConfigurationPtr configuration) {
DCHECK(IsInitialized());
RemoveActiveFrequency(configuration->frequency);
sensor_remote_->RemoveConfiguration(std::move(configuration));
......@@ -122,7 +122,7 @@ void SensorProxyImpl::RaiseError() {
}
void SensorProxyImpl::SensorReadingChanged() {
DCHECK_EQ(ReportingMode::ON_CHANGE, mode_);
DCHECK_EQ(device::mojom::blink::ReportingMode::ON_CHANGE, mode_);
if (ShouldProcessReadings())
UpdateSensorReading();
}
......@@ -154,8 +154,9 @@ void SensorProxyImpl::HandleSensorError(SensorCreationResult error) {
}
}
void SensorProxyImpl::OnSensorCreated(SensorCreationResult result,
SensorInitParamsPtr params) {
void SensorProxyImpl::OnSensorCreated(
SensorCreationResult result,
device::mojom::blink::SensorInitParamsPtr params) {
DCHECK_EQ(kInitializing, state_);
if (!params) {
DCHECK_NE(SensorCreationResult::SUCCESS, result);
......@@ -216,7 +217,7 @@ bool SensorProxyImpl::ShouldProcessReadings() const {
}
void SensorProxyImpl::UpdatePollingStatus() {
if (mode_ != ReportingMode::CONTINUOUS)
if (mode_ != device::mojom::blink::ReportingMode::CONTINUOUS)
return;
if (ShouldProcessReadings()) {
......
......@@ -14,10 +14,8 @@
namespace blink {
using namespace device::mojom::blink;
SensorProxyInspectorImpl::SensorProxyInspectorImpl(
SensorType sensor_type,
device::mojom::blink::SensorType sensor_type,
SensorProviderProxy* provider,
Page* page)
: SensorProxy(sensor_type, provider, page) {}
......@@ -41,14 +39,14 @@ void SensorProxyInspectorImpl::Initialize() {
}
void SensorProxyInspectorImpl::AddConfiguration(
SensorConfigurationPtr configuration,
device::mojom::blink::SensorConfigurationPtr configuration,
base::OnceCallback<void(bool)> callback) {
DCHECK(IsInitialized());
std::move(callback).Run(true);
}
void SensorProxyInspectorImpl::RemoveConfiguration(
SensorConfigurationPtr configuration) {
device::mojom::blink::SensorConfigurationPtr configuration) {
DCHECK(IsInitialized());
}
......
......@@ -37,8 +37,6 @@
namespace blink {
using namespace vector_math;
OscillatorHandler::OscillatorHandler(AudioNode& node,
float sample_rate,
const String& oscillator_type,
......@@ -218,15 +216,16 @@ bool OscillatorHandler::CalculateSampleAccuratePhaseIncrements(
// Convert from cents to rate scalar.
float k = 1.0 / 1200;
Vsmul(detune_values, 1, &k, detune_values, 1, frames_to_process);
vector_math::Vsmul(detune_values, 1, &k, detune_values, 1,
frames_to_process);
for (unsigned i = 0; i < frames_to_process; ++i) {
detune_values[i] = std::exp2(detune_values[i]);
}
if (has_frequency_changes) {
// Multiply frequencies by detune scalings.
Vmul(detune_values, 1, phase_increments, 1, phase_increments, 1,
frames_to_process);
vector_math::Vmul(detune_values, 1, phase_increments, 1, phase_increments,
1, frames_to_process);
}
} else {
// Handle ordinary parameter changes if there are no scheduled
......@@ -240,8 +239,8 @@ bool OscillatorHandler::CalculateSampleAccuratePhaseIncrements(
ClampFrequency(phase_increments, frames_to_process,
Context()->sampleRate() / 2);
// Convert from frequency to wavetable increment.
Vsmul(phase_increments, 1, &final_scale, phase_increments, 1,
frames_to_process);
vector_math::Vsmul(phase_increments, 1, &final_scale, phase_increments, 1,
frames_to_process);
}
return has_sample_accurate_values;
......
......@@ -49,8 +49,6 @@ const unsigned kMaxPeriodicWaveSize = 16384;
const float kCentsPerRange = 1200 / kNumberOfOctaveBands;
using namespace vector_math;
PeriodicWave* PeriodicWave::Create(BaseAudioContext& context,
const Vector<float>& real,
const Vector<float>& imag,
......@@ -251,9 +249,9 @@ void PeriodicWave::CreateBandLimitedTables(const float* real_data,
// arrays. Need to scale the data by fftSize to remove the scaling that the
// inverse IFFT would do.
float scale = fft_size;
Vsmul(real_data, 1, &scale, real_p, 1, number_of_components);
vector_math::Vsmul(real_data, 1, &scale, real_p, 1, number_of_components);
scale = -scale;
Vsmul(imag_data, 1, &scale, imag_p, 1, number_of_components);
vector_math::Vsmul(imag_data, 1, &scale, imag_p, 1, number_of_components);
// Find the starting bin where we should start culling. We need to clear
// out the highest frequencies to band-limit the waveform.
......@@ -288,7 +286,7 @@ void PeriodicWave::CreateBandLimitedTables(const float* real_data,
if (!disable_normalization) {
if (!range_index) {
float max_value;
Vmaxmgv(data, 1, &max_value, fft_size);
vector_math::Vmaxmgv(data, 1, &max_value, fft_size);
if (max_value)
normalization_scale = 1.0f / max_value;
......@@ -296,7 +294,7 @@ void PeriodicWave::CreateBandLimitedTables(const float* real_data,
}
// Apply normalization scale.
Vsmul(data, 1, &normalization_scale, data, 1, fft_size);
vector_math::Vsmul(data, 1, &normalization_scale, data, 1, fft_size);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment