本文整理汇总了C++中RenderStyle::borderTopWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderStyle::borderTopWidth方法的具体用法?C++ RenderStyle::borderTopWidth怎么用?C++ RenderStyle::borderTopWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderStyle
的用法示例。
在下文中一共展示了RenderStyle::borderTopWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adjustStyle
void RenderTheme::adjustStyle(StyleResolver& styleResolver, RenderStyle& style, Element* element, bool UAHasAppearance, const BorderData& border, const FillLayer& background, const Color& backgroundColor)
{
// Force inline and table display styles to be inline-block (except for table- which is block)
ControlPart part = style.appearance();
if (style.display() == INLINE || style.display() == INLINE_TABLE || style.display() == TABLE_ROW_GROUP
|| style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOOTER_GROUP
|| style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP || style.display() == TABLE_COLUMN
|| style.display() == TABLE_CELL || style.display() == TABLE_CAPTION)
style.setDisplay(INLINE_BLOCK);
else if (style.display() == COMPACT || style.display() == LIST_ITEM || style.display() == TABLE)
style.setDisplay(BLOCK);
if (UAHasAppearance && isControlStyled(style, border, background, backgroundColor)) {
if (part == MenulistPart) {
style.setAppearance(MenulistButtonPart);
part = MenulistButtonPart;
} else
style.setAppearance(NoControlPart);
}
if (!style.hasAppearance())
return;
// Never support box-shadow on native controls.
style.setBoxShadow(nullptr);
#if USE(NEW_THEME)
switch (part) {
case CheckboxPart:
case InnerSpinButtonPart:
case RadioPart:
case PushButtonPart:
case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart: {
// Border
LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth(), style.borderBottomWidth(), style.borderLeftWidth());
borderBox = m_theme->controlBorder(part, style.fontCascade(), borderBox, style.effectiveZoom());
if (borderBox.top().value() != static_cast<int>(style.borderTopWidth())) {
if (borderBox.top().value())
style.setBorderTopWidth(borderBox.top().value());
else
style.resetBorderTop();
}
if (borderBox.right().value() != static_cast<int>(style.borderRightWidth())) {
if (borderBox.right().value())
style.setBorderRightWidth(borderBox.right().value());
else
style.resetBorderRight();
}
if (borderBox.bottom().value() != static_cast<int>(style.borderBottomWidth())) {
style.setBorderBottomWidth(borderBox.bottom().value());
if (borderBox.bottom().value())
style.setBorderBottomWidth(borderBox.bottom().value());
else
style.resetBorderBottom();
}
if (borderBox.left().value() != static_cast<int>(style.borderLeftWidth())) {
style.setBorderLeftWidth(borderBox.left().value());
if (borderBox.left().value())
style.setBorderLeftWidth(borderBox.left().value());
else
style.resetBorderLeft();
}
// Padding
LengthBox paddingBox = m_theme->controlPadding(part, style.fontCascade(), style.paddingBox(), style.effectiveZoom());
if (paddingBox != style.paddingBox())
style.setPaddingBox(paddingBox);
// Whitespace
if (m_theme->controlRequiresPreWhiteSpace(part))
style.setWhiteSpace(PRE);
// Width / Height
// The width and height here are affected by the zoom.
// FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
LengthSize controlSize = m_theme->controlSize(part, style.fontCascade(), LengthSize(style.width(), style.height()), style.effectiveZoom());
if (controlSize.width() != style.width())
style.setWidth(controlSize.width());
if (controlSize.height() != style.height())
style.setHeight(controlSize.height());
// Min-Width / Min-Height
LengthSize minControlSize = m_theme->minimumControlSize(part, style.fontCascade(), style.effectiveZoom());
if (minControlSize.width() != style.minWidth())
style.setMinWidth(minControlSize.width());
if (minControlSize.height() != style.minHeight())
style.setMinHeight(minControlSize.height());
// Font
if (auto themeFont = m_theme->controlFont(part, style.fontCascade(), style.effectiveZoom())) {
// If overriding the specified font with the theme font, also override the line height with the standard line height.
style.setLineHeight(RenderStyle::initialLineHeight());
if (style.setFontDescription(themeFont.value()))
style.fontCascade().update(nullptr);
}
// Special style that tells enabled default buttons in active windows to use the ActiveButtonText color.
// The active window part of the test has to be done at paint time since it's not triggered by a style change.
//.........这里部分代码省略.........
示例2: 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:
//.........这里部分代码省略.........
示例3: createFromColor
// FIXME: Generate this function.
PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style)
{
ASSERT(CSSPropertyMetadata::isAnimatableProperty(property));
switch (property) {
case CSSPropertyBackgroundColor:
return createFromColor(property, style);
case CSSPropertyBackgroundImage:
return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionX:
return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionY:
return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style);
case CSSPropertyBackgroundSize:
case CSSPropertyWebkitBackgroundSize:
return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style);
case CSSPropertyBorderBottomColor:
return createFromColor(property, style);
case CSSPropertyBorderBottomLeftRadius:
return createFromLengthSize(style.borderBottomLeftRadius(), style);
case CSSPropertyBorderBottomRightRadius:
return createFromLengthSize(style.borderBottomRightRadius(), style);
case CSSPropertyBorderBottomWidth:
return createFromDouble(style.borderBottomWidth());
case CSSPropertyBorderImageOutset:
return createFromBorderImageLengthBox(style.borderImageOutset(), style);
case CSSPropertyBorderImageSlice:
return createFromLengthBox(style.borderImageSlices(), style);
case CSSPropertyBorderImageSource:
return createFromStyleImage(style.borderImageSource());
case CSSPropertyBorderImageWidth:
return createFromBorderImageLengthBox(style.borderImageWidth(), style);
case CSSPropertyBorderLeftColor:
return createFromColor(property, style);
case CSSPropertyBorderLeftWidth:
return createFromDouble(style.borderLeftWidth());
case CSSPropertyBorderRightColor:
return createFromColor(property, style);
case CSSPropertyBorderRightWidth:
return createFromDouble(style.borderRightWidth());
case CSSPropertyBorderTopColor:
return createFromColor(property, style);
case CSSPropertyBorderTopLeftRadius:
return createFromLengthSize(style.borderTopLeftRadius(), style);
case CSSPropertyBorderTopRightRadius:
return createFromLengthSize(style.borderTopRightRadius(), style);
case CSSPropertyBorderTopWidth:
return createFromDouble(style.borderTopWidth());
case CSSPropertyBottom:
return createFromLength(style.bottom(), style);
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
return AnimatableShadow::create(style.boxShadow());
case CSSPropertyClip:
if (style.hasAutoClip())
return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
return createFromLengthBox(style.clip(), style);
case CSSPropertyColor:
return createFromColor(property, style);
case CSSPropertyFilter:
return AnimatableFilterOperations::create(style.filter());
case CSSPropertyFlexGrow:
return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexShrink:
return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexBasis:
return createFromLength(style.flexBasis(), style);
case 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 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:
//.........这里部分代码省略.........
示例4: createFromColor
// FIXME: Generate this function.
PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID property, const RenderStyle& style)
{
switch (property) {
case CSSPropertyBackgroundColor:
return createFromColor(property, style);
case CSSPropertyBackgroundImage:
return createFromFillLayers<CSSPropertyBackgroundImage>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionX:
return createFromFillLayers<CSSPropertyBackgroundPositionX>(style.backgroundLayers(), style);
case CSSPropertyBackgroundPositionY:
return createFromFillLayers<CSSPropertyBackgroundPositionY>(style.backgroundLayers(), style);
case CSSPropertyBackgroundSize:
case CSSPropertyWebkitBackgroundSize:
return createFromFillLayers<CSSPropertyBackgroundSize>(style.backgroundLayers(), style);
case CSSPropertyBaselineShift:
return AnimatableSVGLength::create(style.baselineShiftValue());
case CSSPropertyBorderBottomColor:
return createFromColor(property, style);
case CSSPropertyBorderBottomLeftRadius:
return createFromLengthSize(style.borderBottomLeftRadius(), style);
case CSSPropertyBorderBottomRightRadius:
return createFromLengthSize(style.borderBottomRightRadius(), style);
case CSSPropertyBorderBottomWidth:
return createFromDouble(style.borderBottomWidth());
case CSSPropertyBorderImageOutset:
return createFromBorderImageLengthBox(style.borderImageOutset(), style);
case CSSPropertyBorderImageSlice:
return createFromLengthBox(style.borderImageSlices(), style);
case CSSPropertyBorderImageSource:
return createFromStyleImage(style.borderImageSource());
case CSSPropertyBorderImageWidth:
return createFromBorderImageLengthBox(style.borderImageWidth(), style);
case CSSPropertyBorderLeftColor:
return createFromColor(property, style);
case CSSPropertyBorderLeftWidth:
return createFromDouble(style.borderLeftWidth());
case CSSPropertyBorderRightColor:
return createFromColor(property, style);
case CSSPropertyBorderRightWidth:
return createFromDouble(style.borderRightWidth());
case CSSPropertyBorderTopColor:
return createFromColor(property, style);
case CSSPropertyBorderTopLeftRadius:
return createFromLengthSize(style.borderTopLeftRadius(), style);
case CSSPropertyBorderTopRightRadius:
return createFromLengthSize(style.borderTopRightRadius(), style);
case CSSPropertyBorderTopWidth:
return createFromDouble(style.borderTopWidth());
case CSSPropertyBottom:
return createFromLength(style.bottom(), style);
case CSSPropertyBoxShadow:
case CSSPropertyWebkitBoxShadow:
return AnimatableShadow::create(style.boxShadow());
case CSSPropertyClip:
if (style.hasClip())
return createFromLengthBox(style.clip(), style);
return AnimatableUnknown::create(CSSPrimitiveValue::create(CSSValueAuto));
case CSSPropertyColor:
return createFromColor(property, style);
case CSSPropertyFillOpacity:
return createFromDouble(style.fillOpacity());
case CSSPropertyFill:
return AnimatableSVGPaint::create(style.svgStyle()->fillPaintType(), style.svgStyle()->fillPaintColor(), style.svgStyle()->fillPaintUri());
case CSSPropertyFlexGrow:
return createFromDouble(style.flexGrow(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexShrink:
return createFromDouble(style.flexShrink(), AnimatableDouble::InterpolationIsNonContinuousWithZero);
case CSSPropertyFlexBasis:
return createFromLength(style.flexBasis(), style);
case CSSPropertyFloodColor:
return createFromColor(property, style);
case CSSPropertyFloodOpacity:
return createFromDouble(style.floodOpacity());
case 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 createFromDouble(style.specifiedFontSize());
case CSSPropertyHeight:
return createFromLength(style.height(), style);
case CSSPropertyKerning:
return AnimatableSVGLength::create(style.kerning());
case CSSPropertyLightingColor:
return createFromColor(property, style);
case CSSPropertyListStyleImage:
return createFromStyleImage(style.listStyleImage());
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);
//.........这里部分代码省略.........
示例5: CSSPrimitiveValueImpl
//.........这里部分代码省略.........
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());
case CSS_PROP_BORDER_LEFT_STYLE:
return valueForBorderStyle(style->borderLeftStyle());
case CSS_PROP_BORDER_TOP_WIDTH:
return new CSSPrimitiveValueImpl(style->borderTopWidth(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP_BORDER_RIGHT_WIDTH:
return new CSSPrimitiveValueImpl(style->borderRightWidth(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP_BORDER_BOTTOM_WIDTH:
return new CSSPrimitiveValueImpl(style->borderBottomWidth(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP_BORDER_LEFT_WIDTH:
return new CSSPrimitiveValueImpl(style->borderLeftWidth(), CSSPrimitiveValue::CSS_PX);
case CSS_PROP_BOTTOM:
return getPositionOffsetValue(renderer, CSS_PROP_BOTTOM);
case CSS_PROP__KHTML_BOX_ALIGN:
switch (style->boxAlign()) {
case khtml::BSTRETCH:
return new CSSPrimitiveValueImpl(CSS_VAL_STRETCH);
case khtml::BSTART:
return new CSSPrimitiveValueImpl(CSS_VAL_START);
case khtml::BCENTER:
return new CSSPrimitiveValueImpl(CSS_VAL_CENTER);
case khtml::BEND:
return new CSSPrimitiveValueImpl(CSS_VAL_END);
case khtml::BBASELINE:
return new CSSPrimitiveValueImpl(CSS_VAL_BASELINE);
case khtml::BJUSTIFY:
break; // not allowed
}
ASSERT_NOT_REACHED();
return 0;
case CSS_PROP__KHTML_BOX_DIRECTION:
switch (style->boxDirection()) {
case khtml::BNORMAL:
return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL);
case khtml::BREVERSE:
return new CSSPrimitiveValueImpl(CSS_VAL_REVERSE);
}
示例6: diffNeedsFullLayout
bool RenderStyle::diffNeedsFullLayout(const RenderStyle& other) const
{
// FIXME: Not all cases in this method need both full layout and paint invalidation.
// Should move cases into diffNeedsFullLayout() if
// - don't need paint invalidation at all;
// - or the renderer knows how to exactly invalidate paints caused by the layout change
// instead of forced full paint invalidation.
if (surround.get() != other.surround.get()) {
// If our border widths change, then we need to layout. Other changes to borders only necessitate a paint invalidation.
if (borderLeftWidth() != other.borderLeftWidth()
|| borderTopWidth() != other.borderTopWidth()
|| borderBottomWidth() != other.borderBottomWidth()
|| borderRightWidth() != other.borderRightWidth())
return true;
}
if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
if (rareNonInheritedData->textOverflow != other.rareNonInheritedData->textOverflow
|| rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m_wrapFlow
|| rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData->m_wrapThrough
|| rareNonInheritedData->m_order != other.rareNonInheritedData->m_order
|| rareNonInheritedData->m_alignContent != other.rareNonInheritedData->m_alignContent
|| rareNonInheritedData->m_alignItems != other.rareNonInheritedData->m_alignItems
|| rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->m_alignSelf
|| rareNonInheritedData->m_justifyContent != other.rareNonInheritedData->m_justifyContent)
return true;
if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedData->m_flexibleBox.get()
&& *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInheritedData->m_flexibleBox.get())
return true;
// FIXME: We should add an optimized form of layout that just recomputes visual overflow.
if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedData.get()))
return true;
// If the counter directives change, trigger a relayout to re-calculate counter values and rebuild the counter node tree.
const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirectives.get();
const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterDirectives.get();
if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB)))
return true;
// We only need do layout for opacity changes if adding or losing opacity could trigger a change
// in us being a stacking context.
if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->hasOpacity() != other.rareNonInheritedData->hasOpacity()) {
// FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
// We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
// to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
// In addition we need to solve the floating object issue when layers come and go. Right now
// a full layout is necessary to keep floating object lists sane.
return true;
}
}
if (rareInheritedData.get() != other.rareInheritedData.get()) {
if (rareInheritedData->highlight != other.rareInheritedData->highlight
|| rareInheritedData->indent != other.rareInheritedData->indent
|| rareInheritedData->m_textAlignLast != other.rareInheritedData->m_textAlignLast
|| rareInheritedData->m_textIndentLine != other.rareInheritedData->m_textIndentLine
|| rareInheritedData->wordBreak != other.rareInheritedData->wordBreak
|| rareInheritedData->overflowWrap != other.rareInheritedData->overflowWrap
|| rareInheritedData->lineBreak != other.rareInheritedData->lineBreak
|| rareInheritedData->hyphens != other.rareInheritedData->hyphens
|| rareInheritedData->hyphenationLimitBefore != other.rareInheritedData->hyphenationLimitBefore
|| rareInheritedData->hyphenationLimitAfter != other.rareInheritedData->hyphenationLimitAfter
|| rareInheritedData->hyphenationString != other.rareInheritedData->hyphenationString
|| rareInheritedData->locale != other.rareInheritedData->locale
|| rareInheritedData->textEmphasisMark != other.rareInheritedData->textEmphasisMark
|| rareInheritedData->textEmphasisPosition != other.rareInheritedData->textEmphasisPosition
|| rareInheritedData->textEmphasisCustomMark != other.rareInheritedData->textEmphasisCustomMark
|| rareInheritedData->m_textJustify != other.rareInheritedData->m_textJustify
|| rareInheritedData->m_textOrientation != other.rareInheritedData->m_textOrientation
|| rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSize
|| rareInheritedData->m_lineBoxContain != other.rareInheritedData->m_lineBoxContain
|| rareInheritedData->textStrokeWidth != other.rareInheritedData->textStrokeWidth)
return true;
if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.get()))
return true;
}
if (inherited.get() != other.inherited.get()) {
if (inherited->line_height != other.inherited->line_height
|| inherited->font != other.inherited->font
|| inherited->horizontal_border_spacing != other.inherited->horizontal_border_spacing
|| inherited->vertical_border_spacing != other.inherited->vertical_border_spacing)
return true;
}
if (inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering
|| inherited_flags._text_align != other.inherited_flags._text_align
|| inherited_flags._direction != other.inherited_flags._direction
|| inherited_flags._white_space != other.inherited_flags._white_space)
return true;
if (noninherited_flags.overflowX != other.noninherited_flags.overflowX
|| noninherited_flags.overflowY != other.noninherited_flags.overflowY
|| noninherited_flags.unicodeBidi != other.noninherited_flags.unicodeBidi
|| noninherited_flags.position != other.noninherited_flags.position
|| noninherited_flags.originalDisplay != other.noninherited_flags.originalDisplay)
//.........这里部分代码省略.........