// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(hajimehoshi): Remove this when UnsafePersistent is removed.
-#define V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
-
#include "content/shell/renderer/test_runner/web_ax_object_proxy.h"
#include "base/strings/stringprintf.h"
}
int WebAXObjectProxy::X() {
+ accessibility_object_.updateBackingStoreAndCheckValidity();
return accessibility_object().boundingBoxRect().x;
}
int WebAXObjectProxy::Y() {
+ accessibility_object_.updateBackingStoreAndCheckValidity();
return accessibility_object().boundingBoxRect().y;
}
int WebAXObjectProxy::Width() {
+ accessibility_object_.updateBackingStoreAndCheckValidity();
return accessibility_object().boundingBoxRect().width;
}
int WebAXObjectProxy::Height() {
+ accessibility_object_.updateBackingStoreAndCheckValidity();
return accessibility_object().boundingBoxRect().height;
}
if (accessibility_object().role() != blink::WebAXRoleStaticText)
return std::string();
+ if (!accessibility_object_.updateBackingStoreAndCheckValidity())
+ return std::string();
+
int len = end - start;
// Get the bounds for each character and union them into one large rectangle.
return true;
}
-WebAXObjectProxyList::WebAXObjectProxyList() {
+WebAXObjectProxyList::WebAXObjectProxyList()
+ : elements_(blink::mainThreadIsolate()) {
}
WebAXObjectProxyList::~WebAXObjectProxyList() {
}
void WebAXObjectProxyList::Clear() {
- for (ElementList::iterator i = elements_.begin(); i != elements_.end(); ++i)
- i->Dispose();
- elements_.clear();
+ elements_.Clear();
}
v8::Handle<v8::Object> WebAXObjectProxyList::GetOrCreate(
v8::Isolate* isolate = blink::mainThreadIsolate();
- size_t elementCount = elements_.size();
+ size_t elementCount = elements_.Size();
for (size_t i = 0; i < elementCount; i++) {
WebAXObjectProxy* unwrapped_object = NULL;
- bool result = gin::ConvertFromV8(isolate, elements_[i].NewLocal(isolate),
+ bool result = gin::ConvertFromV8(isolate, elements_.Get(i),
&unwrapped_object);
DCHECK(result);
DCHECK(unwrapped_object);
if (unwrapped_object->IsEqualToObject(object))
- return elements_[i].NewLocal(isolate);
+ return elements_.Get(i);
}
v8::Handle<v8::Value> value_handle = gin::CreateHandle(
if (value_handle.IsEmpty())
return v8::Handle<v8::Object>();
v8::Handle<v8::Object> handle = value_handle->ToObject();
- UnsafePersistent<v8::Object> unsafe_handle(isolate, handle);
- elements_.push_back(unsafe_handle);
- return unsafe_handle.NewLocal(isolate);
+ elements_.Append(handle);
+ return handle;
}
v8::Handle<v8::Object> WebAXObjectProxyList::CreateRoot(
if (value_handle.IsEmpty())
return v8::Handle<v8::Object>();
v8::Handle<v8::Object> handle = value_handle->ToObject();
- UnsafePersistent<v8::Object> unsafe_handle(isolate, handle);
- elements_.push_back(unsafe_handle);
- return unsafe_handle.NewLocal(isolate);
+ elements_.Append(handle);
+ return handle;
}
} // namespace content