本文整理汇总了C++中paddingTop函数的典型用法代码示例。如果您正苦于以下问题:C++ paddingTop函数的具体用法?C++ paddingTop怎么用?C++ paddingTop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paddingTop函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: localToAbsolute
void RenderWidget::updateWidgetPosition()
{
if (!m_widget)
return;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = localToAbsolute();
absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom();
IntRect newBounds(absPos.x(), absPos.y(), w, h);
IntRect oldBounds(m_widget->frameRect());
if (newBounds != oldBounds) {
// The widget changed positions. Update the frame geometry.
if (checkForRepaintDuringLayout()) {
RenderView* v = view();
if (!v->printing()) {
// FIXME: do container-relative repaint
v->repaintRectangleInViewAndCompositedLayers(oldBounds);
v->repaintRectangleInViewAndCompositedLayers(newBounds);
}
}
RenderArena* arena = ref();
element()->ref();
m_widget->setFrameRect(newBounds);
element()->deref();
deref(arena);
}
}
示例2: localToAbsolute
void RenderWidget::updateWidgetPosition()
{
if (!m_widget)
return;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = localToAbsolute();
absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom();
IntRect newBounds(absPos.x(), absPos.y(), w, h);
IntRect oldBounds(m_widget->frameRect());
bool boundsChanged = newBounds != oldBounds;
if (boundsChanged) {
RenderArena* arena = ref();
node()->ref();
m_widget->setFrameRect(newBounds);
node()->deref();
deref(arena);
}
// if the frame bounds got changed, or if view needs layout (possibly indicating
// content size is wrong) we have to do a layout to set the right widget size
if (m_widget->isFrameView()) {
FrameView* frameView = static_cast<FrameView*>(m_widget.get());
if (boundsChanged || frameView->needsLayout())
frameView->layout();
}
}
示例3: absolutePosition
void RenderWidget::updateWidgetPosition()
{
if (!m_widget)
return;
int x;
int y;
absolutePosition(x, y);
x += borderLeft() + paddingLeft();
y += borderTop() + paddingTop();
int width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
IntRect newBounds(x, y, width, height);
IntRect oldBounds(m_widget->frameGeometry());
if (newBounds != oldBounds) {
// The widget changed positions. Update the frame geometry.
if (checkForRepaintDuringLayout()) {
RenderView* v = view();
if (!v->printing()) {
v->repaintViewRectangle(oldBounds);
v->repaintViewRectangle(newBounds);
}
}
RenderArena* arena = ref();
element()->ref();
m_widget->setFrameGeometry(newBounds);
element()->deref();
deref(arena);
}
}
示例4: x
void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
{
if (!shouldPaint(paintInfo, tx, ty))
return;
tx += x();
ty += y();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, tx, ty);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, tx, ty);
return;
}
if (!m_frameView || paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
return;
#if PLATFORM(MAC)
if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
#endif
if (style()->hasBorderRadius()) {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
IntSize topLeft, topRight, bottomLeft, bottomRight;
IntRect borderRect = IntRect(tx, ty, width(), height());
style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
if (m_widget) {
// Move the widget if necessary. We normally move and resize widgets during layout, but sometimes
// widgets can move without layout occurring (most notably when you scroll a document that
// contains fixed positioned elements).
m_widget->move(tx + borderLeft() + paddingLeft(), ty + borderTop() + paddingTop());
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
m_widget->paint(paintInfo.context, paintInfo.rect);
if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast<FrameView*>(m_widget.get())->useSlowRepaints()) {
ASSERT(!paintInfo.overlapTestRequests->contains(this));
paintInfo.overlapTestRequests->set(this, m_widget->frameRect());
}
}
if (style()->hasBorderRadius())
paintInfo.context->restore();
// Paint a partially transparent wash over selected widgets.
if (isSelected() && !document()->printing()) {
// FIXME: selectionRect() is in absolute, not painting coordinates.
paintInfo.context->fillRect(selectionRect(), selectionBackgroundColor());
}
}
示例5: contentBoxRect
void RenderMedia::layout()
{
IntSize oldSize = contentBoxRect().size();
RenderImage::layout();
RenderBox* controlsRenderer = m_controls->renderBox();
if (!controlsRenderer)
return;
IntSize newSize = contentBoxRect().size();
if (newSize == oldSize && !controlsRenderer->needsLayout())
return;
// When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or
// call view()->disableLayoutState(). Since using a LayoutStateMaintainer is slightly more efficient,
// and this method will be called many times per second during playback, use a LayoutStateMaintainer:
LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
controlsRenderer->setLocation(borderLeft() + paddingLeft(), borderTop() + paddingTop());
controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
controlsRenderer->setNeedsLayout(true, false);
controlsRenderer->layout();
setChildNeedsLayout(false);
statePusher.pop();
}
示例6: contentWidth
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Image* image = m_snapshotResource->image().get();
if (!image || image->isNull())
return;
LayoutUnit cWidth = contentWidth();
LayoutUnit cHeight = contentHeight();
if (!cWidth || !cHeight)
return;
GraphicsContext& context = paintInfo.context();
LayoutSize contentSize(cWidth, cHeight);
LayoutPoint contentLocation = location() + paintOffset;
contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
LayoutRect rect(contentLocation, contentSize);
IntRect alignedRect = snappedIntRect(rect);
if (alignedRect.width() <= 0 || alignedRect.height() <= 0)
return;
InterpolationQuality interpolation = chooseInterpolationQuality(context, *image, image, alignedRect.size());
ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation());
context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, interpolation));
}
示例7: widgetRendererMap
void RenderWidget::setWidget(Widget* widget)
{
if (widget != m_widget) {
if (m_widget) {
// removeFromParent is a no-op on Mac.
m_widget->removeFromParent();
widgetRendererMap().remove(m_widget);
deleteWidget();
}
m_widget = widget;
if (m_widget) {
widgetRendererMap().add(m_widget, this);
// if we've already received a layout, apply the calculated space to the
// widget immediately, but we have to have really been full constructed (with a non-null
// style pointer).
if (!needsLayout() && style())
resizeWidget(m_widget,
m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(),
m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom());
if (style()) {
if (style()->visibility() != VISIBLE)
m_widget->hide();
else
m_widget->show();
}
m_view->addChild(m_widget);
}
}
}
示例8: contentWidth
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Image* image = m_snapshotResource->image().get();
if (!image || image->isNull())
return;
LayoutUnit cWidth = contentWidth();
LayoutUnit cHeight = contentHeight();
if (!cWidth || !cHeight)
return;
GraphicsContext& context = paintInfo.context();
LayoutSize contentSize(cWidth, cHeight);
LayoutPoint contentLocation = location() + paintOffset;
contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
LayoutRect rect(contentLocation, contentSize);
IntRect alignedRect = snappedIntRect(rect);
if (alignedRect.width() <= 0 || alignedRect.height() <= 0)
return;
bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size());
ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
#if ENABLE(CSS_IMAGE_ORIENTATION)
orientationDescription.setImageOrientationEnum(style().imageOrientation());
#endif
context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling));
}
示例9: location
void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutPoint adjustedPaintOffset = paintOffset + location();
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
IntPoint widgetLocation = m_widget->frameRect().location();
IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()),
roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop()));
IntRect paintRect = paintInfo.rect;
IntSize widgetPaintOffset = paintLocation - widgetLocation;
// When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
// not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing.
if (!widgetPaintOffset.isZero()) {
paintInfo.context->translate(widgetPaintOffset);
paintRect.move(-widgetPaintOffset);
}
m_widget->paint(paintInfo.context, paintRect);
if (!widgetPaintOffset.isZero())
paintInfo.context->translate(-widgetPaintOffset);
if (m_widget->isFrameView()) {
FrameView* frameView = toFrameView(m_widget.get());
bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || frameView->hasCompositedContentIncludingDescendants();
if (paintInfo.overlapTestRequests && runOverlapTests) {
ASSERT(!paintInfo.overlapTestRequests->contains(this));
paintInfo.overlapTestRequests->set(this, m_widget->frameRect());
}
}
}
示例10: location
void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutPoint adjustedPaintOffset = paintOffset + location();
Widget* widget = this->widget();
RELEASE_ASSERT(widget);
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
IntPoint widgetLocation = widget->frameRect().location();
IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()),
roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop()));
IntRect paintRect = paintInfo.rect;
IntSize widgetPaintOffset = paintLocation - widgetLocation;
// When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
// not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing.
if (!widgetPaintOffset.isZero()) {
paintInfo.context->translate(widgetPaintOffset.width(), widgetPaintOffset.height());
paintRect.move(-widgetPaintOffset);
}
widget->paint(paintInfo.context, paintRect);
if (!widgetPaintOffset.isZero())
paintInfo.context->translate(-widgetPaintOffset.width(), -widgetPaintOffset.height());
}
示例11: borderTop
int RenderTextControlMultiLine::textBlockInsetTop() const
{
int inset = borderTop() + paddingTop();
if (HTMLElement* innerText = innerTextElement()) {
if (RenderBox* innerTextRenderer = innerText->renderBox())
inset += innerTextRenderer->paddingTop();
}
return inset;
}
示例12: toSVGSVGElement
// LayoutBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void LayoutSVGRoot::buildLocalToBorderBoxTransform()
{
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
float scale = style()->effectiveZoom();
FloatPoint translate = svg->currentTranslate();
LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y());
m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
}
示例13: ANNOTATE_GRAPHICS_CONTEXT
void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorationBackground() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->hasOutline())
paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size()));
if (paintInfo.phase != PaintPhaseForeground)
return;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
return;
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(borderRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
BoxPainter::clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect);
}
Widget* widget = this->widget();
if (widget)
paintContents(paintInfo, paintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
// Paint a partially transparent wash over selected widgets.
if (isSelected() && !document().printing()) {
LayoutRect rect = localSelectionRect();
rect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(rect), selectionBackgroundColor());
}
if (canResize())
layer()->scrollableArea()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect);
}
示例14: paddingLeft
RenderObject* RenderTextControlMultiLine::layoutSpecialExcludedChild(bool relayoutChildren)
{
RenderObject* placeholderRenderer = RenderTextControl::layoutSpecialExcludedChild(relayoutChildren);
if (is<RenderBox>(placeholderRenderer)) {
auto& placeholderBox = downcast<RenderBox>(*placeholderRenderer);
placeholderBox.style().setLogicalWidth(Length(contentLogicalWidth() - placeholderBox.borderAndPaddingLogicalWidth(), Fixed));
placeholderBox.layoutIfNeeded();
placeholderBox.setX(borderLeft() + paddingLeft());
placeholderBox.setY(borderTop() + paddingTop());
}
return placeholderRenderer;
}
示例15: toLayoutBox
LayoutObject* LayoutTextControlMultiLine::layoutSpecialExcludedChild(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
{
LayoutObject* placeholderLayoutObject = LayoutTextControl::layoutSpecialExcludedChild(relayoutChildren, layoutScope);
if (!placeholderLayoutObject)
return nullptr;
if (!placeholderLayoutObject->isBox())
return placeholderLayoutObject;
LayoutBox* placeholderBox = toLayoutBox(placeholderLayoutObject);
placeholderBox->mutableStyleRef().setLogicalWidth(Length(contentLogicalWidth() - placeholderBox->borderAndPaddingLogicalWidth(), Fixed));
placeholderBox->layoutIfNeeded();
placeholderBox->setX(borderLeft() + paddingLeft());
placeholderBox->setY(borderTop() + paddingTop());
return placeholderLayoutObject;
}