コード例 #1
0
PassRefPtrWillBeRawPtr<StyleImage> ElementStyleResources::styleImage(Document& document, const TextLinkColors& textLinkColors, Color currentColor, CSSPropertyID property, CSSValue* value)
{
    if (value->isImageValue())
        return cachedOrPendingFromValue(document, property, toCSSImageValue(value));

    if (value->isImageGeneratorValue())
        return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(value));

    if (value->isImageSetValue())
        return setOrPendingFromValue(property, toCSSImageSetValue(value));

    if (value->isCursorImageValue())
        return cursorOrPendingFromValue(property, toCSSCursorImageValue(value));

    return nullptr;
}
コード例 #2
0
ファイル: CSSValue.cpp プロジェクト: krockot/mojo
bool CSSValue::hasFailedOrCanceledSubresources() const
{
    // This should get called for internal instances only.
    ASSERT(!isCSSOMSafe());

    if (isValueList())
        return toCSSValueList(this)->hasFailedOrCanceledSubresources();
    if (classType() == FontFaceSrcClass)
        return toCSSFontFaceSrcValue(this)->hasFailedOrCanceledSubresources();
    if (classType() == ImageClass)
        return toCSSImageValue(this)->hasFailedOrCanceledSubresources();
    if (classType() == CrossfadeClass)
        return toCSSCrossfadeValue(this)->hasFailedOrCanceledSubresources();
    if (classType() == ImageSetClass)
        return toCSSImageSetValue(this)->hasFailedOrCanceledSubresources();

    return false;
}
コード例 #3
0
ファイル: CSSValue.cpp プロジェクト: Miaque/mojo
PassRefPtr<CSSValue> CSSValue::cloneForCSSOM() const
{
    switch (classType()) {
    case PrimitiveClass:
        return toCSSPrimitiveValue(this)->cloneForCSSOM();
    case ValueListClass:
        return toCSSValueList(this)->cloneForCSSOM();
    case ImageClass:
        return toCSSImageValue(this)->cloneForCSSOM();
    case CSSFilterClass:
        return toCSSFilterValue(this)->cloneForCSSOM();
    case CSSTransformClass:
        return toCSSTransformValue(this)->cloneForCSSOM();
    case ImageSetClass:
        return toCSSImageSetValue(this)->cloneForCSSOM();
    default:
        ASSERT(!isSubtypeExposedToCSSOM());
        return TextCloneCSSValue::create(classType(), cssText());
    }
}
コード例 #4
0
ファイル: CSSValue.cpp プロジェクト: Happy-Ferret/webkit.js
PassRefPtr<CSSValue> CSSValue::cloneForCSSOM() const
{
    switch (classType()) {
    case PrimitiveClass:
        return toCSSPrimitiveValue(this)->cloneForCSSOM();
    case ValueListClass:
        return toCSSValueList(this)->cloneForCSSOM();
    case ImageClass:
    case CursorImageClass:
        return toCSSImageValue(this)->cloneForCSSOM();
#if ENABLE(CSS_FILTERS)
    case WebKitCSSFilterClass:
        return toWebKitCSSFilterValue(this)->cloneForCSSOM();
#if ENABLE(CSS_SHADERS)
    case WebKitCSSArrayFunctionValueClass:
        return toWebKitCSSArrayFunctionValue(this)->cloneForCSSOM();
    case WebKitCSSMatFunctionValueClass:
        return toWebKitCSSMatFunctionValue(this)->cloneForCSSOM();
    case WebKitCSSMixFunctionValueClass:
        return toWebKitCSSMixFunctionValue(this)->cloneForCSSOM();
#endif
#endif
    case WebKitCSSTransformClass:
        return toWebKitCSSTransformValue(this)->cloneForCSSOM();
#if ENABLE(CSS_IMAGE_SET)
    case ImageSetClass:
        return toCSSImageSetValue(this)->cloneForCSSOM();
#endif
#if ENABLE(SVG)
    case SVGColorClass:
        return toSVGColor(this)->cloneForCSSOM();
    case SVGPaintClass:
        return toSVGPaint(this)->cloneForCSSOM();
#endif
    default:
        ASSERT(!isSubtypeExposedToCSSOM());
        return TextCloneCSSValue::create(classType(), cssText());
    }
}
コード例 #5
0
StyleImage* CSSCursorImageValue::cacheImage(const Document& document,
                                            float deviceScaleFactor) {
  if (m_imageValue->isImageSetValue())
    return toCSSImageSetValue(*m_imageValue)
        .cacheImage(document, deviceScaleFactor);

  if (m_isCachePending) {
    m_isCachePending = false;

    // For SVG images we need to lazily substitute in the correct URL. Rather
    // than attempt to change the URL of the CSSImageValue (which would then
    // change behavior like cssText), we create an alternate CSSImageValue to
    // use.
    if (hasFragmentInURL()) {
      CSSImageValue* imageValue = toCSSImageValue(m_imageValue.get());
      // FIXME: This will fail if the <cursor> element is in a shadow DOM
      // (http://crbug/59827)
      if (SVGCursorElement* cursorElement =
              resourceReferencedByCursorElement(imageValue->url(), document)) {
        CSSImageValue* svgImageValue =
            CSSImageValue::create(document.completeURL(
                cursorElement->href()->currentValue()->value()));
        svgImageValue->setReferrer(imageValue->referrer());
        m_cachedImage = svgImageValue->cacheImage(document);
        return m_cachedImage.get();
      }
    }

    if (m_imageValue->isImageValue())
      m_cachedImage = toCSSImageValue(*m_imageValue).cacheImage(document);
  }

  if (m_cachedImage && m_cachedImage->isImageResource())
    return toStyleFetchedImage(m_cachedImage);
  return nullptr;
}
コード例 #6
0
void CSSValue::destroy()
{
    if (m_isTextClone) {
        ASSERT(isCSSOMSafe());
        delete static_cast<TextCloneCSSValue*>(this);
        return;
    }
    ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());

    switch (classType()) {
    case AspectRatioClass:
        delete static_cast<CSSAspectRatioValue*>(this);
        return;
    case BorderImageSliceClass:
        delete static_cast<CSSBorderImageSliceValue*>(this);
        return;
    case CanvasClass:
        delete static_cast<CSSCanvasValue*>(this);
        return;
    case CursorImageClass:
        delete static_cast<CSSCursorImageValue*>(this);
        return;
    case FontClass:
        delete static_cast<FontValue*>(this);
        return;
    case FontFaceSrcClass:
        delete static_cast<CSSFontFaceSrcValue*>(this);
        return;
    case FontFeatureClass:
        delete static_cast<FontFeatureValue*>(this);
        return;
    case FunctionClass:
        delete static_cast<CSSFunctionValue*>(this);
        return;
    case LinearGradientClass:
        delete static_cast<CSSLinearGradientValue*>(this);
        return;
    case RadialGradientClass:
        delete static_cast<CSSRadialGradientValue*>(this);
        return;
    case CrossfadeClass:
        delete static_cast<CSSCrossfadeValue*>(this);
        return;
    case ImageClass:
        delete static_cast<CSSImageValue*>(this);
        return;
    case InheritedClass:
        delete static_cast<CSSInheritedValue*>(this);
        return;
    case InitialClass:
        delete static_cast<CSSInitialValue*>(this);
        return;
    case PrimitiveClass:
        delete static_cast<CSSPrimitiveValue*>(this);
        return;
    case ReflectClass:
        delete toCSSReflectValue(this);
        return;
    case ShadowClass:
        delete static_cast<ShadowValue*>(this);
        return;
    case CubicBezierTimingFunctionClass:
        delete static_cast<CSSCubicBezierTimingFunctionValue*>(this);
        return;
    case StepsTimingFunctionClass:
        delete static_cast<CSSStepsTimingFunctionValue*>(this);
        return;
    case UnicodeRangeClass:
        delete static_cast<CSSUnicodeRangeValue*>(this);
        return;
    case ValueListClass:
        delete static_cast<CSSValueList*>(this);
        return;
    case WebKitCSSTransformClass:
        delete toWebKitCSSTransformValue(this);
        return;
    case LineBoxContainClass:
        delete static_cast<CSSLineBoxContainValue*>(this);
        return;
    case CalculationClass:
        delete static_cast<CSSCalcValue*>(this);
        return;
#if ENABLE(CSS_IMAGE_SET)
    case ImageSetClass:
        delete toCSSImageSetValue(this);
        return;
#endif
#if ENABLE(CSS_FILTERS)
    case FilterImageClass:
        delete static_cast<CSSFilterImageValue*>(this);
        return;
    case WebKitCSSFilterClass:
        delete toWebKitCSSFilterValue(this);
        return;
#if ENABLE(CSS_SHADERS)
    case WebKitCSSArrayFunctionValueClass:
        delete toWebKitCSSArrayFunctionValue(this);
        return;
    case WebKitCSSMatFunctionValueClass:
        delete toWebKitCSSMatFunctionValue(this);
        return;
    case WebKitCSSMixFunctionValueClass:
        delete toWebKitCSSMixFunctionValue(this);
        return;
    case WebKitCSSShaderClass:
        delete static_cast<WebKitCSSShaderValue*>(this);
        return;
#endif
#endif
#if ENABLE(CSS_VARIABLES)
    case VariableClass:
        delete static_cast<CSSVariableValue*>(this);
        return;
#endif
#if ENABLE(SVG)
    case SVGColorClass:
        delete static_cast<SVGColor*>(this);
        return;
    case SVGPaintClass:
        delete static_cast<SVGPaint*>(this);
        return;
    case WebKitCSSSVGDocumentClass:
        delete toWebKitCSSSVGDocumentValue(this);
        return;
#endif
    }
    ASSERT_NOT_REACHED();
}
コード例 #7
0
ファイル: CSSValue.cpp プロジェクト: mirror/chromium
void CSSValue::finalizeGarbageCollectedObject() {
  switch (getClassType()) {
    case BasicShapeCircleClass:
      toCSSBasicShapeCircleValue(this)->~CSSBasicShapeCircleValue();
      return;
    case BasicShapeEllipseClass:
      toCSSBasicShapeEllipseValue(this)->~CSSBasicShapeEllipseValue();
      return;
    case BasicShapePolygonClass:
      toCSSBasicShapePolygonValue(this)->~CSSBasicShapePolygonValue();
      return;
    case BasicShapeInsetClass:
      toCSSBasicShapeInsetValue(this)->~CSSBasicShapeInsetValue();
      return;
    case BorderImageSliceClass:
      toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
      return;
    case ColorClass:
      toCSSColorValue(this)->~CSSColorValue();
      return;
    case CounterClass:
      toCSSCounterValue(this)->~CSSCounterValue();
      return;
    case CursorImageClass:
      toCSSCursorImageValue(this)->~CSSCursorImageValue();
      return;
    case FontFaceSrcClass:
      toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue();
      return;
    case FontFamilyClass:
      toCSSFontFamilyValue(this)->~CSSFontFamilyValue();
      return;
    case FontFeatureClass:
      toCSSFontFeatureValue(this)->~CSSFontFeatureValue();
      return;
    case FunctionClass:
      toCSSFunctionValue(this)->~CSSFunctionValue();
      return;
    case LinearGradientClass:
      toCSSLinearGradientValue(this)->~CSSLinearGradientValue();
      return;
    case RadialGradientClass:
      toCSSRadialGradientValue(this)->~CSSRadialGradientValue();
      return;
    case CrossfadeClass:
      toCSSCrossfadeValue(this)->~CSSCrossfadeValue();
      return;
    case PaintClass:
      toCSSPaintValue(this)->~CSSPaintValue();
      return;
    case CustomIdentClass:
      toCSSCustomIdentValue(this)->~CSSCustomIdentValue();
      return;
    case ImageClass:
      toCSSImageValue(this)->~CSSImageValue();
      return;
    case InheritedClass:
      toCSSInheritedValue(this)->~CSSInheritedValue();
      return;
    case InitialClass:
      toCSSInitialValue(this)->~CSSInitialValue();
      return;
    case UnsetClass:
      toCSSUnsetValue(this)->~CSSUnsetValue();
      return;
    case GridAutoRepeatClass:
      toCSSGridAutoRepeatValue(this)->~CSSGridAutoRepeatValue();
      return;
    case GridLineNamesClass:
      toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
      return;
    case GridTemplateAreasClass:
      toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
      return;
    case PathClass:
      toCSSPathValue(this)->~CSSPathValue();
      return;
    case PrimitiveClass:
      toCSSPrimitiveValue(this)->~CSSPrimitiveValue();
      return;
    case IdentifierClass:
      toCSSIdentifierValue(this)->~CSSIdentifierValue();
      return;
    case QuadClass:
      toCSSQuadValue(this)->~CSSQuadValue();
      return;
    case ReflectClass:
      toCSSReflectValue(this)->~CSSReflectValue();
      return;
    case ShadowClass:
      toCSSShadowValue(this)->~CSSShadowValue();
      return;
    case StringClass:
      toCSSStringValue(this)->~CSSStringValue();
      return;
    case CubicBezierTimingFunctionClass:
      toCSSCubicBezierTimingFunctionValue(this)
          ->~CSSCubicBezierTimingFunctionValue();
      return;
    case StepsTimingFunctionClass:
      toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue();
      return;
    case UnicodeRangeClass:
      toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue();
      return;
    case URIClass:
      toCSSURIValue(this)->~CSSURIValue();
      return;
    case ValueListClass:
      toCSSValueList(this)->~CSSValueList();
      return;
    case ValuePairClass:
      toCSSValuePair(this)->~CSSValuePair();
      return;
    case ImageSetClass:
      toCSSImageSetValue(this)->~CSSImageSetValue();
      return;
    case CSSContentDistributionClass:
      toCSSContentDistributionValue(this)->~CSSContentDistributionValue();
      return;
    case VariableReferenceClass:
      toCSSVariableReferenceValue(this)->~CSSVariableReferenceValue();
      return;
    case CustomPropertyDeclarationClass:
      toCSSCustomPropertyDeclaration(this)->~CSSCustomPropertyDeclaration();
      return;
    case PendingSubstitutionValueClass:
      toCSSPendingSubstitutionValue(this)->~CSSPendingSubstitutionValue();
      return;
  }
  ASSERT_NOT_REACHED();
}
コード例 #8
0
ファイル: CSSValue.cpp プロジェクト: Miaque/mojo
void CSSValue::destroy()
{
    if (m_isTextClone) {
        ASSERT(isCSSOMSafe());
        delete toTextCloneCSSValue(this);
        return;
    }
    ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());

    switch (classType()) {
    case AspectRatioClass:
        delete toCSSAspectRatioValue(this);
        return;
    case BorderImageSliceClass:
        delete toCSSBorderImageSliceValue(this);
        return;
    case FontClass:
        delete toCSSFontValue(this);
        return;
    case FontFaceSrcClass:
        delete toCSSFontFaceSrcValue(this);
        return;
    case FontFeatureClass:
        delete toCSSFontFeatureValue(this);
        return;
    case FunctionClass:
        delete toCSSFunctionValue(this);
        return;
    case LinearGradientClass:
        delete toCSSLinearGradientValue(this);
        return;
    case RadialGradientClass:
        delete toCSSRadialGradientValue(this);
        return;
    case CrossfadeClass:
        delete toCSSCrossfadeValue(this);
        return;
    case ImageClass:
        delete toCSSImageValue(this);
        return;
    case InheritedClass:
        delete toCSSInheritedValue(this);
        return;
    case InitialClass:
        delete toCSSInitialValue(this);
        return;
    case PrimitiveClass:
        delete toCSSPrimitiveValue(this);
        return;
    case ShadowClass:
        delete toCSSShadowValue(this);
        return;
    case CubicBezierTimingFunctionClass:
        delete toCSSCubicBezierTimingFunctionValue(this);
        return;
    case StepsTimingFunctionClass:
        delete toCSSStepsTimingFunctionValue(this);
        return;
    case UnicodeRangeClass:
        delete toCSSUnicodeRangeValue(this);
        return;
    case ValueListClass:
        delete toCSSValueList(this);
        return;
    case CSSTransformClass:
        delete toCSSTransformValue(this);
        return;
    case LineBoxContainClass:
        delete toCSSLineBoxContainValue(this);
        return;
    case CalculationClass:
        delete toCSSCalcValue(this);
        return;
    case ImageSetClass:
        delete toCSSImageSetValue(this);
        return;
    case CSSFilterClass:
        delete toCSSFilterValue(this);
        return;
    }
    ASSERT_NOT_REACHED();
}
コード例 #9
0
ファイル: CSSValue.cpp プロジェクト: dstockwell/blink
void CSSValue::finalizeGarbageCollectedObject()
{
    switch (classType()) {
    case BorderImageSliceClass:
        toCSSBorderImageSliceValue(this)->~CSSBorderImageSliceValue();
        return;
    case CanvasClass:
        toCSSCanvasValue(this)->~CSSCanvasValue();
        return;
    case CounterClass:
        toCSSCounterValue(this)->~CSSCounterValue();
        return;
    case CursorImageClass:
        toCSSCursorImageValue(this)->~CSSCursorImageValue();
        return;
    case FontFaceSrcClass:
        toCSSFontFaceSrcValue(this)->~CSSFontFaceSrcValue();
        return;
    case FontFeatureClass:
        toCSSFontFeatureValue(this)->~CSSFontFeatureValue();
        return;
    case FunctionClass:
        toCSSFunctionValue(this)->~CSSFunctionValue();
        return;
    case LinearGradientClass:
        toCSSLinearGradientValue(this)->~CSSLinearGradientValue();
        return;
    case RadialGradientClass:
        toCSSRadialGradientValue(this)->~CSSRadialGradientValue();
        return;
    case CrossfadeClass:
        toCSSCrossfadeValue(this)->~CSSCrossfadeValue();
        return;
    case ImageClass:
        toCSSImageValue(this)->~CSSImageValue();
        return;
    case InheritedClass:
        toCSSInheritedValue(this)->~CSSInheritedValue();
        return;
    case InitialClass:
        toCSSInitialValue(this)->~CSSInitialValue();
        return;
    case UnsetClass:
        toCSSUnsetValue(this)->~CSSUnsetValue();
        return;
    case GridLineNamesClass:
        toCSSGridLineNamesValue(this)->~CSSGridLineNamesValue();
        return;
    case GridTemplateAreasClass:
        toCSSGridTemplateAreasValue(this)->~CSSGridTemplateAreasValue();
        return;
    case PathClass:
        toCSSPathValue(this)->~CSSPathValue();
        return;
    case PrimitiveClass:
        toCSSPrimitiveValue(this)->~CSSPrimitiveValue();
        return;
    case QuadClass:
        toCSSQuadValue(this)->~CSSQuadValue();
        return;
    case ReflectClass:
        toCSSReflectValue(this)->~CSSReflectValue();
        return;
    case ShadowClass:
        toCSSShadowValue(this)->~CSSShadowValue();
        return;
    case CubicBezierTimingFunctionClass:
        toCSSCubicBezierTimingFunctionValue(this)->~CSSCubicBezierTimingFunctionValue();
        return;
    case StepsTimingFunctionClass:
        toCSSStepsTimingFunctionValue(this)->~CSSStepsTimingFunctionValue();
        return;
    case UnicodeRangeClass:
        toCSSUnicodeRangeValue(this)->~CSSUnicodeRangeValue();
        return;
    case ValueListClass:
        toCSSValueList(this)->~CSSValueList();
        return;
    case ValuePairClass:
        toCSSValuePair(this)->~CSSValuePair();
        return;
    case ImageSetClass:
        toCSSImageSetValue(this)->~CSSImageSetValue();
        return;
    case CSSSVGDocumentClass:
        toCSSSVGDocumentValue(this)->~CSSSVGDocumentValue();
        return;
    case CSSContentDistributionClass:
        toCSSContentDistributionValue(this)->~CSSContentDistributionValue();
        return;
    }
    ASSERT_NOT_REACHED();
}
コード例 #10
0
ファイル: CSSValue.cpp プロジェクト: Happy-Ferret/webkit.js
String CSSValue::cssText() const
{
    if (m_isTextClone) {
         ASSERT(isCSSOMSafe());
        return static_cast<const TextCloneCSSValue*>(this)->cssText();
    }
    ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());

    switch (classType()) {
    case AspectRatioClass:
        return toCSSAspectRatioValue(this)->customCSSText();
    case BorderImageSliceClass:
        return toCSSBorderImageSliceValue(this)->customCSSText();
    case CanvasClass:
        return toCSSCanvasValue(this)->customCSSText();
    case CursorImageClass:
        return toCSSCursorImageValue(this)->customCSSText();
#if ENABLE(CSS_FILTERS)
    case FilterImageClass:
        return toCSSFilterImageValue(this)->customCSSText();
#endif
    case FontClass:
        return toCSSFontValue(this)->customCSSText();
    case FontFaceSrcClass:
        return toCSSFontFaceSrcValue(this)->customCSSText();
    case FontFeatureClass:
        return toCSSFontFeatureValue(this)->customCSSText();
    case FunctionClass:
        return toCSSFunctionValue(this)->customCSSText();
    case LinearGradientClass:
        return toCSSLinearGradientValue(this)->customCSSText();
    case RadialGradientClass:
        return toCSSRadialGradientValue(this)->customCSSText();
    case CrossfadeClass:
        return toCSSCrossfadeValue(this)->customCSSText();
    case ImageClass:
        return toCSSImageValue(this)->customCSSText();
    case InheritedClass:
        return toCSSInheritedValue(this)->customCSSText();
    case InitialClass:
        return toCSSInitialValue(this)->customCSSText();
    case GridTemplateClass:
        return toCSSGridTemplateValue(this)->customCSSText();
    case PrimitiveClass:
        return toCSSPrimitiveValue(this)->customCSSText();
    case ReflectClass:
        return toCSSReflectValue(this)->customCSSText();
    case ShadowClass:
        return toCSSShadowValue(this)->customCSSText();
    case CubicBezierTimingFunctionClass:
        return toCSSCubicBezierTimingFunctionValue(this)->customCSSText();
    case StepsTimingFunctionClass:
        return toCSSStepsTimingFunctionValue(this)->customCSSText();
    case UnicodeRangeClass:
        return toCSSUnicodeRangeValue(this)->customCSSText();
    case ValueListClass:
        return toCSSValueList(this)->customCSSText();
    case WebKitCSSTransformClass:
        return toWebKitCSSTransformValue(this)->customCSSText();
    case LineBoxContainClass:
        return toCSSLineBoxContainValue(this)->customCSSText();
    case CalculationClass:
        return toCSSCalcValue(this)->customCSSText();
#if ENABLE(CSS_IMAGE_SET)
    case ImageSetClass:
        return toCSSImageSetValue(this)->customCSSText();
#endif
#if ENABLE(CSS_FILTERS)
    case WebKitCSSFilterClass:
        return toWebKitCSSFilterValue(this)->customCSSText();
#if ENABLE(CSS_SHADERS)
    case WebKitCSSArrayFunctionValueClass:
        return toWebKitCSSArrayFunctionValue(this)->customCSSText();
    case WebKitCSSMatFunctionValueClass:
        return toWebKitCSSMatFunctionValue(this)->customCSSText();
    case WebKitCSSMixFunctionValueClass:
        return toWebKitCSSMixFunctionValue(this)->customCSSText();
    case WebKitCSSShaderClass:
        return toWebKitCSSShaderValue(this)->customCSSText();
#endif
#endif
#if ENABLE(SVG)
    case SVGColorClass:
        return toSVGColor(this)->customCSSText();
    case SVGPaintClass:
        return toSVGPaint(this)->customCSSText();
    case WebKitCSSSVGDocumentClass:
        return toWebKitCSSSVGDocumentValue(this)->customCSSText();
#endif
    }
    ASSERT_NOT_REACHED();
    return String();
}
コード例 #11
0
ファイル: CSSValue.cpp プロジェクト: dalecurtis/mojo
void CSSValue::trace(Visitor* visitor)
{
    if (m_isTextClone) {
        ASSERT(isCSSOMSafe());
        toTextCloneCSSValue(this)->traceAfterDispatch(visitor);
        return;
    }
    ASSERT(!isCSSOMSafe() || isSubtypeExposedToCSSOM());

    switch (classType()) {
    case AspectRatioClass:
        toCSSAspectRatioValue(this)->traceAfterDispatch(visitor);
        return;
    case BorderImageSliceClass:
        toCSSBorderImageSliceValue(this)->traceAfterDispatch(visitor);
        return;
    case CanvasClass:
        toCSSCanvasValue(this)->traceAfterDispatch(visitor);
        return;
    case CursorImageClass:
        toCSSCursorImageValue(this)->traceAfterDispatch(visitor);
        return;
    case FontClass:
        toCSSFontValue(this)->traceAfterDispatch(visitor);
        return;
    case FontFaceSrcClass:
        toCSSFontFaceSrcValue(this)->traceAfterDispatch(visitor);
        return;
    case FontFeatureClass:
        toCSSFontFeatureValue(this)->traceAfterDispatch(visitor);
        return;
    case FunctionClass:
        toCSSFunctionValue(this)->traceAfterDispatch(visitor);
        return;
    case LinearGradientClass:
        toCSSLinearGradientValue(this)->traceAfterDispatch(visitor);
        return;
    case RadialGradientClass:
        toCSSRadialGradientValue(this)->traceAfterDispatch(visitor);
        return;
    case CrossfadeClass:
        toCSSCrossfadeValue(this)->traceAfterDispatch(visitor);
        return;
    case ImageClass:
        toCSSImageValue(this)->traceAfterDispatch(visitor);
        return;
    case InheritedClass:
        toCSSInheritedValue(this)->traceAfterDispatch(visitor);
        return;
    case InitialClass:
        toCSSInitialValue(this)->traceAfterDispatch(visitor);
        return;
    case GridLineNamesClass:
        toCSSGridLineNamesValue(this)->traceAfterDispatch(visitor);
        return;
    case GridTemplateAreasClass:
        toCSSGridTemplateAreasValue(this)->traceAfterDispatch(visitor);
        return;
    case PrimitiveClass:
        toCSSPrimitiveValue(this)->traceAfterDispatch(visitor);
        return;
    case ShadowClass:
        toCSSShadowValue(this)->traceAfterDispatch(visitor);
        return;
    case CubicBezierTimingFunctionClass:
        toCSSCubicBezierTimingFunctionValue(this)->traceAfterDispatch(visitor);
        return;
    case StepsTimingFunctionClass:
        toCSSStepsTimingFunctionValue(this)->traceAfterDispatch(visitor);
        return;
    case UnicodeRangeClass:
        toCSSUnicodeRangeValue(this)->traceAfterDispatch(visitor);
        return;
    case ValueListClass:
        toCSSValueList(this)->traceAfterDispatch(visitor);
        return;
    case CSSTransformClass:
        toCSSTransformValue(this)->traceAfterDispatch(visitor);
        return;
    case LineBoxContainClass:
        toCSSLineBoxContainValue(this)->traceAfterDispatch(visitor);
        return;
    case CalculationClass:
        toCSSCalcValue(this)->traceAfterDispatch(visitor);
        return;
    case ImageSetClass:
        toCSSImageSetValue(this)->traceAfterDispatch(visitor);
        return;
    case CSSFilterClass:
        toCSSFilterValue(this)->traceAfterDispatch(visitor);
        return;
    }
    ASSERT_NOT_REACHED();
}
コード例 #12
0
void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& state, CSSValue* value)
{
    // list of string, uri, counter, attr, i

    bool didSet = false;
    for (auto& item : toCSSValueList(*value)) {
        if (item->isImageGeneratorValue()) {
            state.style()->setContent(StyleGeneratedImage::create(toCSSImageGeneratorValue(item.get())), didSet);
            didSet = true;
        } else if (item->isImageSetValue()) {
            state.style()->setContent(state.elementStyleResources().setOrPendingFromValue(CSSPropertyContent, toCSSImageSetValue(item.get())), didSet);
            didSet = true;
        }

        if (item->isImageValue()) {
            state.style()->setContent(state.elementStyleResources().cachedOrPendingFromValue(state.document(), CSSPropertyContent, toCSSImageValue(item.get())), didSet);
            didSet = true;
            continue;
        }

        if (item->isCounterValue()) {
            CSSCounterValue* counterValue = toCSSCounterValue(item.get());
            EListStyleType listStyleType = NoneListStyle;
            CSSValueID listStyleIdent = counterValue->listStyle();
            if (listStyleIdent != CSSValueNone)
                listStyleType = static_cast<EListStyleType>(listStyleIdent - CSSValueDisc);
            OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(AtomicString(counterValue->identifier()), listStyleType, AtomicString(counterValue->separator())));
            state.style()->setContent(counter.release(), didSet);
            didSet = true;
        }

        if (item->isFunctionValue()) {
            CSSFunctionValue* functionValue = toCSSFunctionValue(item.get());
            ASSERT(functionValue->functionType() == CSSValueAttr);
            // FIXME: Can a namespace be specified for an attr(foo)?
            if (state.style()->styleType() == NOPSEUDO)
                state.style()->setUnique();
            else
                state.parentStyle()->setUnique();
            QualifiedName attr(nullAtom, AtomicString(toCSSPrimitiveValue(functionValue->item(0))->getStringValue()), nullAtom);
            const AtomicString& value = state.element()->getAttribute(attr);
            state.style()->setContent(value.isNull() ? emptyString() : value.string(), didSet);
            didSet = true;
        }

        if (!item->isPrimitiveValue())
            continue;

        CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get());

        if (contentValue->isString()) {
            state.style()->setContent(contentValue->getStringValue().impl(), didSet);
            didSet = true;
        } else {
            switch (contentValue->getValueID()) {
            case CSSValueOpenQuote:
                state.style()->setContent(OPEN_QUOTE, didSet);
                didSet = true;
                break;
            case CSSValueCloseQuote:
                state.style()->setContent(CLOSE_QUOTE, didSet);
                didSet = true;
                break;
            case CSSValueNoOpenQuote:
                state.style()->setContent(NO_OPEN_QUOTE, didSet);
                didSet = true;
                break;
            case CSSValueNoCloseQuote:
                state.style()->setContent(NO_CLOSE_QUOTE, didSet);
                didSet = true;
                break;
            default:
                // normal and none do not have any effect.
                { }
            }
        }
    }
    if (!didSet)
        state.style()->clearContent();
}