本文整理汇总了C++中FrameView::contentsToRootFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::contentsToRootFrame方法的具体用法?C++ FrameView::contentsToRootFrame怎么用?C++ FrameView::contentsToRootFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::contentsToRootFrame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBoxModel
// static
bool InspectorHighlight::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxModel>& model)
{
LayoutObject* layoutObject = node->layoutObject();
FrameView* view = node->document().view();
if (!layoutObject || !view)
return false;
FloatQuad content, padding, border, margin;
if (!buildNodeQuads(node, &content, &padding, &border, &margin))
return false;
IntRect boundingBox = view->contentsToRootFrame(layoutObject->absoluteBoundingBoxRect());
LayoutBoxModelObject* modelObject = layoutObject->isBoxModelObject() ? toLayoutBoxModelObject(layoutObject) : nullptr;
model = TypeBuilder::DOM::BoxModel::create()
.setContent(buildArrayForQuad(content))
.setPadding(buildArrayForQuad(padding))
.setBorder(buildArrayForQuad(border))
.setMargin(buildArrayForQuad(margin))
.setWidth(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width())
.setHeight(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height());
Shape::DisplayPaths paths;
FloatQuad boundsQuad;
if (const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &paths, &boundsQuad)) {
RefPtr<TypeBuilder::DOM::ShapeOutsideInfo> shapeTypeBuilder = TypeBuilder::DOM::ShapeOutsideInfo::create()
.setBounds(buildArrayForQuad(boundsQuad))
.setShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.shape))
.setMarginShape(ShapePathBuilder::buildPath(*view, *layoutObject, *shapeOutsideInfo, paths.marginShape));
model->setShapeOutside(shapeTypeBuilder);
}
return true;
}
示例2: if
// Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mouse
// with touch input for plugins that don't support touch input).
WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObject* layoutObject, const TouchEvent& event)
{
if (!event.touches())
return;
if (event.touches()->length() != 1) {
if (event.touches()->length() || event.type() != EventTypeNames::touchend || !event.changedTouches() || event.changedTouches()->length() != 1)
return;
}
const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(0) : event.changedTouches()->item(0);
if (touch->identifier())
return;
if (event.type() == EventTypeNames::touchstart)
type = MouseDown;
else if (event.type() == EventTypeNames::touchmove)
type = MouseMove;
else if (event.type() == EventTypeNames::touchend)
type = MouseUp;
else
return;
// TODO(majidvp): Instead of using |Event::createTime| which is epoch time
// we should instead use |Event::platformTimeStamp| which is the actual
// platform monotonic time. See: crbug.com/538199
timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
modifiers = event.modifiers();
// The mouse event co-ordinates should be generated from the co-ordinates of the touch point.
FrameView* view = toFrameView(widget->parent());
// FIXME: if view == nullptr, pointInRootFrame will really be pointInRootContent.
IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation());
if (view)
pointInRootFrame = view->contentsToRootFrame(pointInRootFrame);
IntPoint screenPoint = roundedIntPoint(touch->screenLocation());
globalX = screenPoint.x();
globalY = screenPoint.y();
windowX = pointInRootFrame.x();
windowY = pointInRootFrame.y();
button = WebMouseEvent::ButtonLeft;
modifiers |= WebInputEvent::LeftButtonDown;
clickCount = (type == MouseDown || type == MouseUp);
IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absoluteLocation(), *layoutObject);
x = localPoint.x();
y = localPoint.y();
}
示例3: if
// Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mouse
// with touch input for plugins that don't support touch input).
WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObject* layoutObject, const TouchEvent& event)
{
if (!event.touches())
return;
if (event.touches()->length() != 1) {
if (event.touches()->length() || event.type() != EventTypeNames::touchend || !event.changedTouches() || event.changedTouches()->length() != 1)
return;
}
const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(0) : event.changedTouches()->item(0);
if (touch->identifier())
return;
if (event.type() == EventTypeNames::touchstart)
type = MouseDown;
else if (event.type() == EventTypeNames::touchmove)
type = MouseMove;
else if (event.type() == EventTypeNames::touchend)
type = MouseUp;
else
return;
timeStampSeconds = event.platformTimeStamp();
modifiers = event.modifiers();
// The mouse event co-ordinates should be generated from the co-ordinates of the touch point.
FrameView* view = toFrameView(widget->parent());
// FIXME: if view == nullptr, pointInRootFrame will really be pointInRootContent.
IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation());
if (view)
pointInRootFrame = view->contentsToRootFrame(pointInRootFrame);
IntPoint screenPoint = roundedIntPoint(touch->screenLocation());
globalX = screenPoint.x();
globalY = screenPoint.y();
windowX = pointInRootFrame.x();
windowY = pointInRootFrame.y();
button = WebMouseEvent::ButtonLeft;
modifiers |= WebInputEvent::LeftButtonDown;
clickCount = (type == MouseDown || type == MouseUp);
IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absoluteLocation(), *layoutObject);
x = localPoint.x();
y = localPoint.y();
pointerType = WebPointerProperties::PointerType::Touch;
}
示例4: updateWebMouseEventFromCoreMouseEvent
// FIXME: Change |widget| to const Widget& after RemoteFrames get
// RemoteFrameViews.
static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event, const Widget* widget, const LayoutObject& layoutObject, WebMouseEvent& webEvent)
{
webEvent.timeStampSeconds = event.platformTimeStamp();
webEvent.modifiers = event.modifiers();
FrameView* view = widget ? toFrameView(widget->parent()) : 0;
// TODO(bokan): If view == nullptr, pointInRootFrame will really be pointInRootContent.
IntPoint pointInRootFrame = IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y());
if (view)
pointInRootFrame = view->contentsToRootFrame(pointInRootFrame);
webEvent.globalX = event.screenX();
webEvent.globalY = event.screenY();
webEvent.windowX = pointInRootFrame.x();
webEvent.windowY = pointInRootFrame.y();
IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteLocation(), layoutObject);
webEvent.x = localPoint.x();
webEvent.y = localPoint.y();
}