RESOLVED FIXED 9284
Quirksmode (CSS1): Removing inline border styles is impossible
https://bugs.webkit.org/show_bug.cgi?id=9284
Summary Quirksmode (CSS1): Removing inline border styles is impossible
Adele Peterson
Reported 2006-06-02 15:14:45 PDT
http://www.quirksmode.org/bugreports/archives/safari/index.html "Setting an inline border style (element.style.border) works in all browsers. Removing it to allow the normal border styles to return, however, is tricky in Explorer Windows and impossible in Safari. Test page. http://www.quirksmode.org/js/tests/bordertest.html Workaround is included. Reported by ppk."
Attachments
Expand shorthands for removal (8.12 KB, patch)
2007-01-07 12:32 PST, mitz
darin: review-
Expand shorthands for removal (37.69 KB, patch)
2007-01-08 11:28 PST, mitz
darin: review+
Joost de Valk (AlthA)
Comment 1 2006-06-24 14:21:07 PDT
CHanging component.
mitz
Comment 2 2006-12-16 13:25:42 PST
*** Bug 9927 has been marked as a duplicate of this bug. ***
mitz
Comment 3 2006-12-16 13:27:55 PST
Priority and CSS1 copied over from bug 9927.
mitz
Comment 4 2007-01-07 12:32:06 PST
Created attachment 12285 [details] Expand shorthands for removal Please let me know if this is going in the right direction. Not sure about using a HashMap - perhaps a simple array indexed by property ID would be better.
Dave Hyatt
Comment 5 2007-01-07 15:18:04 PST
Yeah, this is great. What about "border" though? I see expansions for border-top/left/right/bottom but not for border. I assume it will be recursive and will expand border into border-top/left/right/bottom and then from there into top-width/color/style, etc.
mitz
Comment 6 2007-01-07 15:31:23 PST
(In reply to comment #5) > Yeah, this is great. What about "border" though? I see expansions for > border-top/left/right/bottom but not for border. Hiding here (I wanted to reuse the first 4 arrays): + shorthandMap->set(CSS_PROP_BORDER, new PropertyLonghand(borderTopProperties, (sizeof(borderTopProperties) + sizeof(borderRightProperties) + sizeof(borderBottomProperties) + sizeof(borderLeftProperties)) / sizeof(borderTopProperties[0]))); > I assume it will be recursive > and will expand border into border-top/left/right/bottom and then from there > into top-width/color/style, etc. Given that border is the only 2-level (and 2-way) "hierarchy", I figured it would be an overkill to implement it with recursion. >
Darin Adler
Comment 7 2007-01-07 21:19:05 PST
Comment on attachment 12285 [details] Expand shorthands for removal +struct PropertyLonghand +{ We should put the brace on the line iwth the struct name. +static HashMap<int, PropertyLonghand* >* shorthandMap; I don't think the space before the > is needed here. I think the values should be PropertyLonghand, no need for pointers. The shortHandMap could be a static inside the CSSMutableStyleDeclaration::removeProperty function -- I think I like that slightly better. It would be nice if the function that turns a propertyID into a pointer to a list of property IDs and a length was put with the other shorthand handling rather than right here in CSSMutableStyleDeclaration -- CSSMutableStyleDeclaration could just call a function defined there. That might make it easier to keep the list of shorthands in sync with the other lists of shorthands. Should I mark this review- now, or do you want other people to look at it?
Darin Adler
Comment 8 2007-01-07 22:27:40 PST
Comment on attachment 12285 [details] Expand shorthands for removal > Hiding here (I wanted to reuse the first 4 arrays): > + shorthandMap->set(CSS_PROP_BORDER, new PropertyLonghand(borderTopProperties, (sizeof(borderTopProperties) + sizeof(borderRightProperties) + sizeof(borderBottomProperties) > + sizeof(borderLeftProperties)) / sizeof(borderTopProperties[0]))); That technique is not reliable. It relies on the four arrays being consecutive in global data, something that is not guaranteed by the C++ language.
mitz
Comment 9 2007-01-08 11:28:53 PST
Created attachment 12303 [details] Expand shorthands for removal (In reply to comment #7) > +struct PropertyLonghand > +{ > > We should put the brace on the line iwth the struct name. Done. > +static HashMap<int, PropertyLonghand* >* shorthandMap; > > I don't think the space before the > is needed here. I think the values should > be PropertyLonghand, no need for pointers. Done. > The shortHandMap could be a static inside the > CSSMutableStyleDeclaration::removeProperty function -- I think I like that > slightly better. Done. > It would be nice if the function that turns a propertyID into a pointer to a > list of property IDs and a length was put with the other shorthand handling > rather than right here in CSSMutableStyleDeclaration -- > CSSMutableStyleDeclaration could just call a function defined there. That might > make it easier to keep the list of shorthands in sync with the other lists of > shorthands. Agreed, but I think that can (and should) be a part of bug 12159. > That technique is not reliable. It relies on the four arrays being consecutive > in global data, something that is not guaranteed by the C++ language. Fixed. I also updated the set of properties in this patch to be exactly those properties that are parsed as shorthands. Interestingly enough (for me) the list doesn't include 'font', '-webkit-border-radius' and 'overflow'. Added change log and a test.
Darin Adler
Comment 10 2007-01-10 11:52:52 PST
Comment on attachment 12303 [details] Expand shorthands for removal r=me
Mark Rowe (bdash)
Comment 11 2007-01-10 18:03:49 PST
Landed in r18753.
Note You need to log in before you can comment on or make changes to this bug.