CSSValue CSSStyleDeclaration::getPropertyCSSValue( const DOMString &propertyName ) { if(!impl) return 0; int id = getPropertyID(propertyName.string().ascii(), propertyName.length()); if (!id) return 0; return static_cast<CSSStyleDeclarationImpl *>(impl)->getPropertyCSSValue(id); }
DOMString CSSStyleDeclaration::removeProperty(const DOMString &property) { int id = getPropertyID(property.string().ascii(), property.length()); if(!impl || !id) return DOMString(); return static_cast< CSSStyleDeclarationImpl * >(impl)->removeProperty(id); }
DOMString CSSStyleDeclaration::getPropertyPriority( const DOMString &propertyName ) { int id = getPropertyID(propertyName.string().ascii(), propertyName.length()); if(!impl || !id) return DOMString(); if (impl->getPropertyPriority(id)) return DOMString("important"); return DOMString(); }
/** * Retrieves the value of the property given by path. The path syntax is must be something like (here expressed as regex) * (container)*(property), where container is a slash and the name of a container class (e.g. layers, figures) and * property is the name of a simple property of that container. * * @param name The name of the property. * @param index If the property is a list then this is the index into that list. * @return A description of the property value and, if the property is simple, the actual value. */ TGCVariant CGenericCanvas::propertyGet(const char* name, unsigned int index) { // TODO: check if all properties are properly handled. TGCVariant result; switch (getContainerID(name)) { case GC_CONTAINER_UNKNOWN: { switch (getPropertyID(name)) { case GC_PROPERTY_NAME: { result = utf16ToUtf8(FName); break; }; case GC_PROPERTY_DESCRIPTION: { result = "A generic 2D canvas based on OpenGL."; break; }; case GC_PROPERTY_OWNER: { // There is no owner for the canvas in the canvas library itself. // However we recognize the request for it by returning NULL // instead of "unknown property". result = 0; break; }; }; break; }; case GC_CONTAINER_LAYERS: { if (index < FLayers.size()) result = FLayers[index]; break; }; case GC_CONTAINER_VIEWS: { if (index < FViews.size()) result = FViews[index]; break; }; case GC_CONTAINER_MODEL: { result = FModel; break; }; }; return result; }
/** * Set the value of the given property, which must be a simple property. * * @param name The name of the property. * @param index If the property is a list then this is the index into that list. * @param value The new value of the property. Automatic conversion is performed where possible. */ void CGenericCanvas::propertySet(const char* name, unsigned int index, TGCVariant value) { switch (getPropertyID(name)) { case GC_PROPERTY_NAME: { FName = utf8ToUtf16(value); break; }; }; }
void CSSStyleDeclaration::setProperty( const DOMString &propName, const DOMString &value, const DOMString &priority ) { if(!impl) return; int id = getPropertyID(propName.string().lower().ascii(), propName.length()); if (!id) return; bool important = false; QString str = priority.string(); if (str.find("important", 0, false) != -1) important = true; static_cast<CSSStyleDeclarationImpl *>(impl)->setProperty( id, value, important ); }