本文整理汇总了C++中RenderStyle::backgroundImage方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::backgroundImage方法的具体用法?C++ RenderStyle::backgroundImage怎么用?C++ RenderStyle::backgroundImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::backgroundImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isDeletableElement
static bool isDeletableElement(const Node* node)
{
if (!node || !node->isHTMLElement() || !node->inDocument() || !node->isContentEditable())
return false;
// In general we want to only draw the UI arround object of a certain area, but we still keep the min width/height to
// make sure we don't end up with very thin or very short elements getting the UI.
const int minimumArea = 2500;
const int minimumWidth = 48;
const int minimumHeight = 16;
const unsigned minimumVisibleBorders = 1;
RenderObject* renderer = node->renderer();
if (!renderer || !renderer->isBox())
return false;
// Disallow the body element since it isn't practical to delete, and the deletion UI would be clipped.
if (node->hasTagName(bodyTag))
return false;
// Disallow elements with any overflow clip, since the deletion UI would be clipped as well. <rdar://problem/6840161>
if (renderer->hasOverflowClip())
return false;
// Disallow Mail blockquotes since the deletion UI would get in the way of editing for these.
if (isMailBlockquote(node))
return false;
RenderBox* box = toRenderBox(renderer);
IntRect borderBoundingBox = box->borderBoundingBox();
if (borderBoundingBox.width() < minimumWidth || borderBoundingBox.height() < minimumHeight)
return false;
if ((borderBoundingBox.width() * borderBoundingBox.height()) < minimumArea)
return false;
if (renderer->isTable())
return true;
if (node->hasTagName(ulTag) || node->hasTagName(olTag) || node->hasTagName(iframeTag))
return true;
if (renderer->isPositioned())
return true;
if (renderer->isRenderBlock() && !renderer->isTableCell()) {
RenderStyle* style = renderer->style();
if (!style)
return false;
// Allow blocks that have background images
if (style->hasBackgroundImage() && style->backgroundImage()->canRender(1.0f))
return true;
// Allow blocks with a minimum number of non-transparent borders
unsigned visibleBorders = style->borderTop().isVisible() + style->borderBottom().isVisible() + style->borderLeft().isVisible() + style->borderRight().isVisible();
if (visibleBorders >= minimumVisibleBorders)
return true;
// Allow blocks that have a different background from it's parent
Node* parentNode = node->parentNode();
if (!parentNode)
return false;
RenderObject* parentRenderer = parentNode->renderer();
if (!parentRenderer)
return false;
RenderStyle* parentStyle = parentRenderer->style();
if (!parentStyle)
return false;
if (style->hasBackground() && (!parentStyle->hasBackground() || style->backgroundColor() != parentStyle->backgroundColor()))
return true;
}
return false;
}
示例2: CSSPrimitiveValueImpl
CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
{
NodeImpl *node = m_node.handle();
if (!node)
return 0;
// Make sure our layout is up to date before we allow a query on these attributes.
DocumentImpl* docimpl = node->getDocument();
if (docimpl && updateLayout)
docimpl->updateLayout();
RenderObject *renderer = node->renderer();
if (!renderer)
return 0;
RenderStyle *style = renderer->style();
if (!style)
return 0;
switch (propertyID)
{
case CSS_PROP_BACKGROUND_COLOR:
return new CSSPrimitiveValueImpl(style->backgroundColor().rgb());
case CSS_PROP_BACKGROUND_IMAGE:
if (style->backgroundImage())
return new CSSPrimitiveValueImpl(style->backgroundImage()->url(), CSSPrimitiveValue::CSS_URI);
return new CSSPrimitiveValueImpl(CSS_VAL_NONE);
case CSS_PROP_BACKGROUND_REPEAT:
switch (style->backgroundRepeat()) {
case khtml::REPEAT:
return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT);
case khtml::REPEAT_X:
return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT_X);
case khtml::REPEAT_Y:
return new CSSPrimitiveValueImpl(CSS_VAL_REPEAT_Y);
case khtml::NO_REPEAT:
return new CSSPrimitiveValueImpl(CSS_VAL_NO_REPEAT);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_BACKGROUND_ATTACHMENT:
if (style->backgroundAttachment())
return new CSSPrimitiveValueImpl(CSS_VAL_SCROLL);
else
return new CSSPrimitiveValueImpl(CSS_VAL_FIXED);
case CSS_PROP_BACKGROUND_POSITION:
{
DOMString string;
Length length(style->backgroundXPosition());
if (length.isPercent())
string = numberAsString(length.length()) + "%";
else
string = numberAsString(length.minWidth(renderer->contentWidth()));
string += " ";
length = style->backgroundYPosition();
if (length.isPercent())
string += numberAsString(length.length()) + "%";
else
string += numberAsString(length.minWidth(renderer->contentWidth()));
return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING);
}
case CSS_PROP_BACKGROUND_POSITION_X:
return valueForLength(style->backgroundXPosition());
case CSS_PROP_BACKGROUND_POSITION_Y:
return valueForLength(style->backgroundYPosition());
#ifndef KHTML_NO_XBL
case CSS_PROP__KHTML_BINDING:
// FIXME: unimplemented
break;
#endif
case CSS_PROP_BORDER_COLLAPSE:
if (style->borderCollapse())
return new CSSPrimitiveValueImpl(CSS_VAL_COLLAPSE);
else
return new CSSPrimitiveValueImpl(CSS_VAL_SEPARATE);
case CSS_PROP_BORDER_SPACING:
{
QString string(numberAsString(style->horizontalBorderSpacing()) +
"px " +
numberAsString(style->verticalBorderSpacing()) +
"px");
return new CSSPrimitiveValueImpl(string, CSSPrimitiveValue::CSS_STRING);
}
case CSS_PROP__KHTML_BORDER_HORIZONTAL_SPACING:
return new CSSPrimitiveValueImpl(style->horizontalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP__KHTML_BORDER_VERTICAL_SPACING:
return new CSSPrimitiveValueImpl(style->verticalBorderSpacing(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP_BORDER_TOP_COLOR:
return new CSSPrimitiveValueImpl(style->borderLeftColor().rgb());
case CSS_PROP_BORDER_RIGHT_COLOR:
return new CSSPrimitiveValueImpl(style->borderRightColor().rgb());
case CSS_PROP_BORDER_BOTTOM_COLOR:
return new CSSPrimitiveValueImpl(style->borderBottomColor().rgb());
case CSS_PROP_BORDER_LEFT_COLOR:
return new CSSPrimitiveValueImpl(style->borderLeftColor().rgb());
case CSS_PROP_BORDER_TOP_STYLE:
return valueForBorderStyle(style->borderTopStyle());
case CSS_PROP_BORDER_RIGHT_STYLE:
return valueForBorderStyle(style->borderRightStyle());
case CSS_PROP_BORDER_BOTTOM_STYLE:
return valueForBorderStyle(style->borderBottomStyle());
//.........这里部分代码省略.........