📄 csscomputedstyledeclaration.cpp
字号:
list->append(CSSPrimitiveValue::createIdentifier(CSSValueNone)); return list.release(); } case CSSPropertyWebkitAnimationTimingFunction: return getTimingFunctionValue(style->animations()); case CSSPropertyWebkitAppearance: return CSSPrimitiveValue::create(style->appearance()); case CSSPropertyWebkitBackfaceVisibility: return CSSPrimitiveValue::createIdentifier((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible); case CSSPropertyWebkitBorderImage: return valueForNinePieceImage(style->borderImage()); case CSSPropertyWebkitMaskBoxImage: return valueForNinePieceImage(style->maskBoxImage()); case CSSPropertyWebkitFontSizeDelta: // Not a real style property -- used by the editing engine -- so has no computed value. break; case CSSPropertyWebkitMarginBottomCollapse: return CSSPrimitiveValue::create(style->marginBottomCollapse()); case CSSPropertyWebkitMarginTopCollapse: return CSSPrimitiveValue::create(style->marginTopCollapse()); case CSSPropertyWebkitPerspective: if (!style->hasPerspective()) return CSSPrimitiveValue::createIdentifier(CSSValueNone); return CSSPrimitiveValue::create(style->perspective(), CSSPrimitiveValue::CSS_NUMBER); case CSSPropertyWebkitPerspectiveOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { IntRect box = sizingBox(renderer); list->append(CSSPrimitiveValue::create(style->perspectiveOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX)); list->append(CSSPrimitiveValue::create(style->perspectiveOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX)); } else { list->append(CSSPrimitiveValue::create(style->perspectiveOriginX())); list->append(CSSPrimitiveValue::create(style->perspectiveOriginY())); } return list.release(); } case CSSPropertyWebkitRtlOrdering: if (style->visuallyOrdered()) return CSSPrimitiveValue::createIdentifier(CSSValueVisual); return CSSPrimitiveValue::createIdentifier(CSSValueLogical); case CSSPropertyWebkitUserDrag: return CSSPrimitiveValue::create(style->userDrag()); case CSSPropertyWebkitUserSelect: return CSSPrimitiveValue::create(style->userSelect()); case CSSPropertyWebkitBorderBottomLeftRadius: return getBorderRadiusCornerValue(style->borderBottomLeftRadius()); case CSSPropertyWebkitBorderBottomRightRadius: return getBorderRadiusCornerValue(style->borderBottomRightRadius()); case CSSPropertyWebkitBorderTopLeftRadius: return getBorderRadiusCornerValue(style->borderTopLeftRadius()); case CSSPropertyWebkitBorderTopRightRadius: return getBorderRadiusCornerValue(style->borderTopRightRadius()); case CSSPropertyClip: { if (style->hasClip()) { RefPtr<Rect> rect = Rect::create(); rect->setTop(CSSPrimitiveValue::create(style->clip().top().value(), CSSPrimitiveValue::CSS_PX)); rect->setRight(CSSPrimitiveValue::create(style->clip().right().value(), CSSPrimitiveValue::CSS_PX)); rect->setBottom(CSSPrimitiveValue::create(style->clip().bottom().value(), CSSPrimitiveValue::CSS_PX)); rect->setLeft(CSSPrimitiveValue::create(style->clip().left().value(), CSSPrimitiveValue::CSS_PX)); return CSSPrimitiveValue::create(rect.release()); } return 0; } case CSSPropertyWebkitTransform: return computedTransform(renderer, style.get()); case CSSPropertyWebkitTransformOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { IntRect box = sizingBox(renderer); list->append(CSSPrimitiveValue::create(style->transformOriginX().calcMinValue(box.width()), CSSPrimitiveValue::CSS_PX)); list->append(CSSPrimitiveValue::create(style->transformOriginY().calcMinValue(box.height()), CSSPrimitiveValue::CSS_PX)); if (style->transformOriginZ() != 0) list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX)); } else { list->append(CSSPrimitiveValue::create(style->transformOriginX())); list->append(CSSPrimitiveValue::create(style->transformOriginY())); if (style->transformOriginZ() != 0) list->append(CSSPrimitiveValue::create(style->transformOriginZ(), CSSPrimitiveValue::CSS_PX)); } return list.release(); } case CSSPropertyWebkitTransformStyle: return CSSPrimitiveValue::createIdentifier((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat); case CSSPropertyWebkitTransitionDelay: return getDelayValue(style->transitions()); case CSSPropertyWebkitTransitionDuration: return getDurationValue(style->transitions()); case CSSPropertyWebkitTransitionProperty: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const AnimationList* t = style->transitions(); if (t) { for (size_t i = 0; i < t->size(); ++i) { int prop = t->animation(i)->property(); RefPtr<CSSValue> propertyValue; if (prop == cAnimateNone) propertyValue = CSSPrimitiveValue::createIdentifier(CSSValueNone); else if (prop == cAnimateAll) propertyValue = CSSPrimitiveValue::createIdentifier(CSSValueAll); else propertyValue = CSSPrimitiveValue::create(getPropertyName(static_cast<CSSPropertyID>(prop)), CSSPrimitiveValue::CSS_STRING); list->append(propertyValue); } } else list->append(CSSPrimitiveValue::createIdentifier(CSSValueAll)); return list.release(); } case CSSPropertyWebkitTransitionTimingFunction: return getTimingFunctionValue(style->transitions()); case CSSPropertyPointerEvents: return CSSPrimitiveValue::create(style->pointerEvents()); /* Shorthand properties, currently not supported see bug 13658*/ case CSSPropertyBackground: case CSSPropertyBorder: case CSSPropertyBorderBottom: case CSSPropertyBorderColor: case CSSPropertyBorderLeft: case CSSPropertyBorderRight: case CSSPropertyBorderStyle: case CSSPropertyBorderTop: case CSSPropertyBorderWidth: case CSSPropertyFont: case CSSPropertyListStyle: case CSSPropertyMargin: case CSSPropertyPadding: break; /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */ case CSSPropertyTextLineThrough: case CSSPropertyTextLineThroughColor: case CSSPropertyTextLineThroughMode: case CSSPropertyTextLineThroughStyle: case CSSPropertyTextLineThroughWidth: case CSSPropertyTextOverflow: case CSSPropertyTextOverline: case CSSPropertyTextOverlineColor: case CSSPropertyTextOverlineMode: case CSSPropertyTextOverlineStyle: case CSSPropertyTextOverlineWidth: case CSSPropertyTextUnderline: case CSSPropertyTextUnderlineColor: case CSSPropertyTextUnderlineMode: case CSSPropertyTextUnderlineStyle: case CSSPropertyTextUnderlineWidth: break; /* Unimplemented @font-face properties */ case CSSPropertyFontStretch: case CSSPropertySrc: case CSSPropertyUnicodeRange: break; /* Other unimplemented properties */ case CSSPropertyContent: // FIXME: needs implementation, bug 23668 case CSSPropertyCounterIncrement: case CSSPropertyCounterReset: case CSSPropertyOutline: // FIXME: needs implementation case CSSPropertyOutlineOffset: // FIXME: needs implementation case CSSPropertyPage: // for @page case CSSPropertyQuotes: // FIXME: needs implementation case CSSPropertySize: // for @page break; /* Unimplemented -webkit- properties */ case CSSPropertyWebkitAnimation: case CSSPropertyWebkitBorderRadius: case CSSPropertyWebkitColumns: case CSSPropertyWebkitColumnRule: case CSSPropertyWebkitMarginCollapse: case CSSPropertyWebkitMarginStart: case CSSPropertyWebkitMarquee: case CSSPropertyWebkitMarqueeSpeed: case CSSPropertyWebkitMask: case CSSPropertyWebkitPaddingStart: case CSSPropertyWebkitTextStroke: case CSSPropertyWebkitTransition: case CSSPropertyWebkitVariableDeclarationBlock: break;#if ENABLE(SVG) // FIXME: This default case ruins the point of using an enum for // properties -- it prevents us from getting a warning when we // forget to list a property above. default: return getSVGPropertyCSSValue(propertyID, DoNotUpdateLayout);#endif } LOG_ERROR("unimplemented propertyID: %d", propertyID); return 0;}String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const{ RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); if (value) return value->cssText(); return "";}bool CSSComputedStyleDeclaration::getPropertyPriority(int /*propertyID*/) const{ // All computed styles have a priority of false (not "important"). return false;}String CSSComputedStyleDeclaration::removeProperty(int /*propertyID*/, ExceptionCode& ec){ ec = NO_MODIFICATION_ALLOWED_ERR; return String();}void CSSComputedStyleDeclaration::setProperty(int /*propertyID*/, const String& /*value*/, bool /*important*/, ExceptionCode& ec){ ec = NO_MODIFICATION_ALLOWED_ERR;}unsigned CSSComputedStyleDeclaration::length() const{ Node* node = m_node.get(); if (!node) return 0; RenderStyle* style = node->computedStyle(); if (!style) return 0; return numComputedProperties;}String CSSComputedStyleDeclaration::item(unsigned i) const{ if (i >= length()) return String(); return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));}// This is the list of properties we want to copy in the copyInheritableProperties() function.// It is the intersection of the list of inherited CSS properties and the// properties for which we have a computed implementation in this file.const int inheritableProperties[] = { CSSPropertyBorderCollapse, CSSPropertyColor, CSSPropertyFontFamily, CSSPropertyFontSize, CSSPropertyFontStyle, CSSPropertyFontVariant, CSSPropertyFontWeight, CSSPropertyLetterSpacing, CSSPropertyLineHeight, CSSPropertyOrphans, CSSPropertyTextAlign, CSSPropertyTextIndent, CSSPropertyTextTransform, CSSPropertyWhiteSpace, CSSPropertyWidows, CSSPropertyWordSpacing, CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing, CSSPropertyWebkitTextDecorationsInEffect, CSSPropertyWebkitTextFillColor, CSSPropertyWebkitTextSizeAdjust, CSSPropertyWebkitTextStrokeColor, CSSPropertyWebkitTextStrokeWidth,};const unsigned numInheritableProperties = sizeof(inheritableProperties) / sizeof(inheritableProperties[0]);void CSSComputedStyleDeclaration::removeComputedInheritablePropertiesFrom(CSSMutableStyleDeclaration* declaration){ declaration->removePropertiesInSet(inheritableProperties, numInheritableProperties);}PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyInheritableProperties() const{ RefPtr<CSSMutableStyleDeclaration> style = copyPropertiesInSet(inheritableProperties, numInheritableProperties); if (style && m_node && m_node->computedStyle()) { // If a node's text fill color is invalid, then its children use // their font-color as their text fill color (they don't // inherit it). Likewise for stroke color. ExceptionCode ec = 0; if (!m_node->computedStyle()->textFillColor().isValid()) style->removePrope
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -