Changeset 154858 in webkit for trunk/Source/WebCore/rendering/RenderImage.cpp
- Timestamp:
- Aug 29, 2013, 5:23:23 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderImage.cpp
r154580 r154858 207 207 } 208 208 209 void RenderImage::updateInnerContentRect() 210 { 211 // Propagate container size to image resource. 212 LayoutRect paintRect = replacedContentRect(intrinsicSize()); 213 IntSize containerSize(paintRect.width(), paintRect.height()); 214 if (!containerSize.isEmpty()) 215 m_imageResource->setContainerSizeForRenderer(containerSize); 216 } 217 209 218 void RenderImage::imageDimensionsChanged(bool imageSizeChanged, const IntRect* rect) 210 219 { … … 215 224 if (scale <= 0) 216 225 scale = 1; 217 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->i mageSize(style()->effectiveZoom() / scale), imageSizeChanged);226 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style()->effectiveZoom() / scale), imageSizeChanged); 218 227 #else 219 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->i mageSize(style()->effectiveZoom()), imageSizeChanged);228 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style()->effectiveZoom()), imageSizeChanged); 220 229 #endif 221 230 … … 255 264 if (!selfNeedsLayout()) 256 265 setNeedsLayout(true); 266 } 267 268 if (everHadLayout() && !selfNeedsLayout()) { 269 // The inner content rectangle is calculated during layout, but may need an update now 270 // (unless the box has already been scheduled for layout). In order to calculate it, we 271 // may need values from the containing block, though, so make sure that we're not too 272 // early. It may be that layout hasn't even taken place once yet. 273 274 // FIXME: we should not have to trigger another call to setContainerSizeForRenderer() 275 // from here, since it's already being done during layout. 276 updateInnerContentRect(); 257 277 } 258 278 } … … 395 415 #endif 396 416 397 LayoutSize contentSize(cWidth, cHeight); 398 LayoutPoint contentLocation = paintOffset; 399 contentLocation.move(leftBorder + leftPad, topBorder + topPad); 400 paintIntoRect(context, LayoutRect(contentLocation, contentSize)); 417 LayoutRect contentRect = contentBoxRect(); 418 contentRect.moveBy(paintOffset); 419 LayoutRect paintRect = replacedContentRect(intrinsicSize()); 420 paintRect.moveBy(paintOffset); 421 bool clip = !contentRect.contains(paintRect); 422 GraphicsContextStateSaver stateSaver(*context, clip); 423 if (clip) 424 context->clip(contentRect); 425 426 paintIntoRect(context, paintRect); 401 427 402 428 if (cachedImage() && page && paintInfo.phase == PaintPhaseForeground) { 403 429 // For now, count images as unpainted if they are still progressively loading. We may want 404 430 // to refine this in the future to account for the portion of the image that has painted. 431 LayoutRect visibleRect = intersection(paintRect, contentRect); 405 432 if (cachedImage()->isLoading()) 406 page->addRelevantUnpaintedObject(this, LayoutRect(contentLocation, contentSize));433 page->addRelevantUnpaintedObject(this, visibleRect); 407 434 else 408 page->addRelevantRepaintedObject(this, LayoutRect(contentLocation, contentSize));435 page->addRelevantRepaintedObject(this, visibleRect); 409 436 } 410 437 } … … 510 537 if ((backgroundClip == BorderFillBox || backgroundClip == PaddingFillBox) && style()->hasPadding()) 511 538 return false; 539 // Object-fit may leave parts of the content box empty. 540 ObjectFit objectFit = style()->objectFit(); 541 if (objectFit != ObjectFitFill && objectFit != ObjectFitCover) 542 return false; 512 543 // Check for image with alpha. 513 544 return m_imageResource->cachedImage() && m_imageResource->cachedImage()->currentFrameKnownToBeOpaque(this); … … 575 606 StackStats::LayoutCheckPoint layoutCheckPoint; 576 607 RenderReplaced::layout(); 577 578 // Propagate container size to image resource. 579 IntSize containerSize(contentWidth(), contentHeight()); 580 if (!containerSize.isEmpty()) 581 m_imageResource->setContainerSizeForRenderer(containerSize); 608 updateInnerContentRect(); 582 609 } 583 610
Note:
See TracChangeset
for help on using the changeset viewer.