some fixes you might want in Safari and two questions
Lars Knoll
lars at trolltech.com
Fri Apr 18 11:24:36 CEST 2003
On Fri, 18 Apr 2003, Dirk Mueller wrote:
> On Don, 17 Apr 2003, Darin Adler wrote:
>
> > (forums.macnn.com) that had a table with a width of width="90%%". We
> > didn't do the best solution we could think of because it was so close
> > to our deadline. One possibility Dave favored was to parse HTML widths
> > separately as we do for colors rather than using the CSS parser.
>
> Deja vu.. We had a "parseLength" method with the old CSS parser that dealt
> with those HTML problems.. you have to ignore a whole bunch of crap, some
> sites use width="100%px" and other stuff.
>
> I don't see right now where this code went .. it seems like it was
> simply removed during the parser rewrite. Lars?
HTMLElementImpl::addCSSLength() is still there if that's what you mean.
Looking at the function, it seems to me that the stripping code is not
perfect. It will successfully strip away the px in 100%px, but will leave
the second % in 100%%. So that's where the bug really is. The (untested)
patch below should fix this.
Lars
diff -u -b -p -r1.162 html_elementimpl.cpp
--- html_elementimpl.cpp 13 Apr 2003 20:54:32 -0000 1.162
+++ html_elementimpl.cpp 18 Apr 2003 08:22:07 -0000
@@ -266,8 +266,12 @@ void HTMLElementImpl::addCSSLength(int i
for ( ;l < v->l; l++ ) {
char cc = v->s[l].latin1();
- if ( cc > '9' || ( cc < '0' && ( numOnly || (cc != '%' && cc
!= '.' &&
- !( multiLength &&
cc == '*') ) ) ) )
+ if (!numOnly && (cc == '%' || cc != '.' ||
+ (multiLength && cc == '*') ) ) {
+ ++l;
+ break;
+ }
+ if ( cc > '9' || cc < '0' )
break;
}
if ( l != v->l ) {
More information about the Khtml-devel
mailing list