Thank you Boris.
i tried getComputedStyle in C++ for each node of the DOM.
i'm surprised, i never get the background images (wich are declared in a css
style rule for "DIV" tags) nor the background color.
Here is my sample code:
"nsAutoString empty;
nsCOMPtr<nsIDOMCSSStyleDeclaration> computedStyle;
aDefaultCSSView->GetComputedStyle(aDomElement,
empty,getter_AddRefs(computedStyle));
nsCOMPtr<nsIDOMCSSValue> aCssValue;
computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-image"),get
ter_AddRefs(aCssValue));
primitiveValue = do_QueryInterface(aCssValue);
if (primitiveValue) {
primitiveValue->GetStringValue(bgStringValue);
if (!bgStringValue.Equals(NS_LITERAL_STRING("none"))) {
nsCOMPtr<nsIURI> bgUri;
NS_NewURI(getter_AddRefs(bgUri), bgStringValue);
}else {
// ALWAYS NONE !!!
}
}
//non-transparent background-color
computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-color"),get
ter_AddRefs(aCssValue));
primitiveValue = do_QueryInterface(aCssValue);
if (primitiveValue) {
primitiveValue->GetStringValue(bgStringValue);
if (bgStringValue.Equals(NS_LITERAL_STRING("transparent"))) {
//ALWAYS TRANSPARENT !!
}
}
Am i missing something ? is there any inheritance somewhere ?
Thanks.
--
B�atrice Philippe
[EMAIL PROTECTED]
"Boris Zbarsky" <[EMAIL PROTECTED]> a �crit dans le message de
news:[EMAIL PROTECTED]
B�atrice Philippe wrote:
> Hello !
> i'm currently working on frames (nsiframe objects) and i'm interrested in
> computed style for each textFrame
> (font, css , image background, colors ...).
> I found the nsComputedDOMStyle class but i don't know how to use it.
document.defaultView.getComputedStyle(....)
See
http://w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-ViewCSS
-Boris
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding