本文整理汇总了C++中RenderStyle::color方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::color方法的具体用法?C++ RenderStyle::color怎么用?C++ RenderStyle::color使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::color方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void EllipsisBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = m_object->style(m_firstLine);
if (style->font() != context->font())
context->setFont(style->font());
Color textColor = style->color();
if (textColor != context->fillColor())
context->setFillColor(textColor);
bool setShadow = false;
if (style->textShadow()) {
context->setShadow(IntSize(style->textShadow()->x, style->textShadow()->y),
style->textShadow()->blur, style->textShadow()->color);
setShadow = true;
}
const String& str = m_str;
TextStyle textStyle(0, 0, 0, false, style->visuallyOrdered());
context->drawText(TextRun(str.impl()), IntPoint(m_x + tx, m_y + ty + m_baseline), textStyle);
if (setShadow)
context->clearShadow();
if (m_markupBox) {
// Paint the markup box
tx += m_x + m_width - m_markupBox->xPos();
ty += m_y + m_baseline - (m_markupBox->yPos() + m_markupBox->baseline());
m_markupBox->paint(paintInfo, tx, ty);
}
}
示例2:
PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const
{
RefPtrWillBeRawPtr<SVGPaint> paint = newPaint;
if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->paintType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR)
paint->setColor(style.color());
return paint.release();
}
示例3: createDiff
TQString RenderStyle::createDiff( const RenderStyle &parent ) const
{
TQString res;
if ( color().isValid() && parent.color() != color() )
res += " [color=" + color().name() + "]";
if ( backgroundColor().isValid() && parent.backgroundColor() != backgroundColor() )
res += " [bgcolor=" + backgroundColor().name() + "]";
if ( parent.font() != font() )
res += " [font=" + describeFont( font() ) + "]";
return res;
}
示例4: create
PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::createFromColor(CSSPropertyID property, const RenderStyle& style)
{
Color color = style.colorIncludingFallback(property, false);
Color visitedLinkColor = style.colorIncludingFallback(property, true);
Color fallbackColor = style.color();
Color fallbackVisitedLinkColor = style.visitedLinkColor();
Color resolvedColor;
if (color.isValid())
resolvedColor = color;
else
resolvedColor = fallbackColor;
Color resolvedVisitedLinkColor;
if (visitedLinkColor.isValid())
resolvedVisitedLinkColor = visitedLinkColor;
else
resolvedVisitedLinkColor = fallbackVisitedLinkColor;
return AnimatableColor::create(resolvedColor, resolvedVisitedLinkColor);
}
示例5: propertiesEqual
bool CSSPropertyEquality::propertiesEqual(CSSPropertyID prop, const RenderStyle& a, const RenderStyle& b)
{
switch (prop) {
case CSSPropertyBackgroundColor:
return a.backgroundColor().resolve(a.color()) == b.backgroundColor().resolve(b.color())
&& a.visitedLinkBackgroundColor().resolve(a.color()) == b.visitedLinkBackgroundColor().resolve(b.color());
case CSSPropertyBackgroundImage:
return fillLayersEqual<CSSPropertyBackgroundImage>(a.backgroundLayers(), b.backgroundLayers());
case CSSPropertyBackgroundPositionX:
return fillLayersEqual<CSSPropertyBackgroundPositionX>(a.backgroundLayers(), b.backgroundLayers());
case CSSPropertyBackgroundPositionY:
return fillLayersEqual<CSSPropertyBackgroundPositionY>(a.backgroundLayers(), b.backgroundLayers());
case CSSPropertyBackgroundSize:
return fillLayersEqual<CSSPropertyBackgroundSize>(a.backgroundLayers(), b.backgroundLayers());
case CSSPropertyBaselineShift:
return dataEquivalent(a.baselineShiftValue(), b.baselineShiftValue());
case CSSPropertyBorderBottomColor:
return a.borderBottomColor().resolve(a.color()) == b.borderBottomColor().resolve(b.color())
&& a.visitedLinkBorderBottomColor().resolve(a.color()) == b.visitedLinkBorderBottomColor().resolve(b.color());
case CSSPropertyBorderBottomLeftRadius:
return a.borderBottomLeftRadius() == b.borderBottomLeftRadius();
case CSSPropertyBorderBottomRightRadius:
return a.borderBottomRightRadius() == b.borderBottomRightRadius();
case CSSPropertyBorderBottomWidth:
return a.borderBottomWidth() == b.borderBottomWidth();
case CSSPropertyBorderImageOutset:
return a.borderImageOutset() == b.borderImageOutset();
case CSSPropertyBorderImageSlice:
return a.borderImageSlices() == b.borderImageSlices();
case CSSPropertyBorderImageSource:
return dataEquivalent(a.borderImageSource(), b.borderImageSource());
case CSSPropertyBorderImageWidth:
return a.borderImageWidth() == b.borderImageWidth();
case CSSPropertyBorderLeftColor:
return a.borderLeftColor().resolve(a.color()) == b.borderLeftColor().resolve(b.color())
&& a.visitedLinkBorderLeftColor().resolve(a.color()) == b.visitedLinkBorderLeftColor().resolve(b.color());
case CSSPropertyBorderLeftWidth:
return a.borderLeftWidth() == b.borderLeftWidth();
case CSSPropertyBorderRightColor:
return a.borderRightColor().resolve(a.color()) == b.borderRightColor().resolve(b.color())
&& a.visitedLinkBorderRightColor().resolve(a.color()) == b.visitedLinkBorderRightColor().resolve(b.color());
case CSSPropertyBorderRightWidth:
return a.borderRightWidth() == b.borderRightWidth();
case CSSPropertyBorderTopColor:
return a.borderTopColor().resolve(a.color()) == b.borderTopColor().resolve(b.color())
&& a.visitedLinkBorderTopColor().resolve(a.color()) == b.visitedLinkBorderTopColor().resolve(b.color());
case CSSPropertyBorderTopLeftRadius:
return a.borderTopLeftRadius() == b.borderTopLeftRadius();
case CSSPropertyBorderTopRightRadius:
return a.borderTopRightRadius() == b.borderTopRightRadius();
case CSSPropertyBorderTopWidth:
return a.borderTopWidth() == b.borderTopWidth();
case CSSPropertyBottom:
return a.bottom() == b.bottom();
case CSSPropertyBoxShadow:
return dataEquivalent(a.boxShadow(), b.boxShadow());
case CSSPropertyClip:
return a.clip() == b.clip();
case CSSPropertyColor:
return a.color() == b.color() && a.visitedLinkColor() == b.visitedLinkColor();
case CSSPropertyFill:
return a.fillPaintType() == b.fillPaintType()
&& (a.fillPaintType() != SVGPaint::SVG_PAINTTYPE_RGBCOLOR || a.fillPaintColor() == b.fillPaintColor());
case CSSPropertyFillOpacity:
return a.fillOpacity() == b.fillOpacity();
case CSSPropertyFlexBasis:
return a.flexBasis() == b.flexBasis();
case CSSPropertyFlexGrow:
return a.flexGrow() == b.flexGrow();
case CSSPropertyFlexShrink:
return a.flexShrink() == b.flexShrink();
case CSSPropertyFloodColor:
return a.floodColor() == b.floodColor();
case CSSPropertyFloodOpacity:
return a.floodOpacity() == b.floodOpacity();
case CSSPropertyFontSize:
// CSSPropertyFontSize: Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
// if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
// FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
// enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
return a.specifiedFontSize() == b.specifiedFontSize();
case CSSPropertyFontWeight:
return a.fontWeight() == b.fontWeight();
case CSSPropertyHeight:
return a.height() == b.height();
case CSSPropertyLeft:
return a.left() == b.left();
case CSSPropertyLetterSpacing:
return a.letterSpacing() == b.letterSpacing();
case CSSPropertyLightingColor:
return a.lightingColor() == b.lightingColor();
case CSSPropertyLineHeight:
return a.specifiedLineHeight() == b.specifiedLineHeight();
case CSSPropertyListStyleImage:
return dataEquivalent(a.listStyleImage(), b.listStyleImage());
case CSSPropertyMarginBottom:
return a.marginBottom() == b.marginBottom();
case CSSPropertyMarginLeft:
return a.marginLeft() == b.marginLeft();
case CSSPropertyMarginRight:
//.........这里部分代码省略.........
示例6: paint
void InlineTextBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
{
if (isLineBreak() || !object()->shouldPaintWithinRoot(paintInfo) || object()->style()->visibility() != VISIBLE ||
m_truncation == cFullTruncation || paintInfo.phase == PaintPhaseOutline)
return;
ASSERT(paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines);
int xPos = tx + m_x - parent()->maxHorizontalVisualOverflow();
int w = width() + 2 * parent()->maxHorizontalVisualOverflow();
if (xPos >= paintInfo.rect.right() || xPos + w <= paintInfo.rect.x())
return;
bool isPrinting = textObject()->document()->printing();
// Determine whether or not we're selected.
bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && selectionState() != RenderObject::SelectionNone;
if (!haveSelection && paintInfo.phase == PaintPhaseSelection)
// When only painting the selection, don't bother to paint if there is none.
return;
GraphicsContext* context = paintInfo.context;
// Determine whether or not we have composition underlines to draw.
bool containsComposition = object()->document()->frame()->editor()->compositionNode() == object()->node();
bool useCustomUnderlines = containsComposition && object()->document()->frame()->editor()->compositionUsesCustomUnderlines();
// Set our font.
RenderStyle* styleToUse = object()->style(m_firstLine);
int d = styleToUse->textDecorationsInEffect();
const Font* font = &styleToUse->font();
if (*font != context->font())
context->setFont(*font);
// 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection
// and composition underlines.
if (paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && !isPrinting) {
#if PLATFORM(MAC)
// Custom highlighters go behind everything else.
if (styleToUse->highlight() != nullAtom && !context->paintingDisabled())
paintCustomHighlight(tx, ty, styleToUse->highlight());
#endif
if (containsComposition && !useCustomUnderlines)
paintCompositionBackground(context, tx, ty, styleToUse, font,
object()->document()->frame()->editor()->compositionStart(),
object()->document()->frame()->editor()->compositionEnd());
paintDocumentMarkers(context, tx, ty, styleToUse, font, true);
if (haveSelection && !useCustomUnderlines)
paintSelection(context, tx, ty, styleToUse, font);
}
// 2. Now paint the foreground, including text and decorations like underline/overline (in quirks mode only).
if (m_len <= 0)
return;
Color textFillColor;
Color textStrokeColor;
float textStrokeWidth = styleToUse->textStrokeWidth();
ShadowData* textShadow = paintInfo.forceBlackText ? 0 : styleToUse->textShadow();
if (paintInfo.forceBlackText) {
textFillColor = Color::black;
textStrokeColor = Color::black;
} else {
textFillColor = styleToUse->textFillColor();
if (!textFillColor.isValid())
textFillColor = styleToUse->color();
// Make the text fill color legible against a white background
if (styleToUse->forceBackgroundsToWhite())
textFillColor = correctedTextColor(textFillColor, Color::white);
textStrokeColor = styleToUse->textStrokeColor();
if (!textStrokeColor.isValid())
textStrokeColor = styleToUse->color();
// Make the text stroke color legible against a white background
if (styleToUse->forceBackgroundsToWhite())
textStrokeColor = correctedTextColor(textStrokeColor, Color::white);
}
bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
bool paintSelectedTextSeparately = false;
Color selectionFillColor = textFillColor;
Color selectionStrokeColor = textStrokeColor;
float selectionStrokeWidth = textStrokeWidth;
ShadowData* selectionShadow = textShadow;
if (haveSelection) {
// Check foreground color first.
Color foreground = paintInfo.forceBlackText ? Color::black : object()->selectionForegroundColor();
if (foreground.isValid() && foreground != selectionFillColor) {
if (!paintSelectedTextOnly)
paintSelectedTextSeparately = true;
selectionFillColor = foreground;
}
//.........这里部分代码省略.........
示例7: createFromColor
//.........这里部分代码省略.........
// Must pass a specified size to setFontSize if Text Autosizing is enabled, but a computed size
// if text zoom is enabled (if neither is enabled it's irrelevant as they're probably the same).
// FIXME: Should we introduce an option to pass the computed font size here, allowing consumers to
// enable text zoom rather than Text Autosizing? See http://crbug.com/227545.
return createFromDouble(style.specifiedFontSize());
case CSSPropertyFontStretch:
return createFromFontStretch(style.fontStretch());
case CSSPropertyFontWeight:
return createFromFontWeight(style.fontWeight());
case CSSPropertyHeight:
return createFromLength(style.height(), style);
case CSSPropertyLeft:
return createFromLength(style.left(), style);
case CSSPropertyLetterSpacing:
return createFromDouble(style.letterSpacing());
case CSSPropertyLineHeight:
return createFromLineHeight(style.specifiedLineHeight(), style);
case CSSPropertyMarginBottom:
return createFromLength(style.marginBottom(), style);
case CSSPropertyMarginLeft:
return createFromLength(style.marginLeft(), style);
case CSSPropertyMarginRight:
return createFromLength(style.marginRight(), style);
case CSSPropertyMarginTop:
return createFromLength(style.marginTop(), style);
case CSSPropertyMaxHeight:
return createFromLength(style.maxHeight(), style);
case CSSPropertyMaxWidth:
return createFromLength(style.maxWidth(), style);
case CSSPropertyMinHeight:
return createFromLength(style.minHeight(), style);
case CSSPropertyMinWidth:
return createFromLength(style.minWidth(), style);
case CSSPropertyObjectPosition:
return createFromLengthPoint(style.objectPosition(), style);
case CSSPropertyOpacity:
return createFromDouble(style.opacity());
case CSSPropertyOutlineColor:
return createFromColor(property, style);
case CSSPropertyOutlineOffset:
return createFromDouble(style.outlineOffset());
case CSSPropertyOutlineWidth:
return createFromDouble(style.outlineWidth());
case CSSPropertyPaddingBottom:
return createFromLength(style.paddingBottom(), style);
case CSSPropertyPaddingLeft:
return createFromLength(style.paddingLeft(), style);
case CSSPropertyPaddingRight:
return createFromLength(style.paddingRight(), style);
case CSSPropertyPaddingTop:
return createFromLength(style.paddingTop(), style);
case CSSPropertyRight:
return createFromLength(style.right(), style);
case CSSPropertyTextDecorationColor:
return AnimatableColor::create(style.textDecorationColor().resolve(style.color()));
case CSSPropertyTextIndent:
return createFromLength(style.textIndent(), style);
case CSSPropertyTextShadow:
return AnimatableShadow::create(style.textShadow());
case CSSPropertyTop:
return createFromLength(style.top(), style);
case CSSPropertyWebkitBorderHorizontalSpacing:
return createFromDouble(style.horizontalBorderSpacing());
case CSSPropertyWebkitBorderVerticalSpacing:
return createFromDouble(style.verticalBorderSpacing());
case CSSPropertyWebkitClipPath:
if (ClipPathOperation* operation = style.clipPath())
return AnimatableClipPathOperation::create(operation);
return AnimatableUnknown::create(CSSValueNone);
case CSSPropertyPerspective:
return createFromDouble(style.perspective());
case CSSPropertyPerspectiveOrigin:
return AnimatableLengthPoint::create(
createFromLength(style.perspectiveOriginX(), style),
createFromLength(style.perspectiveOriginY(), style));
case CSSPropertyWebkitTextStrokeColor:
return createFromColor(property, style);
case CSSPropertyTransform:
return AnimatableTransform::create(style.transform());
case CSSPropertyTransformOrigin:
return AnimatableLengthPoint3D::create(
createFromLength(style.transformOriginX(), style),
createFromLength(style.transformOriginY(), style),
createFromDouble(style.transformOriginZ()));
case CSSPropertyWidth:
return createFromLength(style.width(), style);
case CSSPropertyWordSpacing:
return createFromDouble(style.wordSpacing());
case CSSPropertyVerticalAlign:
if (style.verticalAlign() == LENGTH)
return createFromLength(style.verticalAlignLength(), style);
return AnimatableUnknown::create(CSSPrimitiveValue::create(style.verticalAlign()));
case CSSPropertyZIndex:
return createFromDouble(style.zIndex());
default:
ASSERT_NOT_REACHED();
// This return value is to avoid a release crash if possible.
return AnimatableUnknown::create(nullptr);
}
}
示例8: CSSPrimitiveValueImpl
//.........这里部分代码省略.........
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_CAPTION_SIDE:
switch (style->captionSide()) {
case khtml::CAPLEFT:
return new CSSPrimitiveValueImpl(CSS_VAL_LEFT);
case khtml::CAPRIGHT:
return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT);
case khtml::CAPTOP:
return new CSSPrimitiveValueImpl(CSS_VAL_TOP);
case khtml::CAPBOTTOM:
return new CSSPrimitiveValueImpl(CSS_VAL_BOTTOM);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_CLEAR:
switch (style->clear()) {
case khtml::CNONE:
return new CSSPrimitiveValueImpl(CSS_VAL_NONE);
case khtml::CLEFT:
return new CSSPrimitiveValueImpl(CSS_VAL_LEFT);
case khtml::CRIGHT:
return new CSSPrimitiveValueImpl(CSS_VAL_RIGHT);
case khtml::CBOTH:
return new CSSPrimitiveValueImpl(CSS_VAL_BOTH);
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP_CLIP:
// FIXME: unimplemented
break;
case CSS_PROP_COLOR:
return new CSSPrimitiveValueImpl(style->color().rgb());
case CSS_PROP_CONTENT:
// FIXME: unimplemented
break;
case CSS_PROP_COUNTER_INCREMENT:
// FIXME: unimplemented
break;
case CSS_PROP_COUNTER_RESET:
// FIXME: unimplemented
break;
case CSS_PROP_CURSOR:
switch (style->cursor()) {
case khtml::CURSOR_AUTO:
return new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
case khtml::CURSOR_CROSS:
return new CSSPrimitiveValueImpl(CSS_VAL_CROSSHAIR);
case khtml::CURSOR_DEFAULT:
return new CSSPrimitiveValueImpl(CSS_VAL_DEFAULT);
case khtml::CURSOR_POINTER:
return new CSSPrimitiveValueImpl(CSS_VAL_POINTER);
case khtml::CURSOR_MOVE:
return new CSSPrimitiveValueImpl(CSS_VAL_MOVE);
case khtml::CURSOR_E_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_E_RESIZE);
case khtml::CURSOR_NE_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_NE_RESIZE);
case khtml::CURSOR_NW_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_NW_RESIZE);
case khtml::CURSOR_N_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_N_RESIZE);
case khtml::CURSOR_SE_RESIZE:
return new CSSPrimitiveValueImpl(CSS_VAL_SE_RESIZE);
case khtml::CURSOR_SW_RESIZE:
示例9: createFromColor
//.........这里部分代码省略.........
case CSSPropertyOutlineColor:
return createFromColor(property, style);
case CSSPropertyOutlineOffset:
return createFromDouble(style.outlineOffset());
case CSSPropertyOutlineWidth:
return createFromDouble(style.outlineWidth());
case CSSPropertyPaddingBottom:
return createFromLength(style.paddingBottom(), style);
case CSSPropertyPaddingLeft:
return createFromLength(style.paddingLeft(), style);
case CSSPropertyPaddingRight:
return createFromLength(style.paddingRight(), style);
case CSSPropertyPaddingTop:
return createFromLength(style.paddingTop(), style);
case CSSPropertyRight:
return createFromLength(style.right(), style);
case CSSPropertyStrokeWidth:
return AnimatableSVGLength::create(style.strokeWidth());
case CSSPropertyStopColor:
return createFromColor(property, style);
case CSSPropertyStopOpacity:
return createFromDouble(style.stopOpacity());
case CSSPropertyStrokeDasharray:
return AnimatableStrokeDasharrayList::create(style.strokeDashArray());
case CSSPropertyStrokeDashoffset:
return AnimatableSVGLength::create(style.strokeDashOffset());
case CSSPropertyStrokeMiterlimit:
return createFromDouble(style.strokeMiterLimit());
case CSSPropertyStrokeOpacity:
return createFromDouble(style.strokeOpacity());
case CSSPropertyStroke:
return AnimatableSVGPaint::create(style.svgStyle()->strokePaintType(), style.svgStyle()->strokePaintColor(), style.svgStyle()->strokePaintUri());
case CSSPropertyTextDecorationColor:
return AnimatableColor::create(style.textDecorationColor().resolve(style.color()), style.visitedLinkTextDecorationColor().resolve(style.visitedLinkColor()));
case CSSPropertyTextIndent:
return createFromLength(style.textIndent(), style);
case CSSPropertyTextShadow:
return AnimatableShadow::create(style.textShadow());
case CSSPropertyTop:
return createFromLength(style.top(), style);
case CSSPropertyWebkitBorderHorizontalSpacing:
return createFromDouble(style.horizontalBorderSpacing());
case CSSPropertyWebkitBorderVerticalSpacing:
return createFromDouble(style.verticalBorderSpacing());
case CSSPropertyWebkitClipPath:
if (ClipPathOperation* operation = style.clipPath())
return AnimatableClipPathOperation::create(operation);
return AnimatableUnknown::create(CSSValueNone);
case CSSPropertyWebkitColumnCount:
return createFromDouble(style.columnCount());
case CSSPropertyWebkitColumnGap:
return createFromDouble(style.columnGap());
case CSSPropertyWebkitColumnRuleColor:
return createFromColor(property, style);
case CSSPropertyWebkitColumnRuleWidth:
return createFromDouble(style.columnRuleWidth());
case CSSPropertyWebkitColumnWidth:
return createFromDouble(style.columnWidth());
case CSSPropertyWebkitFilter:
return AnimatableFilterOperations::create(style.filter());
case CSSPropertyWebkitMaskBoxImageOutset:
return createFromBorderImageLengthBox(style.maskBoxImageOutset(), style);
case CSSPropertyWebkitMaskBoxImageSlice:
return createFromLengthBoxAndBool(style.maskBoxImageSlices(), style.maskBoxImageSlicesFill(), style);
case CSSPropertyWebkitMaskBoxImageSource:
return createFromStyleImage(style.maskBoxImageSource());