From kde-commits Wed Aug 06 23:10:37 2008 From: Maks Orlovich Date: Wed, 06 Aug 2008 23:10:37 +0000 To: kde-commits Subject: branches/KDE/4.1/kdelibs/khtml/css Message-Id: <1218064237.032181.25407.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121806425119078 SVN commit 843320 by orlovich: Proper parsing and RenderStyle construction for clip:rect(.. auto ...). RenderBox part still needs fixing, but lets get this into SVN so I don't lose it. CCBUG:166830 M +10 -5 cssparser.cpp M +12 -4 cssstyleselector.cpp --- branches/KDE/4.1/kdelibs/khtml/css/cssparser.cpp #843319:843320 @@ -1743,11 +1743,16 @@ int i = 0; Value *a = args->current(); while ( a ) { - valid = validUnit( a, FLength, strict ); - if ( !valid ) - break; - CSSPrimitiveValueImpl *length = - new CSSPrimitiveValueImpl( a->fValue, (CSSPrimitiveValue::UnitTypes) a->unit ); + CSSPrimitiveValueImpl *length; + if ( a->id == CSS_VAL_AUTO ) { + length = new CSSPrimitiveValueImpl( CSS_VAL_AUTO ); + } else { + valid = validUnit( a, FLength, strict ); + if ( !valid ) + break; + length = new CSSPrimitiveValueImpl( a->fValue, (CSSPrimitiveValue::UnitTypes) a->unit ); + } + if ( i == 0 ) rect->setTop( length ); else if ( i == 1 ) --- branches/KDE/4.1/kdelibs/khtml/css/cssstyleselector.cpp #843319:843320 @@ -3322,10 +3322,18 @@ RectImpl *rect = primitiveValue->getRectValue(); if (rect) { hasClip = true; - top = convertToLength( rect->top(), style, logicalDpiY ); - right = convertToLength( rect->right(), style, logicalDpiY ); - bottom = convertToLength( rect->bottom(), style, logicalDpiY ); - left = convertToLength( rect->left(), style, logicalDpiY ); + // As a convention, we pass in auto as Length(Variable). See RenderBox::clipRect + top = rect->top()->getIdent() == CSS_VAL_AUTO ? Length(Variable) + : convertToLength( rect->top(), style, logicalDpiY ); + + right = rect->right()->getIdent() == CSS_VAL_AUTO ? Length(Variable) + : convertToLength( rect->right(), style, logicalDpiY ); + + bottom = rect->bottom()->getIdent() == CSS_VAL_AUTO ? Length(Variable) + : convertToLength( rect->bottom(), style, logicalDpiY ); + + left = rect->left()->getIdent() == CSS_VAL_AUTO ? Length(Variable) + : convertToLength( rect->left(), style, logicalDpiY ); } }