本文整理汇总了C++中roundedLayoutPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ roundedLayoutPoint函数的具体用法?C++ roundedLayoutPoint怎么用?C++ roundedLayoutPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了roundedLayoutPoint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: localToParentTransform
bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
// Give RenderSVGViewportContainer a chance to apply its viewport clip
if (!pointIsInsideViewportClip(pointInParent))
return false;
FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
return false;
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
updateHitTestResult(result, roundedLayoutPoint(localPoint));
return true;
}
}
// Accessibility wants to return SVG containers, if appropriate.
if (request.type() & HitTestRequest::AccessibilityHitTest && m_objectBoundingBox.contains(localPoint)) {
updateHitTestResult(result, roundedLayoutPoint(localPoint));
return true;
}
// Spec: Only graphical elements can be targeted by the mouse, period.
// 16.4: "If there are no graphics elements whose relevant graphics content is under the pointer (i.e., there is no target element), the event is not dispatched."
return false;
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:28,代码来源:RenderSVGContainer.cpp
示例2: updateHitTestResult
bool RenderSVGContainer::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
// Give RenderSVGViewportContainer a chance to apply its viewport clip
if (!pointIsInsideViewportClip(pointInParent))
return false;
FloatPoint localPoint;
if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToParentTransform(), pointInParent, localPoint))
return false;
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) {
updateHitTestResult(result, roundedLayoutPoint(localPoint));
return true;
}
}
// pointer-events=boundingBox makes it possible for containers to be direct targets
if (style()->pointerEvents() == PE_BOUNDINGBOX) {
ASSERT(isObjectBoundingBoxValid());
if (objectBoundingBox().contains(localPoint)) {
updateHitTestResult(result, roundedLayoutPoint(localPoint));
return true;
}
}
// 16.4: "If there are no graphics elements whose relevant graphics content is under the pointer (i.e., there is no target element), the event is not dispatched."
return false;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:28,代码来源:RenderSVGContainer.cpp
示例3: input
void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
{
RefPtrWillBeRawPtr<HTMLInputElement> input(hostInput());
Element* trackElement = input->closedShadowRoot()->getElementById(ShadowElementNames::sliderTrack());
if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox())
return;
LayoutPoint offset = roundedLayoutPoint(input->layoutObject()->absoluteToLocal(FloatPoint(point), UseTransforms));
bool isVertical = hasVerticalAppearance(input.get());
bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection();
LayoutUnit trackSize;
LayoutUnit position;
LayoutUnit currentPosition;
// We need to calculate currentPosition from absolute points becaue the
// renderer for this node is usually on a layer and layoutBox()->x() and
// y() are unusable.
// FIXME: This should probably respect transforms.
LayoutPoint absoluteThumbOrigin = layoutBox()->absoluteBoundingBoxRectIgnoringTransforms().location();
LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->layoutObject()->localToAbsolute());
IntRect trackBoundingBox = trackElement->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms();
IntRect inputBoundingBox = input->layoutObject()->absoluteBoundingBoxRectIgnoringTransforms();
if (isVertical) {
trackSize = trackElement->layoutBox()->contentHeight() - layoutBox()->size().height();
position = offset.y() - layoutBox()->size().height() / 2 - trackBoundingBox.y() + inputBoundingBox.y() - layoutBox()->marginBottom();
currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.y();
} else {
trackSize = trackElement->layoutBox()->contentWidth() - layoutBox()->size().width();
position = offset.x() - layoutBox()->size().width() / 2 - trackBoundingBox.x() + inputBoundingBox.x();
position -= isLeftToRightDirection ? layoutBox()->marginLeft() : layoutBox()->marginRight();
currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
}
position = std::max<LayoutUnit>(0, std::min(position, trackSize));
const Decimal ratio = Decimal::fromDouble(static_cast<double>(position) / trackSize);
const Decimal fraction = isVertical || !isLeftToRightDirection ? Decimal(1) - ratio : ratio;
StepRange stepRange(input->createStepRange(RejectAny));
Decimal value = stepRange.clampValue(stepRange.valueFromProportion(fraction));
Decimal closest = input->findClosestTickMarkValue(value);
if (closest.isFinite()) {
double closestFraction = stepRange.proportionFromValue(closest).toDouble();
double closestRatio = isVertical || !isLeftToRightDirection ? 1.0 - closestFraction : closestFraction;
LayoutUnit closestPosition = trackSize * closestRatio;
const LayoutUnit snappingThreshold = 5;
if ((closestPosition - position).abs() <= snappingThreshold)
value = closest;
}
String valueString = serializeForNumberType(value);
if (valueString == input->value())
return;
// FIXME: This is no longer being set from renderer. Consider updating the method name.
input->setValueFromRenderer(valueString);
if (layoutObject())
layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::SliderValueChanged);
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:57,代码来源:SliderThumbElement.cpp
示例4: target
void MouseRelatedEvent::computeRelativePosition()
{
Node* targetNode = target() ? target()->toNode() : 0;
if (!targetNode)
return;
// Compute coordinates that are based on the target.
m_layerLocation = m_pageLocation;
m_offsetLocation = m_pageLocation;
// Must have an updated render tree for this math to work correctly.
targetNode->document().updateLayoutIgnorePendingStylesheets();
// Adjust offsetLocation to be relative to the target's position.
if (RenderObject* r = targetNode->renderer()) {
FloatPoint localPos = r->absoluteToLocal(absoluteLocation(), UseTransforms);
m_offsetLocation = roundedLayoutPoint(localPos);
}
// Adjust layerLocation to be relative to the layer.
// FIXME: event.layerX and event.layerY are poorly defined,
// and probably don't always correspond to RenderLayer offsets.
// https://bugs.webkit.org/show_bug.cgi?id=21868
Node* n = targetNode;
while (n && !n->renderer())
n = n->parentNode();
if (n) {
// FIXME: This logic is a wrong implementation of convertToLayerCoords.
for (RenderLayer* layer = n->renderer()->enclosingLayer(); layer; layer = layer->parent())
m_layerLocation -= toLayoutSize(layer->location());
}
m_hasCachedRelativePosition = true;
}
开发者ID:viettrungluu-cr,项目名称:mojo,代码行数:35,代码来源:MouseRelatedEvent.cpp
示例5: roundedLayoutPoint
bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());
// Hit test the markup box.
if (InlineBox* markupBox = this->markupBox()) {
RenderStyle* style = renderer().style(isFirstLineStyle());
LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->renderer().style(isFirstLineStyle())->fontMetrics().ascent());
if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
renderer().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
return true;
}
}
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(accumulatedOffset);
FloatRect boundsRect(boxOrigin, size());
if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
if (!result.addNodeToRectBasedTestResult(renderer().node(), request, locationInContainer, boundsRect))
return true;
}
return false;
}
开发者ID:335969568,项目名称:Blink-1,代码行数:26,代码来源:EllipsisBox.cpp
示例6: container
void RenderBoxModelObject::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const
{
RenderObject* o = container();
if (!o)
return;
if (o->isRenderFlowThread())
transformState.move(o->columnOffset(LayoutPoint(transformState.mappedPoint())));
o->mapAbsoluteToLocalPoint(mode, transformState);
LayoutSize containerOffset = offsetFromContainer(o, LayoutPoint());
if (!style()->hasOutOfFlowPosition() && o->hasColumns()) {
RenderBlock* block = toRenderBlock(o);
LayoutPoint point(roundedLayoutPoint(transformState.mappedPoint()));
point -= containerOffset;
block->adjustForColumnRect(containerOffset, point);
}
bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || style()->preserves3D());
if (mode & UseTransforms && shouldUseTransformFromContainer(o)) {
TransformationMatrix t;
getTransformFromContainer(o, containerOffset, t);
transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
} else
transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:28,代码来源:RenderBoxModelObject.cpp
示例7: hitRules
bool LayoutSVGImage::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
// We only draw in the forground phase, so we only hit-test then.
if (hitTestAction != HitTestForeground)
return false;
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, result.hitTestRequest(), style()->pointerEvents());
bool isVisible = (style()->visibility() == VISIBLE);
if (isVisible || !hitRules.requireVisible) {
FloatPoint localPoint;
if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(this, localToSVGParentTransform(), pointInParent, localPoint))
return false;
if (hitRules.canHitFill || hitRules.canHitBoundingBox) {
if (m_objectBoundingBox.contains(localPoint)) {
const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint);
updateHitTestResult(result, localLayoutPoint);
if (result.addNodeToListBasedTestResult(element(), localLayoutPoint) == StopHitTesting)
return true;
}
}
}
return false;
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:25,代码来源:LayoutSVGImage.cpp
示例8: parent
void RenderMultiColumnFlowThread::mapAbsoluteToLocalPoint(MapCoordinatesFlags mode, TransformState& transformState) const
{
// First get the transform state's point into the block flow thread's physical coordinate space.
parent()->mapAbsoluteToLocalPoint(mode, transformState);
LayoutPoint transformPoint = roundedLayoutPoint(transformState.mappedPoint());
// Now walk through each region.
const RenderMultiColumnSet* candidateColumnSet = nullptr;
LayoutPoint candidatePoint;
LayoutSize candidateContainerOffset;
for (const auto& columnSet : childrenOfType<RenderMultiColumnSet>(*parent())) {
candidateContainerOffset = columnSet.offsetFromContainer(parent(), LayoutPoint());
candidatePoint = transformPoint - candidateContainerOffset;
candidateColumnSet = &columnSet;
// We really have no clue what to do with overflow. We'll just use the closest region to the point in that case.
LayoutUnit pointOffset = isHorizontalWritingMode() ? candidatePoint.y() : candidatePoint.x();
LayoutUnit regionOffset = isHorizontalWritingMode() ? columnSet.topLeftLocation().y() : columnSet.topLeftLocation().x();
if (pointOffset < regionOffset + columnSet.logicalHeight())
break;
}
// Once we have a good guess as to which region we hit tested through (and yes, this was just a heuristic, but it's
// the best we could do), then we can map from the region into the flow thread.
LayoutSize translationOffset = physicalTranslationFromRegionToFlow(candidateColumnSet, candidatePoint) + candidateContainerOffset;
bool preserve3D = mode & UseTransforms && (parent()->style().preserves3D() || style().preserves3D());
if (mode & UseTransforms && shouldUseTransformFromContainer(parent())) {
TransformationMatrix t;
getTransformFromContainer(parent(), translationOffset, t);
transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
} else
transformState.move(translationOffset.width(), translationOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
}
开发者ID:dreamsxin,项目名称:WebCore,代码行数:35,代码来源:RenderMultiColumnFlowThread.cpp
示例9: adjustClipRectsForChildren
void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
{
bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObject.document().settings()->rootLayerScrolls();
if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) {
// The root layer's clip rect is always infinite.
clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
return;
}
bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
// For transformed layers, the root layer was shifted to be us, so there is no need to
// examine the parent. We want to cache clip rects with us as the root.
PaintLayer* parentLayer = !isClippingRoot ? m_layoutObject.layer()->parent() : 0;
// Ensure that our parent's clip has been calculated so that we can examine the values.
if (parentLayer) {
// FIXME: Why don't we just call getClipRects here?
if (context.usesCache() && parentLayer->clipper().cachedClipRects(context)) {
clipRects = *parentLayer->clipper().cachedClipRects(context);
} else {
parentLayer->clipper().calculateClipRects(context, clipRects);
}
} else {
clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
}
adjustClipRectsForChildren(m_layoutObject, clipRects);
if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) {
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the PaintLayerCompositor overlapMap, where
// clipRects are needed in view space.
applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObject.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipRects);
}
}
开发者ID:azureplus,项目名称:chromium,代码行数:35,代码来源:PaintLayerClipper.cpp
示例10: roundedLayoutPoint
bool LayoutSVGContainer::nodeAtFloatPoint(HitTestResult& result,
const FloatPoint& pointInParent,
HitTestAction hitTestAction) {
// Give LayoutSVGViewportContainer a chance to apply its viewport clip
if (!pointIsInsideViewportClip(pointInParent))
return false;
FloatPoint localPoint;
if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(
*this, localToSVGParentTransform(), pointInParent, localPoint))
return false;
for (LayoutObject* child = lastChild(); child;
child = child->previousSibling()) {
if (child->nodeAtFloatPoint(result, localPoint, hitTestAction)) {
const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint);
updateHitTestResult(result, localLayoutPoint);
if (result.addNodeToListBasedTestResult(
child->node(), localLayoutPoint) == StopHitTesting)
return true;
}
}
// pointer-events: bounding-box makes it possible for containers to be direct
// targets.
if (style()->pointerEvents() == PE_BOUNDINGBOX) {
// Check for a valid bounding box because it will be invalid for empty
// containers.
if (isObjectBoundingBoxValid() &&
objectBoundingBox().contains(localPoint)) {
const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint);
updateHitTestResult(result, localLayoutPoint);
if (result.addNodeToListBasedTestResult(element(), localLayoutPoint) ==
StopHitTesting)
return true;
}
}
// 16.4: "If there are no graphics elements whose relevant graphics content is
// under the pointer (i.e., there is no target element), the event is not
// dispatched."
return false;
}
开发者ID:mirror,项目名称:chromium,代码行数:42,代码来源:LayoutSVGContainer.cpp
示例11: hostInput
void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point)
{
HTMLInputElement* input = hostInput();
if (!input->renderer() || !renderer())
return;
LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true));
bool isVertical = hasVerticalAppearance(input);
LayoutUnit trackSize;
LayoutUnit position;
LayoutUnit currentPosition;
// We need to calculate currentPosition from absolute points becaue the
// renderer for this node is usually on a layer and renderBox()->x() and
// y() are unusable.
// FIXME: This should probably respect transforms.
LayoutPoint absoluteThumbOrigin = renderBox()->absoluteBoundingBoxRectIgnoringTransforms().location();
LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->renderer()->localToAbsolute());
if (isVertical) {
trackSize = input->renderBox()->contentHeight() - renderBox()->height();
position = offset.y() - renderBox()->height() / 2;
currentPosition = absoluteThumbOrigin.y() - absoluteSliderContentOrigin.y();
} else {
trackSize = input->renderBox()->contentWidth() - renderBox()->width();
position = offset.x() - renderBox()->width() / 2;
currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x();
}
position = max<LayoutUnit>(0, min(position, trackSize));
if (position == currentPosition)
return;
StepRange range(input);
double fraction = static_cast<double>(position) / trackSize;
if (isVertical || !renderBox()->style()->isLeftToRightDirection())
fraction = 1 - fraction;
double value = range.clampValue(range.valueFromProportion(fraction));
// FIXME: This is no longer being set from renderer. Consider updating the method name.
input->setValueFromRenderer(serializeForNumberType(value));
renderer()->setNeedsLayout(true);
input->dispatchFormControlChangeEvent();
}
开发者ID:Moondee,项目名称:Artemis,代码行数:42,代码来源:SliderThumbElement.cpp
示例12: roundedLayoutPoint
void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
{
if (!m_renderer.layer()->parent()) {
// The root layer's clip rect is always infinite.
clipRects.reset(PaintInfo::infiniteRect());
return;
}
bool isClippingRoot = m_renderer.layer() == context.rootLayer;
// For transformed layers, the root layer was shifted to be us, so there is no need to
// examine the parent. We want to cache clip rects with us as the root.
RenderLayer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() : 0;
// Ensure that our parent's clip has been calculated so that we can examine the values.
if (parentLayer) {
// FIXME: Why don't we just call getClipRects here?
if (context.usesCache() && parentLayer->clipper().cachedClipRects(context)) {
clipRects = *parentLayer->clipper().cachedClipRects(context);
} else {
parentLayer->clipper().calculateClipRects(context, clipRects);
}
} else {
clipRects.reset(PaintInfo::infiniteRect());
}
if (m_renderer.style()->position() == AbsolutePosition) {
clipRects.setOverflowClipRect(clipRects.posClipRect());
}
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
// clipRects are needed in view space.
LayoutPoint offset = roundedLayoutPoint(m_renderer.localToContainerPoint(FloatPoint(), context.rootLayer->renderer()));
if (m_renderer.hasOverflowClip()) {
ClipRect newOverflowClip = m_renderer.overflowClipRect(offset);
newOverflowClip.setHasRadius(m_renderer.style()->hasBorderRadius());
clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
if (m_renderer.isPositioned())
clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
}
if (m_renderer.hasClip()) {
LayoutRect newClip = m_renderer.clipRect(offset);
clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()));
clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowClipRect()));
}
}
开发者ID:Rajesh-Veeranki,项目名称:engine,代码行数:48,代码来源:RenderLayerClipper.cpp
示例13: target
void MouseRelatedEvent::computeRelativePosition()
{
Node* targetNode = target() ? target()->toNode() : nullptr;
if (!targetNode)
return;
// Compute coordinates that are based on the target.
m_layerLocation = m_pageLocation;
m_offsetLocation = m_pageLocation;
// Must have an updated layout tree for this math to work correctly.
targetNode->document().updateLayoutIgnorePendingStylesheets();
// Adjust offsetLocation to be relative to the target's padding box.
if (LayoutObject* r = targetNode->layoutObject()) {
FloatPoint localPos = r->absoluteToLocal(FloatPoint(absoluteLocation()), UseTransforms);
// Adding this here to address crbug.com/570666. Basically we'd like to
// find the local coordinates relative to the padding box not the border box.
if (r->isBoxModelObject()) {
LayoutBoxModelObject* layoutBox = toLayoutBoxModelObject(r);
localPos.move(-layoutBox->borderLeft(), -layoutBox->borderTop());
}
m_offsetLocation = roundedLayoutPoint(localPos);
float scaleFactor = 1 / pageZoomFactor(this);
if (scaleFactor != 1.0f)
m_offsetLocation.scale(scaleFactor, scaleFactor);
}
// Adjust layerLocation to be relative to the layer.
// FIXME: event.layerX and event.layerY are poorly defined,
// and probably don't always correspond to PaintLayer offsets.
// https://bugs.webkit.org/show_bug.cgi?id=21868
Node* n = targetNode;
while (n && !n->layoutObject())
n = n->parentNode();
if (n) {
// FIXME: This logic is a wrong implementation of convertToLayerCoords.
for (PaintLayer* layer = n->layoutObject()->enclosingLayer(); layer; layer = layer->parent())
m_layerLocation -= toLayoutSize(layer->location());
}
m_hasCachedRelativePosition = true;
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:46,代码来源:MouseRelatedEvent.cpp
示例14: target
void MouseRelatedEvent::computeRelativePosition()
{
Node* targetNode = target() ? target()->toNode() : 0;
if (!targetNode)
return;
// Compute coordinates that are based on the target.
m_layerLocation = m_pageLocation;
m_offsetLocation = m_pageLocation;
// Must have an updated render tree for this math to work correctly.
targetNode->document()->updateStyleIfNeeded();
// Adjust offsetLocation to be relative to the target's position.
if (!isSimulated()) {
if (RenderObject* r = targetNode->renderer()) {
FloatPoint localPos = r->absoluteToLocal(absoluteLocation(), false, true);
m_offsetLocation = roundedLayoutPoint(localPos);
float scaleFactor = 1 / pageZoomFactor(this);
if (scaleFactor != 1.0f)
m_offsetLocation.scale(scaleFactor, scaleFactor);
}
}
// Adjust layerLocation to be relative to the layer.
// FIXME: We're pretty sure this is the wrong definition of "layer."
// Our RenderLayer is a more modern concept, and layerX/Y is some
// other notion about groups of elements (left over from the Netscape 4 days?);
// we should test and fix this.
Node* n = targetNode;
while (n && !n->renderer())
n = n->parentNode();
RenderLayer* layer;
if (n && (layer = n->renderer()->enclosingLayer())) {
layer->updateLayerPosition();
for (; layer; layer = layer->parent()) {
m_layerLocation -= toSize(layer->location());
}
}
m_hasCachedRelativePosition = true;
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:43,代码来源:MouseRelatedEvent.cpp
示例15: m_target
Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, int screenX, int screenY, int pageX, int pageY, int radiusX, int radiusY, float rotationAngle, float force)
: m_target(target)
, m_identifier(identifier)
, m_clientX(pageX - contentsX(frame))
, m_clientY(pageY - contentsY(frame))
, m_screenX(screenX)
, m_screenY(screenY)
, m_pageX(pageX)
, m_pageY(pageY)
, m_radiusX(radiusX)
, m_radiusY(radiusY)
, m_rotationAngle(rotationAngle)
, m_force(force)
{
float scaleFactor = frame->pageZoomFactor() * frame->frameScaleFactor();
float x = pageX * scaleFactor;
float y = pageY * scaleFactor;
m_absoluteLocation = roundedLayoutPoint(FloatPoint(x, y));
}
开发者ID:CannedFish,项目名称:webkit,代码行数:19,代码来源:Touch.cpp
示例16: VisiblePosition
VisiblePosition VisibleSelection::visiblePositionRespectingEditingBoundary(const LayoutPoint& localPoint, Node* targetNode) const
{
if (!targetNode->renderer())
return VisiblePosition();
LayoutPoint selectionEndPoint = localPoint;
Element* editableElement = rootEditableElement();
if (editableElement && !editableElement->contains(targetNode)) {
if (!editableElement->renderer())
return VisiblePosition();
FloatPoint absolutePoint = targetNode->renderer()->localToAbsolute(FloatPoint(selectionEndPoint));
selectionEndPoint = roundedLayoutPoint(editableElement->renderer()->absoluteToLocal(absolutePoint));
targetNode = editableElement;
}
return VisiblePosition(targetNode->renderer()->positionForPoint(selectionEndPoint));
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:19,代码来源:VisibleSelection.cpp
示例17: hitRules
bool LayoutSVGShape::nodeAtFloatPoint(HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
// We only draw in the foreground phase, so we only hit-test then.
if (hitTestAction != HitTestForeground)
return false;
FloatPoint localPoint;
if (!SVGLayoutSupport::transformToUserSpaceAndCheckClipping(this, localToParentTransform(), pointInParent, localPoint))
return false;
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, result.hitTestRequest(), style()->pointerEvents());
if (nodeAtFloatPointInternal(result.hitTestRequest(), localPoint, hitRules)) {
const LayoutPoint& localLayoutPoint = roundedLayoutPoint(localPoint);
updateHitTestResult(result, localLayoutPoint);
if (!result.addNodeToListBasedTestResult(element(), localLayoutPoint))
return true;
}
return false;
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:20,代码来源:LayoutSVGShape.cpp
示例18: adjustClipRectsForChildren
void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context,
ClipRects& clipRects) const {
const LayoutBoxModelObject& layoutObject = *m_layer.layoutObject();
if (!m_layer.parent() &&
!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
// The root layer's clip rect is always infinite.
clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
return;
}
bool isClippingRoot = &m_layer == context.rootLayer;
// For transformed layers, the root layer was shifted to be us, so there is no
// need to examine the parent. We want to cache clip rects with us as the
// root.
PaintLayer* parentLayer = !isClippingRoot ? m_layer.parent() : nullptr;
// Ensure that our parent's clip has been calculated so that we can examine
// the values.
if (parentLayer) {
parentLayer->clipper().getOrCalculateClipRects(context, clipRects);
} else {
clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
}
adjustClipRectsForChildren(layoutObject, clipRects);
if (shouldClipOverflow(context) || layoutObject.hasClip() ||
(layoutObject.isSVGRoot() &&
toLayoutSVGRoot(&layoutObject)->shouldApplyViewportClip())) {
// This offset cannot use convertToLayerCoords, because sometimes our
// rootLayer may be across some transformed layer boundary, for example, in
// the PaintLayerCompositor overlapMap, where clipRects are needed in view
// space.
applyClipRects(context, layoutObject,
roundedLayoutPoint(layoutObject.localToAncestorPoint(
FloatPoint(), context.rootLayer->layoutObject())),
clipRects);
}
}
开发者ID:mirror,项目名称:chromium,代码行数:39,代码来源:PaintLayerClipper.cpp
示例19: roundedLayoutPoint
bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());
// Hit test the markup box.
if (InlineBox* markupBox = this->markupBox()) {
const RenderStyle& lineStyle = this->lineStyle();
LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent());
if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
blockFlow().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
return true;
}
}
LayoutRect boundsRect(adjustedLocation, LayoutSize(m_logicalWidth, m_height));
if (visibleToHitTesting() && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
blockFlow().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
if (!result.addNodeToRectBasedTestResult(blockFlow().element(), request, locationInContainer, boundsRect))
return true;
}
return false;
}
开发者ID:kodybrown,项目名称:webkit,代码行数:24,代码来源:EllipsisBox.cpp
示例20: adjustClipRectsForChildren
void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
{
if (!m_renderer.layer()->parent()) {
// The root layer's clip rect is always infinite.
clipRects.reset(PaintInfo::infiniteRect());
return;
}
bool isClippingRoot = m_renderer.layer() == context.rootLayer;
// For transformed layers, the root layer was shifted to be us, so there is no need to
// examine the parent. We want to cache clip rects with us as the root.
RenderLayer* parentLayer = !isClippingRoot ? m_renderer.layer()->parent() : 0;
// Ensure that our parent's clip has been calculated so that we can examine the values.
if (parentLayer) {
// FIXME: Why don't we just call getClipRects here?
if (context.usesCache() && parentLayer->clipper().cachedClipRects(context)) {
clipRects = *parentLayer->clipper().cachedClipRects(context);
} else {
parentLayer->clipper().calculateClipRects(context, clipRects);
}
} else {
clipRects.reset(PaintInfo::infiniteRect());
}
adjustClipRectsForChildren(m_renderer, clipRects);
// FIXME: This logic looks wrong. We'll apply overflow clip rects even if we were told to IgnoreOverflowClip if m_renderer.hasClip().
if ((m_renderer.hasOverflowClip() && (context.respectOverflowClip == RespectOverflowClip || !isClippingRoot)) || m_renderer.hasClip()) {
// This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
// some transformed layer boundary, for example, in the RenderLayerCompositor overlapMap, where
// clipRects are needed in view space.
applyClipRects(context, m_renderer, roundedLayoutPoint(m_renderer.localToContainerPoint(FloatPoint(), context.rootLayer->renderer())), clipRects);
}
}
开发者ID:domenic,项目名称:mojo,代码行数:36,代码来源:RenderLayerClipper.cpp
注:本文中的roundedLayoutPoint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论