Ambiguous naming: Do not call replacedContentRect()'s return value paint rect.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2015 20:40:00 +0000 (20:40 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Feb 2015 20:40:00 +0000 (20:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141125

Reviewed by Simon Fraser.

It's the content box rect with the object-fit adjustment.

No change in functionality.

* rendering/RenderHTMLCanvas.cpp:
(WebCore::RenderHTMLCanvas::paintReplaced):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::updateInnerContentRect):
(WebCore::RenderImage::paintReplaced):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::replacedContentRect):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::splitFragmentToFitLine):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179488 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderHTMLCanvas.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderReplaced.cpp

index 35f1d34..ff94600 100644 (file)
@@ -1,3 +1,24 @@
+2015-02-02  Zalan Bujtas  <zalan@apple.com>
+
+        Ambiguous naming: Do not call replacedContentRect()'s return value paint rect.
+        https://bugs.webkit.org/show_bug.cgi?id=141125
+
+        Reviewed by Simon Fraser.
+
+        It's the content box rect with the object-fit adjustment.
+
+        No change in functionality.
+
+        * rendering/RenderHTMLCanvas.cpp:
+        (WebCore::RenderHTMLCanvas::paintReplaced):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::updateInnerContentRect):
+        (WebCore::RenderImage::paintReplaced):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::replacedContentRect):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
+
 2015-02-02  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Build fix after r179476.
index e218544..5a650aa 100644 (file)
@@ -68,24 +68,24 @@ void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& pa
 {
     GraphicsContext* context = paintInfo.context;
 
-    LayoutRect contentRect = contentBoxRect();
-    contentRect.moveBy(paintOffset);
-    LayoutRect paintRect = replacedContentRect(intrinsicSize());
-    paintRect.moveBy(paintOffset);
+    LayoutRect contentBoxRect = this->contentBoxRect();
+    contentBoxRect.moveBy(paintOffset);
+    LayoutRect replacedContentRect = this->replacedContentRect(intrinsicSize());
+    replacedContentRect.moveBy(paintOffset);
 
     // Not allowed to overflow the content box.
-    bool clip = !contentRect.contains(paintRect);
+    bool clip = !contentBoxRect.contains(replacedContentRect);
     GraphicsContextStateSaver stateSaver(*paintInfo.context, clip);
     if (clip)
-        paintInfo.context->clip(snappedIntRect(contentRect));
+        paintInfo.context->clip(snappedIntRect(contentBoxRect));
 
     if (Page* page = frame().page()) {
         if (paintInfo.phase == PaintPhaseForeground)
-            page->addRelevantRepaintedObject(this, intersection(paintRect, contentRect));
+            page->addRelevantRepaintedObject(this, intersection(replacedContentRect, contentBoxRect));
     }
 
     bool useLowQualityScale = style().imageRendering() == ImageRenderingCrispEdges || style().imageRendering() == ImageRenderingOptimizeSpeed;
-    canvasElement().paint(context, paintRect, useLowQualityScale);
+    canvasElement().paint(context, replacedContentRect, useLowQualityScale);
 }
 
 void RenderHTMLCanvas::canvasSizeChanged()
index c954f76..4efd9f1 100644 (file)
@@ -277,8 +277,7 @@ bool RenderImage::updateIntrinsicSizeIfNeeded(const LayoutSize& newSize, bool im
 void RenderImage::updateInnerContentRect()
 {
     // Propagate container size to image resource.
-    LayoutRect paintRect = replacedContentRect(intrinsicSize());
-    IntSize containerSize(paintRect.width(), paintRect.height());
+    IntSize containerSize(replacedContentRect(intrinsicSize()).size());
     if (!containerSize.isEmpty())
         imageResource().setContainerSizeForRenderer(containerSize);
 }
@@ -455,21 +454,21 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf
             return;
         }
 
-        LayoutRect contentRect = contentBoxRect();
-        contentRect.moveBy(paintOffset);
-        LayoutRect paintRect = replacedContentRect(intrinsicSize());
-        paintRect.moveBy(paintOffset);
-        bool clip = !contentRect.contains(paintRect);
+        LayoutRect contentBoxRect = this->contentBoxRect();
+        contentBoxRect.moveBy(paintOffset);
+        LayoutRect replacedContentRect = this->replacedContentRect(intrinsicSize());
+        replacedContentRect.moveBy(paintOffset);
+        bool clip = !contentBoxRect.contains(replacedContentRect);
         GraphicsContextStateSaver stateSaver(*context, clip);
         if (clip)
-            context->clip(contentRect);
+            context->clip(contentBoxRect);
 
-        paintIntoRect(context, snapRectToDevicePixels(paintRect, deviceScaleFactor));
+        paintIntoRect(context, snapRectToDevicePixels(replacedContentRect, deviceScaleFactor));
         
         if (cachedImage() && page && paintInfo.phase == PaintPhaseForeground) {
             // For now, count images as unpainted if they are still progressively loading. We may want 
             // to refine this in the future to account for the portion of the image that has painted.
-            LayoutRect visibleRect = intersection(paintRect, contentRect);
+            LayoutRect visibleRect = intersection(replacedContentRect, contentBoxRect);
             if (cachedImage()->isLoading())
                 page->addRelevantUnpaintedObject(this, visibleRect);
             else
index 085333b..18895d8 100644 (file)
@@ -324,11 +324,11 @@ void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* conten
 LayoutRect RenderReplaced::replacedContentRect(const LayoutSize& intrinsicSize) const
 {
     LayoutRect contentRect = contentBoxRect();
-    ObjectFit objectFit = style().objectFit();
-    if (objectFit == ObjectFitFill)
+    if (intrinsicSize.isEmpty())
         return contentRect;
 
-    if (!intrinsicSize.width() || !intrinsicSize.height())
+    ObjectFit objectFit = style().objectFit();
+    if (objectFit == ObjectFitFill)
         return contentRect;
 
     LayoutRect finalRect = contentRect;