Add CefDOMNode::GetElementBounds() method

This commit is contained in:
Marshall Greenblatt
2016-09-09 14:02:57 -04:00
parent 1679632000
commit a312974ad9
8 changed files with 73 additions and 1 deletions

View File

@@ -378,6 +378,23 @@ CefString CefDOMNodeImpl::GetElementInnerText() {
return str;
}
CefRect CefDOMNodeImpl::GetElementBounds() {
CefRect rect;
if (!VerifyContext())
return rect;
if (!node_.isElementNode()) {
NOTREACHED();
return rect;
}
WebElement element = node_.to<blink::WebElement>();
blink::WebRect rc = element.boundsInViewport();
rect.Set(rc.x, rc.y, rc.width, rc.height);
return rect;
}
void CefDOMNodeImpl::Detach() {
document_ = NULL;
node_.assign(WebNode());