本文整理汇总了C++中RenderStyle::display方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::display方法的具体用法?C++ RenderStyle::display怎么用?C++ RenderStyle::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: determineChange
Change determineChange(const RenderStyle& s1, const RenderStyle& s2)
{
if (s1.display() != s2.display())
return Detach;
if (s1.hasPseudoStyle(FIRST_LETTER) != s2.hasPseudoStyle(FIRST_LETTER))
return Detach;
// We just detach if a renderer acquires or loses a column-span, since spanning elements
// typically won't contain much content.
if (s1.columnSpan() != s2.columnSpan())
return Detach;
if (!s1.contentDataEquivalent(&s2))
return Detach;
// When text-combine property has been changed, we need to prepare a separate renderer object.
// When text-combine is on, we use RenderCombineText, otherwise RenderText.
// https://bugs.webkit.org/show_bug.cgi?id=55069
if (s1.hasTextCombine() != s2.hasTextCombine())
return Detach;
// We need to reattach the node, so that it is moved to the correct RenderFlowThread.
if (s1.flowThread() != s2.flowThread())
return Detach;
// When the region thread has changed, we need to prepare a separate render region object.
if (s1.regionThread() != s2.regionThread())
return Detach;
// FIXME: Multicolumn regions not yet supported (http://dev.w3.org/csswg/css-regions/#multi-column-regions)
// When the node has region style and changed its multicol style, we have to prepare
// a separate render region object.
if (s1.hasFlowFrom() && (s1.specifiesColumns() != s2.specifiesColumns()))
return Detach;
if (s1 != s2) {
if (s1.inheritedNotEqual(&s2))
return Inherit;
return NoInherit;
}
// If the pseudoStyles have changed, we want any StyleChange that is not NoChange
// because setStyle will do the right thing with anything else.
if (s1.hasAnyPublicPseudoStyles()) {
for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < FIRST_INTERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
if (s1.hasPseudoStyle(pseudoId)) {
RenderStyle* ps2 = s2.getCachedPseudoStyle(pseudoId);
if (!ps2)
return NoInherit;
RenderStyle* ps1 = s1.getCachedPseudoStyle(pseudoId);
if (!ps1 || *ps1 != *ps2)
return NoInherit;
}
}
}
return NoChange;
}
示例2: rendererIsNeeded
bool HTMLFormElement::rendererIsNeeded(const RenderStyle& style)
{
if (!m_wasDemoted)
return HTMLElement::rendererIsNeeded(style);
auto parent = parentNode();
auto parentRenderer = parent->renderer();
if (!parentRenderer)
return false;
// FIXME: Shouldn't we also check for table caption (see |formIsTablePart| below).
bool parentIsTableElementPart = (parentRenderer->isTable() && isHTMLTableElement(parent))
|| (parentRenderer->isTableRow() && parent->hasTagName(trTag))
|| (parentRenderer->isTableSection() && parent->hasTagName(tbodyTag))
|| (parentRenderer->isRenderTableCol() && parent->hasTagName(colTag))
|| (parentRenderer->isTableCell() && parent->hasTagName(trTag));
if (!parentIsTableElementPart)
return true;
EDisplay display = style.display();
bool formIsTablePart = display == TABLE || display == INLINE_TABLE || display == TABLE_ROW_GROUP
|| display == TABLE_HEADER_GROUP || display == TABLE_FOOTER_GROUP || display == TABLE_ROW
|| display == TABLE_COLUMN_GROUP || display == TABLE_COLUMN || display == TABLE_CELL
|| display == TABLE_CAPTION;
return formIsTablePart;
}
示例3: canvasResource
SVGResource* SVGClipPathElement::canvasResource()
{
if (!m_clipper)
m_clipper = SVGResourceClipper::create();
else
m_clipper->resetClipData();
bool bbox = clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
RenderStyle* clipPathStyle = styleForRenderer(parent()->renderer()); // FIXME: Manual style resolution is a hack
for (Node* n = firstChild(); n; n = n->nextSibling()) {
if (n->isSVGElement() && static_cast<SVGElement*>(n)->isStyledTransformable()) {
SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(n);
RenderStyle* pathStyle = document()->styleSelector()->styleForElement(styled, clipPathStyle);
if (pathStyle->display() != NONE) {
Path pathData = styled->toClipPath();
// FIXME: How do we know the element has done a layout?
pathData.transform(styled->animatedLocalTransform());
if (!pathData.isEmpty())
m_clipper->addClipData(pathData, pathStyle->svgStyle()->clipRule(), bbox);
}
pathStyle->deref(document()->renderArena());
}
}
if (m_clipper->clipData().isEmpty()) {
Path pathData;
pathData.addRect(FloatRect());
m_clipper->addClipData(pathData, RULE_EVENODD, bbox);
}
clipPathStyle->deref(document()->renderArena());
return m_clipper.get();
}
示例4: resourceBoundingBox
FloatRect RenderSVGResourceClipper::resourceBoundingBox(const FloatRect& objectBoundingBox) const
{
FloatRect clipRect;
for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyledTransformable())
continue;
SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(childNode);
RenderStyle* style = styled->renderer() ? styled->renderer()->style() : 0;
if (!style || style->display() == NONE)
continue;
clipRect.unite(styled->renderer()->objectBoundingBox());
}
if (clipRect.isEmpty())
return FloatRect();
if (static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
AffineTransform obbTransform;
obbTransform.translate(objectBoundingBox.x(), objectBoundingBox.y());
obbTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
return obbTransform.mapRect(clipRect);
}
return clipRect;
}
示例5: createDisplayList
void RenderSVGResourceClipper::createDisplayList(GraphicsContext* context,
const AffineTransform& contentTransformation)
{
ASSERT(context);
ASSERT(frame());
// Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinates) to avoid the intersection
// with local clips/mask, which may yield incorrect results when mixing objectBoundingBox and
// userSpaceOnUse units (http://crbug.com/294900).
FloatRect bounds = strokeBoundingBox();
context->beginRecording(bounds);
// Switch to a paint behavior where all children of this <clipPath> will be rendered using special constraints:
// - fill-opacity/stroke-opacity/opacity set to 1
// - masker/filter not applied when rendering the children
// - fill is set to the initial fill paint server (solid, black)
// - stroke is set to the initial stroke paint server (none)
PaintBehavior oldBehavior = frame()->view()->paintBehavior();
frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMask);
for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement)) {
RenderObject* renderer = childElement->renderer();
if (!renderer)
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
WindRule newClipRule = style->svgStyle().clipRule();
bool isUseElement = isSVGUseElement(*childElement);
if (isUseElement) {
SVGUseElement& useElement = toSVGUseElement(*childElement);
renderer = useElement.rendererClipChild();
if (!renderer)
continue;
if (!useElement.hasAttribute(SVGNames::clip_ruleAttr))
newClipRule = renderer->style()->svgStyle().clipRule();
}
// Only shapes, paths and texts are allowed for clipping.
if (!renderer->isSVGShape() && !renderer->isSVGText())
continue;
context->setFillRule(newClipRule);
if (isUseElement)
renderer = childElement->renderer();
SVGRenderingContext::renderSubtree(context, renderer, contentTransformation);
}
frame()->view()->setPaintBehavior(oldBehavior);
m_clipContentDisplayList = context->endRecording();
}
示例6: isDisplayNone
bool HTMLOptionElement::isDisplayNone() const
{
ContainerNode* parent = parentNode();
// Check for parent optgroup having display NONE
if (parent && isHTMLOptGroupElement(*parent)) {
if (toHTMLOptGroupElement(*parent).isDisplayNone())
return true;
}
RenderStyle* style = nonRendererStyle();
return style && style->display() == NONE;
}
示例7: calculateMaskContentRepaintRect
void RenderSVGResourceMasker::calculateMaskContentRepaintRect()
{
for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
RenderObject* renderer = childNode->renderer();
if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyled() || !renderer)
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
m_maskBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates()));
}
}
示例8: calculateMaskContentPaintInvalidationRect
void RenderSVGResourceMasker::calculateMaskContentPaintInvalidationRect()
{
for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement)) {
RenderObject* renderer = childElement->renderer();
if (!renderer)
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
m_maskContentBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->paintInvalidationRectInLocalCoordinates()));
}
}
示例9: ASSERT
PassRefPtr<DisplayList> RenderSVGResourceClipper::asDisplayList(GraphicsContext* context,
const AffineTransform& contentTransformation)
{
ASSERT(context);
ASSERT(frame());
context->beginRecording(repaintRectInLocalCoordinates());
// Switch to a paint behavior where all children of this <clipPath> will be rendered using special constraints:
// - fill-opacity/stroke-opacity/opacity set to 1
// - masker/filter not applied when rendering the children
// - fill is set to the initial fill paint server (solid, black)
// - stroke is set to the initial stroke paint server (none)
PaintBehavior oldBehavior = frame()->view()->paintBehavior();
frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMask);
for (Node* childNode = element()->firstChild(); childNode; childNode = childNode->nextSibling()) {
RenderObject* renderer = childNode->renderer();
if (!childNode->isSVGElement() || !renderer)
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
WindRule newClipRule = style->svgStyle()->clipRule();
bool isUseElement = childNode->hasTagName(SVGNames::useTag);
if (isUseElement) {
SVGUseElement* useElement = toSVGUseElement(childNode);
renderer = useElement->rendererClipChild();
if (!renderer)
continue;
if (!useElement->hasAttribute(SVGNames::clip_ruleAttr))
newClipRule = renderer->style()->svgStyle()->clipRule();
}
// Only shapes, paths and texts are allowed for clipping.
if (!renderer->isSVGShape() && !renderer->isSVGText())
continue;
context->setFillRule(newClipRule);
if (isUseElement)
renderer = childNode->renderer();
SVGRenderingContext::renderSubtree(context, renderer, contentTransformation);
}
frame()->view()->setPaintBehavior(oldBehavior);
return context->endRecording();
}
示例10: applyResource
bool RenderSVGResourceClipper::applyResource(RenderObject* object, GraphicsContext* context)
{
ASSERT(object);
ASSERT(context);
m_clipper.add(object);
context->beginPath();
AffineTransform obbTransform;
FloatRect objectBoundingBox = object->objectBoundingBox();
bool bbox = static_cast<SVGClipPathElement*>(node())->clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
if (bbox) {
obbTransform.translate(objectBoundingBox.x(), objectBoundingBox.y());
obbTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
}
bool hasClipPath = false;
WindRule clipRule = RULE_EVENODD;
for (Node* childNode = node()->firstChild(); childNode; childNode = childNode->nextSibling()) {
if (!childNode->isSVGElement() || !static_cast<SVGElement*>(childNode)->isStyledTransformable())
continue;
SVGStyledTransformableElement* styled = static_cast<SVGStyledTransformableElement*>(childNode);
RenderStyle* style = styled->renderer() ? styled->renderer()->style() : 0;
if (!style || style->display() == NONE)
continue;
Path pathData = styled->toClipPath();
if (pathData.isEmpty())
continue;
if (bbox)
pathData.transform(obbTransform);
hasClipPath = true;
context->addPath(pathData);
clipRule = style->svgStyle()->clipRule();
}
if (!hasClipPath) {
Path clipPath;
clipPath.addRect(FloatRect());
context->addPath(clipPath);
}
// FIXME!
// We don't currently allow for heterogenous clip rules.
// we would have to detect such, draw to a mask, and then clip
// to that mask
context->clipPath(clipRule);
return true;
}
示例11: affectsRenderedSubtree
static bool affectsRenderedSubtree(Element& element, const RenderStyle& newStyle)
{
if (element.renderer())
return true;
if (newStyle.display() != NONE)
return true;
if (element.rendererIsNeeded(newStyle))
return true;
#if ENABLE(CSS_REGIONS)
if (element.shouldMoveToFlowThread(newStyle))
return true;
#endif
return false;
}
示例12: textRendererIsNeeded
bool Text::textRendererIsNeeded(const RenderStyle& style, const RenderObject& parent)
{
if (!parent.canHaveChildren())
return false;
if (isEditingText())
return true;
if (!length())
return false;
if (style.display() == NONE)
return false;
if (!containsOnlyWhitespace())
return true;
if (!canHaveWhitespaceChildren(parent))
return false;
if (style.preserveNewline()) // pre/pre-wrap/pre-line always make renderers.
return true;
const RenderObject* prev = NodeRenderingTraversal::previousSiblingRenderer(*this);
if (prev && prev->isBR()) // <span><br/> <br/></span>
return false;
if (parent.isRenderInline()) {
// <span><div/> <div/></span>
if (prev && !prev->isInline())
return false;
} else {
if (parent.isRenderBlock() && !parent.childrenInline() && (!prev || !prev->isInline()))
return false;
// Avoiding creation of a Renderer for the text node is a non-essential memory optimization.
// So to avoid blowing up on very wide DOMs, we limit the number of siblings to visit.
unsigned maxSiblingsToVisit = 50;
RenderObject* first = parent.slowFirstChild();
while (first && first->isFloatingOrOutOfFlowPositioned() && maxSiblingsToVisit--)
first = first->nextSibling();
if (!first || first == renderer() || NodeRenderingTraversal::nextSiblingRenderer(*this) == first)
// Whitespace at the start of a block just goes away. Don't even
// make a render object for this text.
return false;
}
return true;
}
示例13: calculateClipContentPaintInvalidationRect
void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect()
{
// This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element()); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement)) {
RenderObject* renderer = childElement->renderer();
if (!renderer)
continue;
if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElement(*childElement))
continue;
RenderStyle* style = renderer->style();
if (!style || style->display() == NONE || style->visibility() != VISIBLE)
continue;
m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->paintInvalidationRectInLocalCoordinates()));
}
m_clipBoundaries = toSVGClipPathElement(element())->animatedLocalTransform().mapRect(m_clipBoundaries);
}
示例14: switch
RenderObject *RenderObject::createObject(DOM::NodeImpl *node)
{
RenderStyle *style = node->style();
RenderObject *o = 0;
switch(style->display())
{
case INLINE:
case BLOCK:
o = new RenderFlow();
break;
case LIST_ITEM:
o = new RenderListItem();
break;
case RUN_IN:
case COMPACT:
case MARKER:
break;
case TABLE:
case INLINE_TABLE:
// ### set inline/block right
//kdDebug( 6040 ) << "creating RenderTable" << endl;
o = new RenderTable();
break;
case TABLE_ROW_GROUP:
case TABLE_HEADER_GROUP:
case TABLE_FOOTER_GROUP:
o = new RenderTableSection();
break;
case TABLE_ROW:
o = new RenderTableRow();
break;
case TABLE_COLUMN_GROUP:
case TABLE_COLUMN:
o = new RenderTableCol();
break;
case TABLE_CELL:
o = new RenderTableCell();
break;
case TABLE_CAPTION:
o = new RenderTableCaption();
break;
case NONE:
return 0;
}
if(o) o->setStyle(style);
return o;
}
示例15: attach
void HTMLBodyElementImpl::attach()
{
assert(!m_render);
assert(parentNode());
assert(parentNode()->renderer());
RenderStyle* style = getDocument()->styleSelector()->styleForElement(this);
style->ref();
if (style->display() != NONE) {
m_render = new RenderBody(this);
m_render->setStyle(style);
parentNode()->renderer()->addChild(m_render, nextRenderer());
}
style->deref();
NodeBaseImpl::attach();
}