本文整理汇总了C++中paddingLeft函数的典型用法代码示例。如果您正苦于以下问题:C++ paddingLeft函数的具体用法?C++ paddingLeft怎么用?C++ paddingLeft使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paddingLeft函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toSVGSVGElement
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void RenderSVGRoot::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);
if (borderAndPadding.isEmpty() && scale == 1 && translate == FloatPoint::zero())
return;
m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
}
示例2: 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 (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, adjustedPaintOffset);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && 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);
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()) {
// FIXME: selectionRect() is in absolute, not painting coordinates.
paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), selectionBackgroundColor());
}
if (canResize())
layer()->scrollableArea()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect);
}
示例3: ASSERT
void RenderReplaced::calcMinMaxWidth()
{
ASSERT(!minMaxKnown());
int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
m_minWidth = 0;
m_maxWidth = width;
} else
m_minWidth = m_maxWidth = width;
setMinMaxKnown();
}
示例4: ASSERT
void RenderReplaced::calcPrefWidths()
{
ASSERT(prefWidthsDirty());
int width = calcReplacedWidth() + paddingLeft() + paddingRight() + borderLeft() + borderRight();
if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
m_minPrefWidth = 0;
m_maxPrefWidth = width;
} else
m_minPrefWidth = m_maxPrefWidth = width;
setPrefWidthsDirty(false);
}
示例5: 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;
}
示例6: borderBoxRectInRegion
// Hit Testing
bool RenderRegion::hitTestFlowThreadContents(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
if (!isValid() || action != HitTestForeground)
return false;
LayoutRect boundsRect = borderBoxRectInRegion(locationInContainer.region());
boundsRect.moveBy(accumulatedOffset);
if (visibleToHitTesting() && locationInContainer.intersects(boundsRect)) {
if (m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result,
locationInContainer, LayoutPoint(accumulatedOffset.x() + borderLeft() + paddingLeft(), accumulatedOffset.y() + borderTop() + paddingTop())))
return true;
}
return false;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:16,代码来源:RenderRegion.cpp
示例7: ASSERT
void RenderSVGRoot::calcPrefWidths()
{
ASSERT(prefWidthsDirty());
int paddingAndBorders = paddingLeft() + paddingRight() + borderLeft() + borderRight();
int width = calcReplacedWidth(false) + paddingAndBorders;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? paddingAndBorders : 0));
if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent())) {
m_minPrefWidth = 0;
m_maxPrefWidth = width;
} else
m_minPrefWidth = m_maxPrefWidth = width;
setPrefWidthsDirty(false);
}
示例8: location
void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Vector<RenderBox*>& layers)
{
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorationBackground())
paintBoxDecorationBackground(paintInfo, adjustedPaintOffset);
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
if (style()->outlineWidth())
paintOutline(paintInfo, paintRect);
bool completelyClippedOut = false;
if (style()->hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
completelyClippedOut = true;
else {
// 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(paintRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect);
}
}
if (!completelyClippedOut) {
paintReplaced(paintInfo, adjustedPaintOffset);
if (style()->hasBorderRadius())
paintInfo.context->restore();
}
// The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of
// surrounding content.
if (selectionState() != SelectionNone) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
}
}
示例9: 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_view || 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 (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);
}
// 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());
}
}
示例10: toFrameView
bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameContent())
return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
FrameView* childFrameView = toFrameView(widget());
RenderView* childRoot = childFrameView->renderView();
if (childRoot) {
LayoutPoint adjustedLocation = accumulatedOffset + location();
LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset();
HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset);
HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest);
HitTestResult childFrameResult(newHitTestLocation);
bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult);
if (newHitTestLocation.isRectBasedTest())
result.append(childFrameResult);
else if (isInsideChildFrame)
result = childFrameResult;
if (isInsideChildFrame)
return true;
if (request.allowsFrameScrollbars()) {
// ScrollView scrollbars are not the same as RenderLayer scrollbars tested by RenderLayer::hitTestOverflowControls,
// so we need to test ScrollView scrollbars separately here.
// FIXME: Consider if this test could be done unconditionally.
Scrollbar* frameScrollbar = childFrameView->scrollbarAtPoint(newHitTestLocation.roundedPoint());
if (frameScrollbar)
result.setScrollbar(frameScrollbar);
}
}
return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action);
}
示例11: location
// Hit Testing
bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
if (!isValid())
return false;
LayoutPoint adjustedLocation = accumulatedOffset + location();
// Check our bounds next. For this purpose always assume that we can only be hit in the
// foreground phase (which is true for replaced elements like images).
LayoutRect boundsRect(adjustedLocation, size());
if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectForPoint(pointInContainer))) {
// Check the contents of the RenderFlowThread.
if (m_flowThread && m_flowThread->hitTestRegion(this, request, result, pointInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))
return true;
updateHitTestResult(result, pointInContainer - toLayoutSize(adjustedLocation));
if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect))
return true;
}
return false;
}
示例12: LayoutPoint
void RenderRegion::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// Delegate painting of content in region to RenderFlowThread.
if (!m_flowThread || !isValid())
return;
m_flowThread->paintIntoRegion(paintInfo, this, LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop()));
}
示例13: paintBoxDecorations
void RenderSVGContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
{
if (paintInfo.context->paintingDisabled())
return;
// This should only exist for <svg> renderers
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, m_x + parentX, m_y + parentY);
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE)
paintOutline(paintInfo.context, parentX, parentY, width(), height(), style());
if (paintInfo.phase != PaintPhaseForeground || !drawsContents())
return;
const SVGRenderStyle* svgStyle = style()->svgStyle();
AtomicString filterId(SVGURIReference::getTarget(svgStyle->filter()));
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
SVGResourceFilter* filter = getFilterById(document(), filterId);
#endif
if (!firstChild()
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
&& !filter
#endif
)
return; // Spec: groups w/o children still may render filter content.
paintInfo.context->save();
if (!parent()->isSVGContainer()) {
// Translate from parent offsets (html renderers) to a relative transform (svg renderers)
IntPoint origin;
origin.move(parentX, parentY);
origin.move(m_x, m_y);
origin.move(borderLeft(), borderTop());
origin.move(paddingLeft(), paddingTop());
if (origin.x() || origin.y()) {
paintInfo.context->concatCTM(AffineTransform().translate(origin.x(), origin.y()));
paintInfo.rect.move(-origin.x(), -origin.y());
}
parentX = parentY = 0;
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
paintInfo.context->concatCTM(AffineTransform().scale(svg->currentScale()));
} else {
// Only the root <svg> element should need any translations using the HTML/CSS system
// parentX, parentY are also non-zero for first-level kids of these
// CSS-transformed <svg> root-elements (due to RenderBox::paint) for any other element
// they should be 0. m_x, m_y should always be 0 for non-root svg containers
ASSERT(m_x == 0);
ASSERT(m_y == 0);
}
if (!viewport().isEmpty()) {
if (style()->overflowX() != OVISIBLE)
paintInfo.context->clip(enclosingIntRect(viewport())); // FIXME: Eventually we'll want float-precision clipping
paintInfo.context->concatCTM(AffineTransform().translate(viewport().x(), viewport().y()));
}
if (!localTransform().isIdentity())
paintInfo.context->concatCTM(localTransform());
if (!parent()->isSVGContainer()) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
paintInfo.context->concatCTM(AffineTransform().translate(svg->currentTranslate().x(), svg->currentTranslate().y()));
}
FloatRect strokeBBox = relativeBBox(true);
SVGElement* svgElement = static_cast<SVGElement*>(element());
ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
AtomicString clipperId(SVGURIReference::getTarget(svgStyle->clipPath()));
AtomicString maskerId(SVGURIReference::getTarget(svgStyle->maskElement()));
SVGResourceClipper* clipper = getClipperById(document(), clipperId);
SVGResourceMasker* masker = getMaskerById(document(), maskerId);
if (clipper) {
clipper->addClient(styledElement);
clipper->applyClip(paintInfo.context, strokeBBox);
} else if (!clipperId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(clipperId, styledElement);
if (masker) {
masker->addClient(styledElement);
masker->applyMask(paintInfo.context, strokeBBox);
} else if (!maskerId.isEmpty())
svgElement->document()->accessSVGExtensions()->addPendingResource(maskerId, styledElement);
float opacity = style()->opacity();
if (opacity < 1.0f) {
paintInfo.context->clip(enclosingIntRect(strokeBBox));
paintInfo.context->beginTransparencyLayer(opacity);
}
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
if (filter)
//.........这里部分代码省略.........
示例14: contentBoxRect
void RenderMedia::layout()
{
StackStats::LayoutCheckPoint layoutCheckPoint;
LayoutSize oldSize = contentBoxRect().size();
RenderImage::layout();
RenderBox* controlsRenderer = toRenderBox(m_children.firstChild());
if (!controlsRenderer)
return;
bool controlsNeedLayout = controlsRenderer->needsLayout();
// If the region chain has changed we also need to relayout the controls to update the region box info.
// FIXME: We can do better once we compute region box info for RenderReplaced, not only for RenderBlock.
const RenderFlowThread* flowThread = flowThreadContainingBlock();
if (flowThread && !controlsNeedLayout) {
if (flowThread->pageLogicalSizeChanged())
controlsNeedLayout = true;
}
LayoutSize newSize = contentBoxRect().size();
if (newSize == oldSize && !controlsNeedLayout)
return;
// When calling layout() on a child node, a parent must either push a LayoutStateMaintainter, or
// instantiate LayoutStateDisabler. 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, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
controlsRenderer->setNeedsLayout(true, MarkOnlyThis);
controlsRenderer->layout();
setChildNeedsLayout(false);
statePusher.pop();
}
示例15: location
// Hit Testing
bool RenderRegion::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action)
{
if (!isValid())
return false;
LayoutPoint adjustedLocation = accumulatedOffset + location();
// Check our bounds next. For this purpose always assume that we can only be hit in the
// foreground phase (which is true for replaced elements like images).
// FIXME: Once we support overflow, we need to intersect with that and not with the bounds rect.
LayoutRect boundsRect = borderBoxRectInRegion(locationInContainer.region());
boundsRect.moveBy(adjustedLocation);
if (visibleToHitTestRequest(request) && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
// Check the contents of the RenderFlowThread.
if (m_flowThread->hitTestFlowThreadPortionInRegion(this, flowThreadPortionRect(), flowThreadPortionOverflowRect(), request, result, locationInContainer, LayoutPoint(adjustedLocation.x() + borderLeft() + paddingLeft(), adjustedLocation.y() + borderTop() + paddingTop())))
return true;
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
if (!result.addNodeToRectBasedTestResult(generatingNode(), request, locationInContainer, boundsRect))
return true;
}
return false;
}