Changeset 158163 in webkit for trunk/Source/WebCore/rendering/RenderImage.cpp
- Timestamp:
- Oct 28, 2013, 7:58:43 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/Source/WebCore/rendering/RenderImage.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderImage.cpp
r158097 r158163 122 122 // imageSize() returns 0 for the error image. We need the true size of the 123 123 // error image, so we have to get it by grabbing image() directly. 124 return IntSize(paddingWidth + imageSize.width() * style() ->effectiveZoom(), paddingHeight + imageSize.height() * style()->effectiveZoom());124 return IntSize(paddingWidth + imageSize.width() * style().effectiveZoom(), paddingHeight + imageSize.height() * style().effectiveZoom()); 125 125 } 126 126 … … 141 141 FontCachePurgePreventer fontCachePurgePreventer; 142 142 143 const Font& font = style() ->font();144 IntSize paddedTextSize(paddingWidth + min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, *style()))), maxAltTextWidth), paddingHeight + min(font.fontMetrics().height(), maxAltTextHeight));143 const Font& font = style().font(); 144 IntSize paddedTextSize(paddingWidth + min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddingHeight + min(font.fontMetrics().height(), maxAltTextHeight)); 145 145 imageSize = imageSize.expandedTo(paddedTextSize); 146 146 } … … 162 162 } 163 163 #if ENABLE(CSS_IMAGE_ORIENTATION) 164 if (diff == StyleDifferenceLayout && oldStyle->imageOrientation() != style() ->imageOrientation())164 if (diff == StyleDifferenceLayout && oldStyle->imageOrientation() != style().imageOrientation()) 165 165 return imageDimensionsChanged(true /* imageSizeChanged */); 166 166 #endif … … 168 168 #if ENABLE(CSS_IMAGE_RESOLUTION) 169 169 if (diff == StyleDifferenceLayout 170 && (oldStyle->imageResolution() != style() ->imageResolution()171 || oldStyle->imageResolutionSnap() != style() ->imageResolutionSnap()172 || oldStyle->imageResolutionSource() != style() ->imageResolutionSource()))170 && (oldStyle->imageResolution() != style().imageResolution() 171 || oldStyle->imageResolutionSnap() != style().imageResolutionSnap() 172 || oldStyle->imageResolutionSource() != style().imageResolutionSource())) 173 173 imageDimensionsChanged(true /* imageSizeChanged */); 174 174 #endif … … 238 238 { 239 239 #if ENABLE(CSS_IMAGE_RESOLUTION) 240 double scale = style() ->imageResolution();241 if (style() ->imageResolutionSnap() == ImageResolutionSnapPixels)240 double scale = style().imageResolution(); 241 if (style().imageResolutionSnap() == ImageResolutionSnapPixels) 242 242 scale = roundForImpreciseConversion<int>(scale); 243 243 if (scale <= 0) 244 244 scale = 1; 245 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style() ->effectiveZoom() / scale), imageSizeChanged);245 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style().effectiveZoom() / scale), imageSizeChanged); 246 246 #else 247 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style() ->effectiveZoom()), imageSizeChanged);247 bool intrinsicSizeChanged = updateIntrinsicSizeIfNeeded(m_imageResource->intrinsicSize(style().effectiveZoom()), imageSizeChanged); 248 248 #endif 249 249 … … 275 275 // There's no easy way to detect that shrink-to-fit is needed, always force a layout. 276 276 bool containingBlockNeedsToRecomputePreferredSize = 277 style() ->logicalWidth().isPercent()278 || style() ->logicalMaxWidth().isPercent()279 || style() ->logicalMinWidth().isPercent();277 style().logicalWidth().isPercent() 278 || style().logicalMaxWidth().isPercent() 279 || style().logicalMinWidth().isPercent(); 280 280 281 281 if (imageSizeChanged || hasOverrideSize || containingBlockNeedsToRecomputePreferredSize) { … … 363 363 // Draw an outline rect where the image should be. 364 364 context->setStrokeStyle(SolidStroke); 365 context->setStrokeColor(Color::lightGray, style() ->colorSpace());366 context->setFillColor(Color::transparent, style() ->colorSpace());365 context->setStrokeColor(Color::lightGray, style().colorSpace()); 366 context->setFillColor(Color::transparent, style().colorSpace()); 367 367 context->drawRect(pixelSnappedIntRect(LayoutRect(paintOffset.x() + leftBorder + leftPad, paintOffset.y() + topBorder + topPad, cWidth, cHeight))); 368 368 … … 394 394 ImageOrientationDescription orientationDescription; 395 395 #if ENABLE(CSS_IMAGE_ORIENTATION) 396 orientationDescription.setImageOrientationEnum(style() ->imageOrientation());396 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 397 397 orientationDescription.setRespectImageOrientation(shouldRespectImageOrientation()); 398 398 #endif 399 context->drawImage(image.get(), style() ->colorSpace(), pixelSnappedIntRect(LayoutRect(paintOffset + imageOffset, imageSize)), CompositeSourceOver, orientationDescription);399 context->drawImage(image.get(), style().colorSpace(), pixelSnappedIntRect(LayoutRect(paintOffset + imageOffset, imageSize)), CompositeSourceOver, orientationDescription); 400 400 errorPictureDrawn = true; 401 401 } … … 403 403 if (!m_altText.isEmpty()) { 404 404 String text = document().displayStringModifiedByEncoding(m_altText); 405 context->setFillColor(style() ->visitedDependentColor(CSSPropertyColor), style()->colorSpace());406 const Font& font = style() ->font();405 context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace()); 406 const Font& font = style().font(); 407 407 const FontMetrics& fontMetrics = font.fontMetrics(); 408 408 LayoutUnit ascent = fontMetrics.ascent(); … … 412 412 // Only draw the alt text if it'll fit within the content box, 413 413 // and only if it fits above the error image. 414 TextRun textRun = RenderBlock::constructTextRun(this, font, text, *style());414 TextRun textRun = RenderBlock::constructTextRun(this, font, text, style()); 415 415 LayoutUnit textWidth = font.width(textRun); 416 416 if (errorPictureDrawn) { … … 430 430 431 431 #if PLATFORM(MAC) 432 if (style() ->highlight() != nullAtom && !paintInfo.context->paintingDisabled())433 paintCustomHighlight(toPoint(paintOffset - location()), style() ->highlight(), true);432 if (style().highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 433 paintCustomHighlight(toPoint(paintOffset - location()), style().highlight(), true); 434 434 #endif 435 435 … … 526 526 ImageOrientationDescription orientationDescription; 527 527 #if ENABLE(CSS_IMAGE_ORIENTATION) 528 orientationDescription.setImageOrientationEnum(style() ->imageOrientation());528 orientationDescription.setImageOrientationEnum(style().imageOrientation()); 529 529 orientationDescription.setRespectImageOrientation(shouldRespectImageOrientation()); 530 530 #endif 531 context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style() ->colorSpace(), alignedRect, compositeOperator, orientationDescription, useLowQualityScaling);531 context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style().colorSpace(), alignedRect, compositeOperator, orientationDescription, useLowQualityScaling); 532 532 } 533 533 … … 549 549 if (!contentBoxRect().contains(localRect)) 550 550 return false; 551 EFillBox backgroundClip = style() ->backgroundClip();551 EFillBox backgroundClip = style().backgroundClip(); 552 552 // Background paints under borders. 553 if (backgroundClip == BorderFillBox && style() ->hasBorder() && !borderObscuresBackground())553 if (backgroundClip == BorderFillBox && style().hasBorder() && !borderObscuresBackground()) 554 554 return false; 555 555 // Background shows in padding area. 556 if ((backgroundClip == BorderFillBox || backgroundClip == PaddingFillBox) && style() ->hasPadding())556 if ((backgroundClip == BorderFillBox || backgroundClip == PaddingFillBox) && style().hasPadding()) 557 557 return false; 558 558 // Object-fit may leave parts of the content box empty. 559 ObjectFit objectFit = style() ->objectFit();559 ObjectFit objectFit = style().objectFit(); 560 560 if (objectFit != ObjectFitFill && objectFit != ObjectFitCover) 561 561 return false; … … 594 594 if (HTMLMapElement* map = imageMap()) { 595 595 LayoutRect contentBox = contentBoxRect(); 596 float scaleFactor = 1 / style() ->effectiveZoom();596 float scaleFactor = 1 / style().effectiveZoom(); 597 597 LayoutPoint mapLocation = locationInContainer.point() - toLayoutSize(accumulatedOffset) - locationOffset() - toLayoutSize(contentBox.location()); 598 598 mapLocation.scale(scaleFactor, scaleFactor);
Note:
See TracChangeset
for help on using the changeset viewer.