static Element* elementFromCenter(Element& element)
{
    ClientRect* clientRect = element.getBoundingClientRect();
    int centerX = static_cast<int>((clientRect->left() + clientRect->right()) / 2);
    int centerY = static_cast<int>((clientRect->top() + clientRect->bottom()) / 2);

    return element.document().elementFromPoint(centerX , centerY);
}
Beispiel #2
0
JSValue jsClientRectLeft(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSClientRect* castedThis = static_cast<JSClientRect*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    ClientRect* imp = static_cast<ClientRect*>(castedThis->impl());
    JSValue result = jsNumber(exec, imp->left());
    return result;
}
Beispiel #3
0
static v8::Handle<v8::Value> leftAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.ClientRect.left._get");
    ClientRect* imp = V8ClientRect::toNative(info.Holder());
    return v8::Number::New(imp->left());
}