JSValue* jsCSSPrimitiveValuePrototypeFunctionGetRectValue(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) { if (!thisValue->isObject(&JSCSSPrimitiveValue::s_info)) return throwError(exec, TypeError); JSCSSPrimitiveValue* castedThisObj = static_cast<JSCSSPrimitiveValue*>(thisValue); CSSPrimitiveValue* imp = static_cast<CSSPrimitiveValue*>(castedThisObj->impl()); ExceptionCode ec = 0; KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getRectValue(ec))); setDOMException(exec, ec); return result; }
static v8::Handle<v8::Value> getRectValueCallback(const v8::Arguments& args) { CSSPrimitiveValue* imp = V8CSSPrimitiveValue::toNative(args.Holder()); ExceptionCode ec = 0; { RefPtr<Rect> result = imp->getRectValue(ec); if (UNLIKELY(ec)) goto fail; return toV8(result.release(), args.Holder(), args.GetIsolate()); } fail: return setDOMException(ec, args.GetIsolate()); }
JSValue JSC_HOST_CALL jsCSSPrimitiveValuePrototypeFunctionGetRectValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { UNUSED_PARAM(args); if (!thisValue.inherits(&JSCSSPrimitiveValue::s_info)) return throwError(exec, TypeError); JSCSSPrimitiveValue* castedThisObj = static_cast<JSCSSPrimitiveValue*>(asObject(thisValue)); CSSPrimitiveValue* imp = static_cast<CSSPrimitiveValue*>(castedThisObj->impl()); ExceptionCode ec = 0; JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getRectValue(ec))); setDOMException(exec, ec); return result; }
bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const CSSPrimitiveValue& primitiveValue) { // FIXME: consider other types. if (primitiveValue.isNumber() || primitiveValue.isPercentage() || primitiveValue.isAngle() || primitiveValue.isRGBColor() || primitiveValue.isURI()) return false; if (primitiveValue.isLength()) return primitiveValue.isFontRelativeLength() || primitiveValue.isViewportPercentageLength(); if (primitiveValue.isCalculated()) { CSSLengthArray lengthArray(CSSPrimitiveValue::LengthUnitTypeCount); primitiveValue.accumulateLengthArray(lengthArray); return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMin] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportMax] != 0; } if (Pair* pair = primitiveValue.getPairValue()) { return interpolationRequiresStyleResolve(*pair->first()) || interpolationRequiresStyleResolve(*pair->second()); } if (Rect* rect = primitiveValue.getRectValue()) { return interpolationRequiresStyleResolve(*rect->top()) || interpolationRequiresStyleResolve(*rect->right()) || interpolationRequiresStyleResolve(*rect->bottom()) || interpolationRequiresStyleResolve(*rect->left()); } if (Quad* quad = primitiveValue.getQuadValue()) { return interpolationRequiresStyleResolve(*quad->top()) || interpolationRequiresStyleResolve(*quad->right()) || interpolationRequiresStyleResolve(*quad->bottom()) || interpolationRequiresStyleResolve(*quad->left()); } if (primitiveValue.isShape()) return interpolationRequiresStyleResolve(*primitiveValue.getShapeValue()); CSSValueID id = primitiveValue.getValueID(); bool isColor = ((id >= CSSValueAqua && id <= CSSValueTransparent) || (id >= CSSValueAliceblue && id <= CSSValueYellowgreen) || id == CSSValueGrey); return (id != CSSValueNone) && !isColor; }
static v8::Handle<v8::Value> getRectValueCallback(const v8::Arguments& args) { INC_STATS("DOM.CSSPrimitiveValue.getRectValue"); CSSPrimitiveValue* imp = V8CSSPrimitiveValue::toNative(args.Holder()); ExceptionCode ec = 0; { RefPtr<Rect> result = imp->getRectValue(ec); if (UNLIKELY(ec)) goto fail; return toV8(result.release()); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }