本文整理汇总了C++中paddingLeft函数的典型用法代码示例。如果您正苦于以下问题:C++ paddingLeft函数的具体用法?C++ paddingLeft怎么用?C++ paddingLeft使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paddingLeft函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:coinpayee,项目名称:blink,代码行数:14,代码来源:RenderSVGRoot.cpp
示例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);
}
开发者ID:coinpayee,项目名称:blink,代码行数:52,代码来源:RenderWidget.cpp
示例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();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:13,代码来源:RenderReplaced.cpp
示例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);
}
开发者ID:jackyglony,项目名称:DuiBrowser-1,代码行数:13,代码来源:RenderReplaced.cpp
示例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;
}
开发者ID:dstockwell,项目名称:blink,代码行数:14,代码来源:LayoutTextControlMultiLine.cpp
示例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);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:18,代码来源:RenderSVGRoot.cpp
示例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());
}
}
开发者ID:ztyjr888,项目名称:mojo,代码行数:43,代码来源:RenderReplaced.cpp
示例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());
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:41,代码来源:RenderWidget.cpp
示例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);
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:37,代码来源:RenderPart.cpp
示例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;
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:22,代码来源:RenderRegion.cpp
示例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()));
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:7,代码来源:RenderRegion.cpp
示例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)
//.........这里部分代码省略.........
开发者ID:FilipBE,项目名称:qtextended,代码行数:101,代码来源:RenderSVGContainer.cpp
示例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();
}
开发者ID:fmalita,项目名称:webkit,代码行数:38,代码来源:RenderMedia.cpp
示例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;
}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:24,代码来源:RenderRegion.cpp
示例16: toRenderMultiColumnBlock
void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (paintInfo.context->paintingDisabled())
return;
RenderStyle* blockStyle = toRenderMultiColumnBlock(parent())->style();
const Color& ruleColor = blockStyle->visitedDependentColor(CSSPropertyWebkitColumnRuleColor);
bool ruleTransparent = blockStyle->columnRuleIsTransparent();
EBorderStyle ruleStyle = blockStyle->columnRuleStyle();
LayoutUnit ruleThickness = blockStyle->columnRuleWidth();
LayoutUnit colGap = columnGap();
bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent && ruleThickness <= colGap;
if (!renderRule)
return;
unsigned colCount = columnCount();
if (colCount <= 1)
return;
bool antialias = shouldAntialiasLines(paintInfo.context);
bool leftToRight = style()->isLeftToRightDirection();
LayoutUnit currLogicalLeftOffset = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth();
LayoutUnit ruleAdd = borderAndPaddingLogicalLeft();
LayoutUnit ruleLogicalLeft = leftToRight ? ZERO_LAYOUT_UNIT : contentLogicalWidth();
LayoutUnit inlineDirectionSize = computedColumnWidth();
BoxSide boxSide = isHorizontalWritingMode()
? leftToRight ? BSLeft : BSRight
: leftToRight ? BSTop : BSBottom;
for (unsigned i = 0; i < colCount; i++) {
// Move to the next position.
if (leftToRight) {
ruleLogicalLeft += inlineDirectionSize + colGap / 2;
currLogicalLeftOffset += inlineDirectionSize + colGap;
} else {
ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
currLogicalLeftOffset -= (inlineDirectionSize + colGap);
}
// Now paint the column rule.
if (i < colCount - 1) {
LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft();
LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth();
LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness;
IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom);
drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
}
ruleLogicalLeft = currLogicalLeftOffset;
}
}
开发者ID:sanyaade-webdev,项目名称:webkit,代码行数:53,代码来源:RenderMultiColumnSet.cpp
示例17: ASSERT
LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset)
{
ASSERT(!slowFirstChild());
// FIXME: This does not take into account either :first-line or :first-letter
// However, as soon as some content is entered, the line boxes will be
// constructed and this kludge is not called any more. So only the caret size
// of an empty :first-line'd block is wrong. I think we can live with that.
RenderStyle* currentStyle = firstLineStyle();
enum CaretAlignment { alignLeft, alignRight, alignCenter };
CaretAlignment alignment = alignLeft;
switch (currentStyle->textAlign()) {
case LEFT:
case WEBKIT_LEFT:
break;
case CENTER:
case WEBKIT_CENTER:
alignment = alignCenter;
break;
case RIGHT:
case WEBKIT_RIGHT:
alignment = alignRight;
break;
case JUSTIFY:
case TASTART:
if (!currentStyle->isLeftToRightDirection())
alignment = alignRight;
break;
case TAEND:
if (currentStyle->isLeftToRightDirection())
alignment = alignRight;
break;
}
LayoutUnit x = borderLeft() + paddingLeft();
LayoutUnit maxX = width - borderRight() - paddingRight();
switch (alignment) {
case alignLeft:
if (currentStyle->isLeftToRightDirection())
x += textIndentOffset;
break;
case alignCenter:
x = (x + maxX) / 2;
if (currentStyle->isLeftToRightDirection())
x += textIndentOffset / 2;
else
x -= textIndentOffset / 2;
break;
case alignRight:
x = maxX - caretWidth;
if (!currentStyle->isLeftToRightDirection())
x -= textIndentOffset;
break;
}
x = std::min(x, std::max<LayoutUnit>(maxX - caretWidth, 0));
LayoutUnit height = style()->fontMetrics().height();
LayoutUnit verticalSpace = lineHeight(true, currentStyle->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) - height;
LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2);
return currentStyle->isHorizontalWritingMode() ? LayoutRect(x, y, caretWidth, height) : LayoutRect(y, x, height, caretWidth);
}
开发者ID:335969568,项目名称:Blink-1,代码行数:65,代码来源:RenderBoxModelObject.cpp
示例18: IntSize
IntSize RenderSVGRoot::borderOriginToContentBox() const
{
return IntSize(borderLeft() + paddingLeft(), borderTop() + paddingTop());
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:4,代码来源:RenderSVGRoot.cpp
示例19: ANNOTATE_GRAPHICS_CONTEXT
void RenderReplaced::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;
}
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo, paintRect);
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && !canHaveChildren())
return;
if (!paintInfo.shouldPaintWithinRoot(this))
return;
bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing();
if (paintInfo.phase == PaintPhaseSelection) {
if (selectionState() == SelectionNone)
return;
drawSelectionTint = false;
}
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 (drawSelectionTint) {
LayoutRect selectionPaintingRect = localSelectionRect();
selectionPaintingRect.moveBy(adjustedPaintOffset);
paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect), selectionBackgroundColor());
}
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:64,代码来源:RenderReplaced.cpp
示例20: setRegionBoxesRegionStyle
void RenderRegion::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// Delegate painting of content in region to RenderFlowThread.
if (!m_flowThread || !isValid())
return;
if (Frame* frame = this->frame()) {
if (Page* page = frame->page())
page->addRelevantRepaintedObject(this, paintInfo.rect);
}
setRegionBoxesRegionStyle();
m_flowThread->paintIntoRegion(paintInfo, this, LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop()));
restoreRegionBoxesOriginalStyle();
}
开发者ID:sohocoke,项目名称:webkit,代码行数:15,代码来源:RenderRegion.cpp
注:本文中的paddingLeft函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论