本文整理汇总了C++中LayoutPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ LayoutPoint函数的具体用法?C++ LayoutPoint怎么用?C++ LayoutPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LayoutPoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: localTransform
bool RenderSVGForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent);
// Early exit if local point is not contained in clipped viewport area
if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint))
return false;
return RenderBlock::nodeAtPoint(request, result, roundedLayoutPoint(localPoint), LayoutPoint(), hitTestAction);
}
示例2: hitRules
bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, request, style()->pointerEvents());
bool isVisible = (style()->visibility() == VISIBLE);
if (isVisible || !hitRules.requireVisible) {
if ((hitRules.canHitStroke && (style()->svgStyle()->hasStroke() || !hitRules.requireStroke))
|| (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill))) {
FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
return false;
HitTestLocation hitTestLocation(LayoutPoint(flooredIntPoint(localPoint)));
return RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), hitTestAction);
}
}
return false;
}
示例3: setRegionBoxesRegionStyle
void RenderRegion::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// Delegate painting of content in region to RenderFlowThread.
if (!m_flowThread || !isValid())
return;
setRegionBoxesRegionStyle();
m_flowThread->paintIntoRegion(paintInfo, this, LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop()));
restoreRegionBoxesOriginalStyle();
}
示例4: localContext
void PaintPropertyTreeBuilder::walk(FrameView& frameView, const PaintPropertyTreeBuilderContext& context)
{
PaintPropertyTreeBuilderContext localContext(context);
// TODO(pdr): Creating paint properties for FrameView here will not be
// needed once settings()->rootLayerScrolls() is enabled.
// TODO(pdr): Make this conditional on the rootLayerScrolls setting.
TransformationMatrix frameTranslate;
frameTranslate.translate(frameView.x(), frameView.y());
// The frame owner applies paint offset already.
// This assumption may change in the future.
ASSERT(context.paintOffset == LayoutPoint());
RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = TransformPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.currentTransform);
localContext.transformForFixedPositioned = newTransformNodeForPreTranslation.get();
localContext.paintOffsetForFixedPositioned = LayoutPoint();
FloatRoundedRect contentClip(IntRect(IntPoint(), frameView.visibleContentSize()));
RefPtr<ClipPaintPropertyNode> newClipNodeForContentClip = ClipPaintPropertyNode::create(newTransformNodeForPreTranslation.get(), contentClip, localContext.currentClip);
localContext.currentClip = localContext.clipForOutOfFlowPositioned = localContext.clipForFixedPositioned = newClipNodeForContentClip.get();
DoubleSize scrollOffset = frameView.scrollOffsetDouble();
TransformationMatrix frameScroll;
frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = TransformPaintPropertyNode::create(frameScroll, FloatPoint3D(), newTransformNodeForPreTranslation);
localContext.currentTransform = localContext.transformForOutOfFlowPositioned = newTransformNodeForScrollTranslation.get();
localContext.paintOffset = localContext.paintOffsetForOutOfFlowPositioned = LayoutPoint();
frameView.setPreTranslation(newTransformNodeForPreTranslation.release());
frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release());
frameView.setContentClip(newClipNodeForContentClip.release());
if (LayoutView* layoutView = frameView.layoutView())
walk(*layoutView, localContext);
for (Frame* child = frameView.frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
if (!child->isLocalFrame())
continue;
if (FrameView* childView = toLocalFrame(child)->view())
walk(*childView, localContext);
}
}
示例5: getShapeImageReplacedRect
static LayoutRect getShapeImageReplacedRect(const RenderBox& renderBox, const StyleImage& styleImage)
{
if (renderBox.isRenderImage()) {
const RenderImage& renderImage = *toRenderImage(&renderBox);
return renderImage.replacedContentRect(renderBox.intrinsicSize());
}
ASSERT(styleImage.cachedImage());
ASSERT(styleImage.cachedImage()->hasImage());
return LayoutRect(LayoutPoint(), styleImage.cachedImage()->image()->size());
}
示例6: blockInfo
void SVGTextPainter::paint(const PaintInfo& paintInfo)
{
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
PaintInfo blockInfo(paintInfo);
TransformRecorder transformRecorder(*blockInfo.context, m_renderSVGText.displayItemClient(), m_renderSVGText.localToParentTransform());
// When transitioning from SVG to block painters we need to keep the PaintInfo rect up-to-date
// because it can be used for clipping.
m_renderSVGText.updatePaintInfoRect(blockInfo.rect);
BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint());
// Paint the outlines, if any
if (paintInfo.phase == PaintPhaseForeground) {
blockInfo.phase = PaintPhaseSelfOutline;
BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint());
}
}
示例7: blockInfo
void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&)
{
if (paintInfo.context->paintingDisabled())
return;
if (paintInfo.phase != PaintPhaseForeground
&& paintInfo.phase != PaintPhaseSelection)
return;
PaintInfo blockInfo(paintInfo);
GraphicsContextStateSaver stateSaver(*blockInfo.context);
blockInfo.applyTransform(localToParentTransform());
RenderBlock::paint(blockInfo, LayoutPoint());
// Paint the outlines, if any
if (paintInfo.phase == PaintPhaseForeground) {
blockInfo.phase = PaintPhaseSelfOutline;
RenderBlock::paint(blockInfo, LayoutPoint());
}
}
示例8: LayoutPoint
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (object.isBoxModelObject() &&
context.current.paintOffset != LayoutPoint()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) {
// We should use the same subpixel paint offset values for snapping
// regardless of whether a transform is present. If there is a transform
// we round the paint offset but keep around the residual fractional
// component for the transformed content to paint with. In spv1 this was
// called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and
// PaintLayerPainter::paintFragmentByApplyingTransform.
IntPoint roundedPaintOffset =
roundedIntPoint(context.current.paintOffset);
LayoutPoint fractionalPaintOffset =
LayoutPoint(context.current.paintOffset - roundedPaintOffset);
context.current.transform =
object.getMutableForPainting()
.ensurePaintProperties()
.updatePaintOffsetTranslation(
context.current.transform,
TransformationMatrix().translate(roundedPaintOffset.x(),
roundedPaintOffset.y()),
FloatPoint3D(),
context.current.shouldFlattenInheritedTransform,
context.current.renderingContextID);
context.current.paintOffset = fractionalPaintOffset;
return;
}
}
if (object.isLayoutView())
return;
if (auto* properties = object.getMutableForPainting().paintProperties())
properties->clearPaintOffsetTranslation();
}
示例9: toSVGSVGElement
void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// An empty viewport disables rendering.
if (pixelSnappedBorderBoxRect().isEmpty())
return;
// Don't paint, if the context explicitly disabled it.
if (paintInfo.context->paintingDisabled())
return;
// An empty viewBox also disables rendering.
// (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute)
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
if (svg->hasEmptyViewBox())
return;
// Don't paint if we don't have kids, except if we have filters we should paint those.
if (!firstChild()) {
SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
if (!resources || !resources->filter())
return;
}
// Make a copy of the PaintInfo because applyTransform will modify the damage rect.
PaintInfo childPaintInfo(paintInfo);
childPaintInfo.context->save();
// Apply initial viewport clip
if (shouldApplyViewportClip())
childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset)));
// Convert from container offsets (html renderers) to a relative transform (svg renderers).
// Transform from our paint container's coordinate system to our local coords.
IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform());
// SVGRenderingContext must be destroyed before we restore the childPaintInfo.context, because a filter may have
// changed the context and it is only reverted when the SVGRenderingContext destructor finishes applying the filter.
{
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground) {
renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
if (continueRendering)
RenderBox::paint(childPaintInfo, LayoutPoint());
}
childPaintInfo.context->restore();
}
示例10: regionRect
void RenderFlowThread::paintIntoRegion(PaintInfo& paintInfo, RenderRegion* region, const LayoutPoint& paintOffset)
{
GraphicsContext* context = paintInfo.context;
if (!context)
return;
// Adjust the clipping rect for the region.
// paintOffset contains the offset where the painting should occur
// adjusted with the region padding and border.
LayoutRect regionRect(region->regionRect());
LayoutRect regionOverflowRect(region->regionOverflowRect());
LayoutRect regionClippingRect(paintOffset + (regionOverflowRect.location() - regionRect.location()), regionOverflowRect.size());
PaintInfo info(paintInfo);
info.rect.intersect(pixelSnappedIntRect(regionClippingRect));
if (!info.rect.isEmpty()) {
context->save();
context->clip(regionClippingRect);
// RenderFlowThread should start painting its content in a position that is offset
// from the region rect's current position. The amount of offset is equal to the location of
// region in flow coordinates.
LayoutPoint renderFlowThreadOffset;
if (style()->isFlippedBlocksWritingMode()) {
LayoutRect flippedRegionRect(regionRect);
flipForWritingMode(flippedRegionRect);
renderFlowThreadOffset = LayoutPoint(paintOffset - flippedRegionRect.location());
} else
renderFlowThreadOffset = LayoutPoint(paintOffset - regionRect.location());
context->translate(renderFlowThreadOffset.x(), renderFlowThreadOffset.y());
info.rect.moveBy(-roundedIntPoint(renderFlowThreadOffset));
layer()->paint(context, info.rect, 0, 0, region, RenderLayer::PaintLayerTemporaryClipRects);
context->restore();
}
}
示例11: columnIndexAtVisualPoint
LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const
{
unsigned columnIndex = columnIndexAtVisualPoint(visualPoint);
LayoutRect columnRect = columnRectAt(columnIndex);
LayoutPoint localPoint(visualPoint);
localPoint.moveBy(-columnRect.location());
// Before converting to a flow thread position, if the block direction coordinate is outside the
// column, snap to the bounds of the column, and reset the inline direction coordinate to the
// start position in the column. The effect of this is that if the block position is before the
// column rectangle, we'll get to the beginning of this column, while if the block position is
// after the column rectangle, we'll get to the beginning of the next column.
if (!m_columnSet.isHorizontalWritingMode()) {
LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? LayoutUnit() : columnRect.height();
if (localPoint.x() < 0)
localPoint = LayoutPoint(LayoutUnit(), columnStart);
else if (localPoint.x() > logicalHeight())
localPoint = LayoutPoint(logicalHeight(), columnStart);
return LayoutPoint(localPoint.x() + logicalTopInFlowThreadAt(columnIndex), localPoint.y());
}
LayoutUnit columnStart = m_columnSet.style()->isLeftToRightDirection() ? LayoutUnit() : columnRect.width();
if (localPoint.y() < 0)
localPoint = LayoutPoint(columnStart, LayoutUnit());
else if (localPoint.y() > logicalHeight())
localPoint = LayoutPoint(columnStart, logicalHeight());
return LayoutPoint(localPoint.x(), localPoint.y() + logicalTopInFlowThreadAt(columnIndex));
}
示例12: toRenderBox
void Element::paint(Canvas* canvas)
{
if (!renderer() || !renderer()->isBox())
return;
RenderBox* box = toRenderBox(renderer());
GraphicsContext context(canvas->skCanvas());
// Very simplified painting to allow painting an arbitrary (layer-less) subtree.
Vector<RenderBox*> layers;
PaintInfo paintInfo(&context, box->absoluteBoundingBoxRect(), box);
box->paint(paintInfo, LayoutPoint(), layers);
// Note we're ignoring any layers encountered.
}
示例13: hitTestLocation
bool RenderSVGForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
// Embedded content is drawn in the foreground phase.
if (hitTestAction != HitTestForeground)
return false;
AffineTransform localTransform = this->localTransform();
if (!localTransform.isInvertible())
return false;
FloatPoint localPoint = localTransform.inverse().mapPoint(pointInParent);
// Early exit if local point is not contained in clipped viewport area
if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint))
return false;
// FOs establish a stacking context, so we need to hit-test all layers.
HitTestLocation hitTestLocation(roundedLayoutPoint(localPoint));
return RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestForeground)
|| RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestFloat)
|| RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestChildBlockBackgrounds);
}
示例14: createPaintOffsetTranslationIfNeeded
static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
bool shouldCreatePaintOffsetTranslationNode = false;
if (object.isSVGRoot()) {
// SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary.
shouldCreatePaintOffsetTranslationNode = true;
} else if (object.isBoxModelObject()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
shouldCreatePaintOffsetTranslationNode = layer && layer->paintsWithTransform(GlobalPaintNormalPhase);
}
if (context.paintOffset == LayoutPoint() || !shouldCreatePaintOffsetTranslationNode)
return nullptr;
RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(context.paintOffset.x(), context.paintOffset.y()),
FloatPoint3D(), context.currentTransform);
context.currentTransform = newTransformNodeForPaintOffsetTranslation.get();
context.paintOffset = LayoutPoint();
return newTransformNodeForPaintOffsetTranslation.release();
}
示例15: ASSERT
void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Vector<RenderBox*>& layers)
{
// If we ever require layout but receive a paint anyway, something has gone horribly wrong.
ASSERT(!needsLayout());
// RenderViews should never be called to paint with an offset not on device pixels.
ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffset);
// This avoids painting garbage between columns if there is a column gap.
if (m_frameView && style()->isOverflowPaged())
paintInfo.context->fillRect(paintInfo.rect, m_frameView->baseBackgroundColor());
paintObject(paintInfo, paintOffset, layers);
}