Closed Bug 224164 Opened 21 years ago Closed 21 years ago

inCSSValueSearch shouldn't use internal APIs

Categories

(Other Applications :: DOM Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Whiteboard: [patch])

Attachments

(1 file, 1 obsolete file)

inCSSValueSearch shouldn't use internal APIs.  This causes pain such as the
bustage from bug 167262's codesize reduction checkin and the existence of
nsICSSStyleRule::GetValue and the things it calls.  I have a preliminary patch
(untested), but it needs some work in inCSSValueSearch::SearchStyleValue.
Attachment #134464 - Flags: review?(caillon)
Attached patch patchSplinter Review
This should be equivalent to the old code.
Attachment #134464 - Attachment is obsolete: true
> caillon, how do I test this code? 

You probably don't.  This looks like another of hewitt's unfinished pieces...
Comment on attachment 137807 [details] [diff] [review]
patch

In that case, I think I'd like to just get it reviewed, then, since I'd rather
not have to go through more pain because this code is depending on unstable
APIs...
Attachment #137807 - Flags: review?(caillon)
Comment on attachment 137807 [details] [diff] [review]
patch

>-  if (value.GetUnit() == eCSSUnit_URL) {
>+  if (StringBeginsWith(aValue, NS_LITERAL_STRING("url(")) &&
>+      StringEndsWith(aValue, NS_LITERAL_STRING(")"))) {

I tried thinking of a way to use nsIDOMCSSPrimitiveValue::CSS_URL, but there
really isn't one without knowledge of the css parser (in more places).	Oh,
well.

r=caillon
Attachment #137807 - Flags: review?(caillon) → review+
Attachment #137807 - Flags: superreview?(bz-vacation)
Comment on attachment 137807 [details] [diff] [review]
patch

>Index: inCSSValueSearch.cpp

>+inCSSValueSearch::SearchStyleSheet(nsIDOMCSSStyleSheet* aStyleSheet, nsIURI* aBaseURL)

>+  if (aStyleSheet) {

Just return early if that's null, maybe?

>+      NS_NewURI(getter_AddRefs(baseURL), NS_ConvertUTF16toUTF8(href),
>+                nsnull, aBaseURL);

drop the NS_ConvertUTF16toUTF8 -- nsNetUtil has a NS_NewURI that takes an
nsAString.   It'll compile to the same code if it gets inlined like it's
supposed to, but will be more readable...

>+inCSSValueSearch::SearchStyleRule(nsIDOMCSSStyleRule* aStyleRule, nsIURI* 

>+    decl->GetPropertyValue(property, value);

This could use an XXX comment saying that GetPropertyCSSValue is what we really
want here... once we implement it.

sr=bzbarsky with that.
Attachment #137807 - Flags: superreview?(bz-vacation) → superreview+
Fix checked in to trunk, 2003-12-29 11:05 -0800.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: Core → Other Applications
QA Contact: timeless → dom-inspector
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: