Changeset 138332 in webkit
- Timestamp:
- Dec 20, 2012, 5:52:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r138330 r138332 1 2012-12-20 KyungTae Kim <ktf.kim@samsung.com> 2 3 Percentage min/max width replaced element may incorrectly rendered 4 https://bugs.webkit.org/show_bug.cgi?id=105264 5 6 Reviewed by Tony Chang. 7 8 Add test to check when the source of images with percentage min-width is changed. 9 10 * fast/css/percent-min-width-img-src-change-expected.txt: Added. 11 * fast/css/percent-min-width-img-src-change.html: Added. 12 1 13 2012-12-20 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r138328 r138332 1 2012-12-20 KyungTae Kim <ktf.kim@samsung.com> 2 3 Percentage min/max width replaced element may incorrectly rendered 4 https://bugs.webkit.org/show_bug.cgi?id=105264 5 6 Reviewed by Tony Chang. 7 8 To make do not include percentage min width in preferred logical width calculation, 9 because we cannot resolve it for preferred width. 10 11 Test: fast/css/percent-min-width-img-src-change.html 12 13 * rendering/RenderBox.cpp: 14 (WebCore::RenderBox::computeReplacedLogicalWidth): 15 Modify includeMaxWidth parameter to shouldComputePreferred. 16 (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): 17 Modify includeMaxWidth parameter to shouldComputePreferred. 18 If shouldComputePreferred is ComputePreferred, 19 don't use minLogicalWidth or maxLogicalWidth if they are percent type. 20 * rendering/RenderBox.h: 21 (RenderBox): 22 * rendering/RenderReplaced.cpp: 23 (WebCore::RenderReplaced::computeReplacedLogicalWidth): 24 Modify includeMaxWidth parameter to shouldComputePreferred. 25 (WebCore::RenderReplaced::computeMaxPreferredLogicalWidth): 26 Modify from set includeMaxWidth=false to set shouldComputePreferred=ComputePreferred. 27 * rendering/RenderReplaced.h: 28 (RenderReplaced): 29 * rendering/RenderSVGRoot.cpp: 30 (WebCore::RenderSVGRoot::computeReplacedLogicalWidth): 31 Modify includeMaxWidth parameter to shouldComputePreferred. 32 * rendering/RenderSVGRoot.h: 33 (RenderSVGRoot): 34 * rendering/RenderVideo.cpp: 35 (WebCore::RenderVideo::computeReplacedLogicalWidth): 36 Modify includeMaxWidth parameter to shouldComputePreferred. 37 * rendering/RenderVideo.h: 38 (RenderVideo): 39 1 40 2012-12-20 Alexey Proskuryakov <ap@apple.com> 2 41 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r138317 r138332 2416 2416 } 2417 2417 2418 LayoutUnit RenderBox::computeReplacedLogicalWidth( bool includeMaxWidth) const2419 { 2420 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), includeMaxWidth);2421 } 2422 2423 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth) const2424 { 2425 LayoutUnit minLogicalWidth = computeReplacedLogicalWidthUsing(MinSize, style()->logicalMinWidth());2426 LayoutUnit maxLogicalWidth = !includeMaxWidth|| style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth());2418 LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 2419 { 2420 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferred); 2421 } 2422 2423 LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred shouldComputePreferred) const 2424 { 2425 LayoutUnit minLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMinWidth().isPercent()) || style()->logicalMinWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MinSize, style()->logicalMinWidth()); 2426 LayoutUnit maxLogicalWidth = (shouldComputePreferred == ComputePreferred && style()->logicalMaxWidth().isPercent()) || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(MaxSize, style()->logicalMaxWidth()); 2427 2427 return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth)); 2428 2428 } -
trunk/Source/WebCore/rendering/RenderBox.h
r137930 r138332 41 41 enum OverlayScrollbarSizeRelevancy { IgnoreOverlayScrollbarSize, IncludeOverlayScrollbarSize }; 42 42 43 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; 44 43 45 class RenderBox : public RenderBoxModelObject { 44 46 public: … … 415 417 LayoutUnit computeContentAndScrollbarLogicalHeightUsing(SizeType, const Length& height) const; 416 418 LayoutUnit computeReplacedLogicalWidthUsing(SizeType, Length width) const; 417 LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const;419 LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, ShouldComputePreferred = ComputeActual) const; 418 420 LayoutUnit computeReplacedLogicalHeightUsing(SizeType, Length height) const; 419 421 LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const; 420 422 421 virtual LayoutUnit computeReplacedLogicalWidth( bool includeMaxWidth = true) const;423 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const; 422 424 virtual LayoutUnit computeReplacedLogicalHeight() const; 423 425 -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r137169 r138332 338 338 } 339 339 340 LayoutUnit RenderReplaced::computeReplacedLogicalWidth( bool includeMaxWidth) const340 LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 341 341 { 342 342 if (style()->logicalWidth().isSpecified()) 343 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), includeMaxWidth);343 return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(MainOrPreferredSize, style()->logicalWidth()), shouldComputePreferred); 344 344 345 345 RenderBox* contentRenderer = embeddedContentBox(); … … 357 357 // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. 358 358 if (heightIsAuto && hasIntrinsicWidth) 359 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedSize.width(), includeMaxWidth);359 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedSize.width(), shouldComputePreferred); 360 360 361 361 bool hasIntrinsicHeight = !isPercentageIntrinsicSize && constrainedSize.height() > 0; … … 366 366 if (intrinsicRatio && ((heightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !heightIsAuto)) { 367 367 LayoutUnit logicalHeight = computeReplacedLogicalHeight(); 368 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)) );368 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); 369 369 } 370 370 … … 377 377 LayoutUnit logicalWidth; 378 378 if (RenderBlock* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) 379 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth->style()->logicalWidth()), false);379 logicalWidth = blockWithWidth->computeReplacedLogicalWidthRespectingMinMaxWidth(blockWithWidth->computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth->style()->logicalWidth()), shouldComputePreferred); 380 380 else 381 381 logicalWidth = containingBlock()->availableLogicalWidth(); … … 387 387 if (isPercentageIntrinsicSize) 388 388 logicalWidth = logicalWidth * constrainedSize.width() / 100; 389 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, includeMaxWidth);389 return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred); 390 390 } 391 391 } … … 393 393 // Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'. 394 394 if (hasIntrinsicWidth) 395 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedSize.width(), includeMaxWidth);395 return computeReplacedLogicalWidthRespectingMinMaxWidth(constrainedSize.width(), shouldComputePreferred); 396 396 397 397 // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too … … 402 402 } 403 403 404 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), includeMaxWidth);404 return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), shouldComputePreferred); 405 405 } 406 406 … … 449 449 return intrinsicLogicalWidth(); 450 450 451 // FIXME: We shouldn't be calling a logical width computing function in preferred 452 // logical widths computation as the layout information is probably invalid. 453 return computeReplacedLogicalWidth(false); 451 return computeReplacedLogicalWidth(ComputePreferred); 454 452 } 455 453 -
trunk/Source/WebCore/rendering/RenderReplaced.h
r137169 r138332 33 33 virtual ~RenderReplaced(); 34 34 35 virtual LayoutUnit computeReplacedLogicalWidth( bool includeMaxWidth = true) const;35 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const OVERRIDE; 36 36 virtual LayoutUnit computeReplacedLogicalHeight() const; 37 37 -
trunk/Source/WebCore/rendering/RenderVideo.cpp
r133172 r138332 263 263 } 264 264 265 LayoutUnit RenderVideo::computeReplacedLogicalWidth( bool includeMaxWidth) const266 { 267 return RenderReplaced::computeReplacedLogicalWidth( includeMaxWidth);265 LayoutUnit RenderVideo::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 266 { 267 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); 268 268 } 269 269 -
trunk/Source/WebCore/rendering/RenderVideo.h
r133172 r138332 71 71 virtual void layout(); 72 72 73 virtual LayoutUnit computeReplacedLogicalWidth( bool includeMaxWidth = true) const;73 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const OVERRIDE; 74 74 virtual LayoutUnit computeReplacedLogicalHeight() const; 75 75 virtual LayoutUnit minimumReplacedHeight() const OVERRIDE; -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp
r133845 r138332 160 160 } 161 161 162 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth( bool includeMaxWidth) const162 LayoutUnit RenderSVGRoot::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 163 163 { 164 164 SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); … … 170 170 171 171 if (style()->logicalWidth().isSpecified() || style()->logicalMaxWidth().isSpecified()) 172 return RenderReplaced::computeReplacedLogicalWidth( includeMaxWidth);172 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); 173 173 174 174 if (svg->widthAttributeEstablishesViewport()) … … 180 180 181 181 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG. 182 return RenderReplaced::computeReplacedLogicalWidth( includeMaxWidth);182 return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred); 183 183 } 184 184 -
trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h
r137847 r138332 79 79 virtual const char* renderName() const { return "RenderSVGRoot"; } 80 80 81 virtual LayoutUnit computeReplacedLogicalWidth( bool includeMaxWidth = true) const;81 virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const OVERRIDE; 82 82 virtual LayoutUnit computeReplacedLogicalHeight() const; 83 83 virtual void layout();
Note:
See TracChangeset
for help on using the changeset viewer.