Changeset 96471 in webkit
- Timestamp:
- Oct 2, 2011, 1:25:34 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96470 r96471 1 2011-10-02 Dan Bernstein <mitz@apple.com> 2 3 REGRESSION (r95502): Assertion failure in CSSPrimitiveValue::computeLengthDouble() when media query specifies unit-less length 4 https://bugs.webkit.org/show_bug.cgi?id=68760 5 6 Reviewed by Antti Koivisto. 7 8 * fast/media/invalid-lengths-expected.txt: Added. 9 * fast/media/invalid-lengths.html: Added. 10 1 11 2011-10-02 Dirk Schulze <krit@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r96470 r96471 1 2011-10-02 Dan Bernstein <mitz@apple.com> 2 3 REGRESSION (r95502): Assertion failure in CSSPrimitiveValue::computeLengthDouble() when media query specifies unit-less length 4 https://bugs.webkit.org/show_bug.cgi?id=68760 5 6 Reviewed by Antti Koivisto. 7 8 Test: fast/media/invalid-lengths.html 9 10 Made length-comparison media queries accept only length values. In compatibility mode, numbers 11 are allowed as well, and they are interpreted as pixels. 12 13 * css/MediaQueryEvaluator.cpp: 14 (WebCore::computeLength): Added this helper function. 15 (WebCore::device_heightMediaFeatureEval): Changed to use computeLength(). 16 (WebCore::device_widthMediaFeatureEval): Ditto. 17 (WebCore::heightMediaFeatureEval): Ditto. 18 (WebCore::widthMediaFeatureEval): Ditto. 19 1 20 2011-10-02 Dirk Schulze <krit@webkit.org> 2 21 -
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
r93303 r96471 307 307 } 308 308 309 static bool computeLength(CSSValue* value, bool strict, RenderStyle* style, RenderStyle* rootStyle, int& result) 310 { 311 if (!value->isPrimitiveValue()) 312 return false; 313 314 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 315 316 if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_NUMBER) { 317 result = primitiveValue->getIntValue(); 318 return !strict || !result; 319 } 320 321 if (primitiveValue->isLength()) { 322 result = primitiveValue->computeLength<int>(style, rootStyle); 323 return true; 324 } 325 326 return false; 327 } 328 309 329 static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op) 310 330 { … … 312 332 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); 313 333 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 314 return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.height()), static_cast<CSSPrimitiveValue*>(value)->computeLength<int>(style, rootStyle), op); 334 int length; 335 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(sg.height()), length, op); 315 336 } 316 337 // ({,min-,max-}device-height) … … 324 345 FloatRect sg = screenRect(frame->page()->mainFrame()->view()); 325 346 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 326 return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.width()), static_cast<CSSPrimitiveValue*>(value)->computeLength<int>(style, rootStyle), op); 347 int length; 348 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(static_cast<int>(sg.width()), length, op); 327 349 } 328 350 // ({,min-,max-}device-width) … … 334 356 { 335 357 FrameView* view = frame->view(); 336 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 337 338 if (value) 339 return value->isPrimitiveValue() && compareValue(view->layoutHeight(), static_cast<CSSPrimitiveValue*>(value)->computeLength<int>(style, rootStyle), op); 358 359 if (value) { 360 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 361 int length; 362 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutHeight(), length, op); 363 } 340 364 341 365 return view->layoutHeight() != 0; … … 345 369 { 346 370 FrameView* view = frame->view(); 347 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 348 349 if (value) 350 return value->isPrimitiveValue() && compareValue(view->layoutWidth(), static_cast<CSSPrimitiveValue*>(value)->computeLength<int>(style, rootStyle), op); 371 372 if (value) { 373 RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); 374 int length; 375 return computeLength(value, !frame->document()->inQuirksMode(), style, rootStyle, length) && compareValue(view->layoutWidth(), length, op); 376 } 351 377 352 378 return view->layoutWidth() != 0;
Note:
See TracChangeset
for help on using the changeset viewer.