Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Unified Diff: content/shell/test_runner/web_ax_object_proxy.cc

Issue 2707183003: Move //components/test_runner back into //content/shell (Closed)
Patch Set: Trim DEPS Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/test_runner/web_ax_object_proxy.cc
diff --git a/components/test_runner/web_ax_object_proxy.cc b/content/shell/test_runner/web_ax_object_proxy.cc
similarity index 92%
rename from components/test_runner/web_ax_object_proxy.cc
rename to content/shell/test_runner/web_ax_object_proxy.cc
index 90df73a954577c1ec0c0ee0bedf8e025d17a9f49..55784e641edeffa9f9b4b16cce018cc9d4cae57b 100644
--- a/components/test_runner/web_ax_object_proxy.cc
+++ b/content/shell/test_runner/web_ax_object_proxy.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/test_runner/web_ax_object_proxy.h"
+#include "content/shell/test_runner/web_ax_object_proxy.h"
#include <stddef.h>
@@ -25,8 +25,7 @@ namespace {
// Map role value to string, matching Safari/Mac platform implementation to
// avoid rebaselining layout tests.
-std::string RoleToString(blink::WebAXRole role)
-{
+std::string RoleToString(blink::WebAXRole role) {
std::string result = "AXRole: AX";
switch (role) {
case blink::WebAXRoleAbbr:
@@ -281,8 +280,7 @@ std::string GetStringValue(const blink::WebAXObject& object) {
unsigned int red = (color >> 16) & 0xFF;
unsigned int green = (color >> 8) & 0xFF;
unsigned int blue = color & 0xFF;
- value = base::StringPrintf("rgba(%d, %d, %d, 1)",
- red, green, blue);
+ value = base::StringPrintf("rgba(%d, %d, %d, 1)", red, green, blue);
} else {
value = object.stringValue().utf8();
}
@@ -331,18 +329,16 @@ blink::WebFloatRect BoundsForObject(const blink::WebAXObject& object) {
gfx::RectF computedBounds(0, 0, bounds.width, bounds.height);
while (!container.isDetached()) {
computedBounds.Offset(bounds.x, bounds.y);
- computedBounds.Offset(
- -container.getScrollOffset().x, -container.getScrollOffset().y);
+ computedBounds.Offset(-container.getScrollOffset().x,
+ -container.getScrollOffset().y);
if (!matrix.isIdentity()) {
gfx::Transform transform(matrix);
transform.TransformRect(&computedBounds);
}
container.getRelativeBounds(container, bounds, matrix);
}
- return blink::WebFloatRect(computedBounds.x(),
- computedBounds.y(),
- computedBounds.width(),
- computedBounds.height());
+ return blink::WebFloatRect(computedBounds.x(), computedBounds.y(),
+ computedBounds.width(), computedBounds.height());
}
blink::WebRect BoundsForCharacter(const blink::WebAXObject& object,
@@ -370,35 +366,35 @@ blink::WebRect BoundsForCharacter(const blink::WebAXObject& object,
case blink::WebAXTextDirectionLR: {
if (localIndex) {
int left = inline_text_box_rect.x + character_offsets[localIndex - 1];
- int width = character_offsets[localIndex] -
- character_offsets[localIndex - 1];
- return blink::WebRect(left, inline_text_box_rect.y,
- width, inline_text_box_rect.height);
+ int width =
+ character_offsets[localIndex] - character_offsets[localIndex - 1];
+ return blink::WebRect(left, inline_text_box_rect.y, width,
+ inline_text_box_rect.height);
}
- return blink::WebRect(
- inline_text_box_rect.x, inline_text_box_rect.y,
- character_offsets[0], inline_text_box_rect.height);
+ return blink::WebRect(inline_text_box_rect.x, inline_text_box_rect.y,
+ character_offsets[0],
+ inline_text_box_rect.height);
}
case blink::WebAXTextDirectionRL: {
int right = inline_text_box_rect.x + inline_text_box_rect.width;
if (localIndex) {
int left = right - character_offsets[localIndex];
- int width = character_offsets[localIndex] -
- character_offsets[localIndex - 1];
- return blink::WebRect(left, inline_text_box_rect.y,
- width, inline_text_box_rect.height);
+ int width =
+ character_offsets[localIndex] - character_offsets[localIndex - 1];
+ return blink::WebRect(left, inline_text_box_rect.y, width,
+ inline_text_box_rect.height);
}
int left = right - character_offsets[0];
- return blink::WebRect(
- left, inline_text_box_rect.y,
- character_offsets[0], inline_text_box_rect.height);
+ return blink::WebRect(left, inline_text_box_rect.y,
+ character_offsets[0],
+ inline_text_box_rect.height);
}
case blink::WebAXTextDirectionTB: {
if (localIndex) {
int top = inline_text_box_rect.y + character_offsets[localIndex - 1];
- int height = character_offsets[localIndex] -
- character_offsets[localIndex - 1];
+ int height =
+ character_offsets[localIndex] - character_offsets[localIndex - 1];
return blink::WebRect(inline_text_box_rect.x, top,
inline_text_box_rect.width, height);
}
@@ -410,8 +406,8 @@ blink::WebRect BoundsForCharacter(const blink::WebAXObject& object,
if (localIndex) {
int top = bottom - character_offsets[localIndex];
- int height = character_offsets[localIndex] -
- character_offsets[localIndex - 1];
+ int height =
+ character_offsets[localIndex] - character_offsets[localIndex - 1];
return blink::WebRect(inline_text_box_rect.x, top,
inline_text_box_rect.width, height);
}
@@ -549,19 +545,16 @@ class SparseAttributeAdapter : public blink::WebAXSparseAttributeClient {
} // namespace
-gin::WrapperInfo WebAXObjectProxy::kWrapperInfo = {
- gin::kEmbedderNativeGin};
+gin::WrapperInfo WebAXObjectProxy::kWrapperInfo = {gin::kEmbedderNativeGin};
WebAXObjectProxy::WebAXObjectProxy(const blink::WebAXObject& object,
WebAXObjectProxy::Factory* factory)
- : accessibility_object_(object),
- factory_(factory) {
-}
+ : accessibility_object_(object), factory_(factory) {}
WebAXObjectProxy::~WebAXObjectProxy() {}
-gin::ObjectTemplateBuilder
-WebAXObjectProxy::GetObjectTemplateBuilder(v8::Isolate* isolate) {
+gin::ObjectTemplateBuilder WebAXObjectProxy::GetObjectTemplateBuilder(
+ v8::Isolate* isolate) {
return gin::Wrappable<WebAXObjectProxy>::GetObjectTemplateBuilder(isolate)
.SetProperty("role", &WebAXObjectProxy::Role)
.SetProperty("stringValue", &WebAXObjectProxy::StringValue)
@@ -747,18 +740,16 @@ void WebAXObjectProxy::NotificationReceived(
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::Local<v8::Value> argv[] = {
- v8::String::NewFromUtf8(isolate, notification_name.data(),
- v8::String::kNormalString,
- notification_name.size()),
+ v8::String::NewFromUtf8(isolate, notification_name.data(),
+ v8::String::kNormalString,
+ notification_name.size()),
};
frame->callFunctionEvenIfScriptDisabled(
v8::Local<v8::Function>::New(isolate, notification_callback_),
- context->Global(),
- arraysize(argv),
- argv);
+ context->Global(), arraysize(argv), argv);
}
-void WebAXObjectProxy::Reset() {
+void WebAXObjectProxy::Reset() {
notification_callback_.Reset();
}
@@ -824,7 +815,7 @@ std::string WebAXObjectProxy::ValueDescription() {
int WebAXObjectProxy::ChildrenCount() {
accessibility_object_.updateLayoutAndCheckValidity();
- int count = 1; // Root object always has only one child, the WebView.
+ int count = 1; // Root object always has only one child, the WebView.
if (!IsRoot())
count = accessibility_object_.childCount();
return count;
@@ -875,8 +866,8 @@ std::string WebAXObjectProxy::SelectionAnchorAffinity() {
blink::WebAXTextAffinity focusAffinity;
accessibility_object_.selection(anchorObject, anchorOffset, anchorAffinity,
focusObject, focusOffset, focusAffinity);
- return anchorAffinity == blink::WebAXTextAffinityUpstream ?
- "upstream" : "downstream";
+ return anchorAffinity == blink::WebAXTextAffinityUpstream ? "upstream"
+ : "downstream";
}
v8::Local<v8::Value> WebAXObjectProxy::SelectionFocusObject() {
@@ -924,8 +915,8 @@ std::string WebAXObjectProxy::SelectionFocusAffinity() {
blink::WebAXTextAffinity focusAffinity;
accessibility_object_.selection(anchorObject, anchorOffset, anchorAffinity,
focusObject, focusOffset, focusAffinity);
- return focusAffinity == blink::WebAXTextAffinityUpstream ?
- "upstream" : "downstream";
+ return focusAffinity == blink::WebAXTextAffinityUpstream ? "upstream"
+ : "downstream";
}
int WebAXObjectProxy::SelectionStart() {
@@ -1076,8 +1067,8 @@ std::string WebAXObjectProxy::Orientation() {
accessibility_object_.updateLayoutAndCheckValidity();
if (accessibility_object_.orientation() == blink::WebAXOrientationVertical)
return "AXOrientation: AXVerticalOrientation";
- else if (accessibility_object_.orientation()
- == blink::WebAXOrientationHorizontal)
+ else if (accessibility_object_.orientation() ==
+ blink::WebAXOrientationHorizontal)
return "AXOrientation: AXHorizontalOrientation";
return std::string();
@@ -1122,8 +1113,7 @@ int32_t WebAXObjectProxy::ColumnCount() {
return static_cast<int32_t>(accessibility_object_.columnCount());
}
-int32_t WebAXObjectProxy::ColumnHeadersCount()
-{
+int32_t WebAXObjectProxy::ColumnHeadersCount() {
accessibility_object_.updateLayoutAndCheckValidity();
blink::WebVector<blink::WebAXObject> headers;
accessibility_object_.columnHeaders(headers);
@@ -1170,8 +1160,7 @@ v8::Local<v8::Object> WebAXObjectProxy::AriaFlowToElementAtIndex(
return factory_->GetOrCreate(elements[index]);
}
-v8::Local<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index)
-{
+v8::Local<v8::Object> WebAXObjectProxy::AriaOwnsElementAtIndex(unsigned index) {
accessibility_object_.updateLayoutAndCheckValidity();
blink::WebVector<blink::WebAXObject> elements;
accessibility_object_.ariaOwns(elements);
@@ -1230,8 +1219,8 @@ std::string WebAXObjectProxy::BoundsForRange(int start, int end) {
bounds.height = bottom - bounds.y;
}
- return base::StringPrintf("{x: %d, y: %d, width: %d, height: %d}",
- bounds.x, bounds.y, bounds.width, bounds.height);
+ return base::StringPrintf("{x: %d, y: %d, width: %d, height: %d}", bounds.x,
+ bounds.y, bounds.width, bounds.height);
}
v8::Local<v8::Object> WebAXObjectProxy::ChildAtIndex(int index) {
@@ -1294,8 +1283,8 @@ std::string WebAXObjectProxy::ColumnIndexRange() {
return base::StringPrintf("{%d, %d}", column_index, column_span);
}
-v8::Local<v8::Object> WebAXObjectProxy::CellForColumnAndRow(
- int column, int row) {
+v8::Local<v8::Object> WebAXObjectProxy::CellForColumnAndRow(int column,
+ int row) {
accessibility_object_.updateLayoutAndCheckValidity();
blink::WebAXObject obj =
accessibility_object_.cellForColumnAndRow(column, row);
@@ -1305,16 +1294,16 @@ v8::Local<v8::Object> WebAXObjectProxy::CellForColumnAndRow(
return factory_->GetOrCreate(obj);
}
-void WebAXObjectProxy::SetSelectedTextRange(int selection_start,
- int length) {
+void WebAXObjectProxy::SetSelectedTextRange(int selection_start, int length) {
accessibility_object_.updateLayoutAndCheckValidity();
accessibility_object_.setSelectedTextRange(selection_start,
- selection_start + length);
+ selection_start + length);
}
-void WebAXObjectProxy::SetSelection(
- v8::Local<v8::Value> anchor_object, int anchor_offset,
- v8::Local<v8::Value> focus_object, int focus_offset) {
+void WebAXObjectProxy::SetSelection(v8::Local<v8::Value> anchor_object,
+ int anchor_offset,
+ v8::Local<v8::Value> focus_object,
+ int focus_offset) {
if (anchor_object.IsEmpty() || focus_object.IsEmpty() ||
!anchor_object->IsObject() || !focus_object->IsObject() ||
anchor_offset < 0 || focus_offset < 0) {
@@ -1322,15 +1311,15 @@ void WebAXObjectProxy::SetSelection(
}
WebAXObjectProxy* web_ax_anchor = nullptr;
- if (!gin::ConvertFromV8(
- blink::mainThreadIsolate(), anchor_object, &web_ax_anchor)) {
+ if (!gin::ConvertFromV8(blink::mainThreadIsolate(), anchor_object,
+ &web_ax_anchor)) {
return;
}
DCHECK(web_ax_anchor);
WebAXObjectProxy* web_ax_focus = nullptr;
- if (!gin::ConvertFromV8(
- blink::mainThreadIsolate(), focus_object, &web_ax_focus)) {
+ if (!gin::ConvertFromV8(blink::mainThreadIsolate(), focus_object,
+ &web_ax_focus)) {
return;
}
DCHECK(web_ax_focus);
@@ -1427,8 +1416,10 @@ void WebAXObjectProxy::ScrollToMakeVisible() {
accessibility_object_.scrollToMakeVisible();
}
-void WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus(int x, int y,
- int width, int height) {
+void WebAXObjectProxy::ScrollToMakeVisibleWithSubFocus(int x,
+ int y,
+ int width,
+ int height) {
accessibility_object_.updateLayoutAndCheckValidity();
accessibility_object_.scrollToMakeVisibleWithSubFocus(
blink::WebRect(x, y, width, height));
@@ -1475,8 +1466,8 @@ int WebAXObjectProxy::WordStart(int character_index) {
return -1;
int word_start = 0, word_end = 0;
- GetBoundariesForOneWord(accessibility_object_, character_index,
- word_start, word_end);
+ GetBoundariesForOneWord(accessibility_object_, character_index, word_start,
+ word_end);
return word_start;
}
@@ -1486,8 +1477,8 @@ int WebAXObjectProxy::WordEnd(int character_index) {
return -1;
int word_start = 0, word_end = 0;
- GetBoundariesForOneWord(accessibility_object_, character_index,
- word_start, word_end);
+ GetBoundariesForOneWord(accessibility_object_, character_index, word_start,
+ word_end);
return word_end;
}
@@ -1526,7 +1517,7 @@ std::string WebAXObjectProxy::NameFrom() {
blink::WebAXNameFrom nameFrom = blink::WebAXNameFromUninitialized;
blink::WebVector<blink::WebAXObject> nameObjects;
accessibility_object_.name(nameFrom, nameObjects);
- switch(nameFrom) {
+ switch (nameFrom) {
case blink::WebAXNameFromUninitialized:
return "";
case blink::WebAXNameFromAttribute:
@@ -1574,8 +1565,9 @@ std::string WebAXObjectProxy::Description() {
accessibility_object_.name(nameFrom, nameObjects);
blink::WebAXDescriptionFrom descriptionFrom;
blink::WebVector<blink::WebAXObject> descriptionObjects;
- return accessibility_object_.description(
- nameFrom, descriptionFrom, descriptionObjects).utf8();
+ return accessibility_object_
+ .description(nameFrom, descriptionFrom, descriptionObjects)
+ .utf8();
}
std::string WebAXObjectProxy::DescriptionFrom() {
@@ -1586,9 +1578,9 @@ std::string WebAXObjectProxy::DescriptionFrom() {
blink::WebAXDescriptionFrom descriptionFrom =
blink::WebAXDescriptionFromUninitialized;
blink::WebVector<blink::WebAXObject> descriptionObjects;
- accessibility_object_.description(
- nameFrom, descriptionFrom, descriptionObjects);
- switch(descriptionFrom) {
+ accessibility_object_.description(nameFrom, descriptionFrom,
+ descriptionObjects);
+ switch (descriptionFrom) {
case blink::WebAXDescriptionFromUninitialized:
return "";
case blink::WebAXDescriptionFromAttribute:
@@ -1623,8 +1615,8 @@ int WebAXObjectProxy::DescriptionElementCount() {
accessibility_object_.name(nameFrom, nameObjects);
blink::WebAXDescriptionFrom descriptionFrom;
blink::WebVector<blink::WebAXObject> descriptionObjects;
- accessibility_object_.description(
- nameFrom, descriptionFrom, descriptionObjects);
+ accessibility_object_.description(nameFrom, descriptionFrom,
+ descriptionObjects);
return static_cast<int>(descriptionObjects.size());
}
@@ -1636,8 +1628,8 @@ v8::Local<v8::Object> WebAXObjectProxy::DescriptionElementAtIndex(
accessibility_object_.name(nameFrom, nameObjects);
blink::WebAXDescriptionFrom descriptionFrom;
blink::WebVector<blink::WebAXObject> descriptionObjects;
- accessibility_object_.description(
- nameFrom, descriptionFrom, descriptionObjects);
+ accessibility_object_.description(nameFrom, descriptionFrom,
+ descriptionObjects);
if (index >= descriptionObjects.size())
return v8::Local<v8::Object>();
return factory_->GetOrCreate(descriptionObjects[index]);
@@ -1698,10 +1690,9 @@ bool WebAXObjectProxy::HasNonIdentityTransform() {
return !matrix.isIdentity();
}
-RootWebAXObjectProxy::RootWebAXObjectProxy(
- const blink::WebAXObject &object, Factory *factory)
- : WebAXObjectProxy(object, factory) {
-}
+RootWebAXObjectProxy::RootWebAXObjectProxy(const blink::WebAXObject& object,
+ Factory* factory)
+ : WebAXObjectProxy(object, factory) {}
v8::Local<v8::Object> RootWebAXObjectProxy::GetChildAtIndex(unsigned index) {
if (index)
@@ -1715,8 +1706,7 @@ bool RootWebAXObjectProxy::IsRoot() const {
}
WebAXObjectProxyList::WebAXObjectProxyList()
- : elements_(blink::mainThreadIsolate()) {
-}
+ : elements_(blink::mainThreadIsolate()) {}
WebAXObjectProxyList::~WebAXObjectProxyList() {
Clear();
@@ -1728,8 +1718,8 @@ void WebAXObjectProxyList::Clear() {
size_t elementCount = elements_.Size();
for (size_t i = 0; i < elementCount; i++) {
WebAXObjectProxy* unwrapped_object = NULL;
- bool result = gin::ConvertFromV8(isolate, elements_.Get(i),
- &unwrapped_object);
+ bool result =
+ gin::ConvertFromV8(isolate, elements_.Get(i), &unwrapped_object);
DCHECK(result);
DCHECK(unwrapped_object);
unwrapped_object->Reset();
@@ -1747,16 +1737,16 @@ v8::Local<v8::Object> WebAXObjectProxyList::GetOrCreate(
size_t elementCount = elements_.Size();
for (size_t i = 0; i < elementCount; i++) {
WebAXObjectProxy* unwrapped_object = NULL;
- bool result = gin::ConvertFromV8(isolate, elements_.Get(i),
- &unwrapped_object);
+ bool result =
+ gin::ConvertFromV8(isolate, elements_.Get(i), &unwrapped_object);
DCHECK(result);
DCHECK(unwrapped_object);
if (unwrapped_object->IsEqualToObject(object))
return elements_.Get(i);
}
- v8::Local<v8::Value> value_handle = gin::CreateHandle(
- isolate, new WebAXObjectProxy(object, this)).ToV8();
+ v8::Local<v8::Value> value_handle =
+ gin::CreateHandle(isolate, new WebAXObjectProxy(object, this)).ToV8();
if (value_handle.IsEmpty())
return v8::Local<v8::Object>();
v8::Local<v8::Object> handle = value_handle->ToObject(isolate);

Powered by Google App Engine
This is Rietveld 408576698