Fix ImageDocument's reference size
authorChanghyup Jwa <ch.jwa@samsung.com>
Tue, 4 Jun 2013 04:47:36 +0000 (13:47 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 4 Jun 2013 08:12:44 +0000 (17:12 +0900)
[Title] Fix ImageDocument's reference size
[Issue#] N_SE-39200, 39237
[Problem] Image resource's size is not equal even it's reloaded
[Cause] ImageDocument resizes image resource with visible content rect.
        And visible content rect can be changed by user or loading progress.
[Solution] Fix ImageDocument to refer layout size which is not changed

Change-Id: I12974ac3a3830bc711c4689d55666c509250347f

Source/WebCore/html/ImageDocument.cpp

index 85bc514..9789953 100644 (file)
@@ -235,9 +235,10 @@ float ImageDocument::scale() const
 
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), pageZoomFactor(this));
 #if ENABLE(TIZEN_VIEWPORT_META_TAG)
-    // FIXME: View size is not updated before layout. So, we need to use visible content rect instead of view size.
-    // WebKit mainline also has same problem.
-    LayoutSize windowSize = LayoutSize(view->visibleWidth(), view->visibleHeight());
+    // FIXME: view->width() and view->height() are frame's rect size. And it's calculated after layout.
+    // But ImageDocument's loading can be begun before frame's rect size is fixed.
+    // So, we use layoutWidth() here.
+    LayoutSize windowSize = LayoutSize(view->layoutWidth(), view->layoutHeight());
 #else
     LayoutSize windowSize = LayoutSize(view->width(), view->height());
 #endif
@@ -330,7 +331,14 @@ bool ImageDocument::imageFitsInWindow() const
         return true;
 
     LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), pageZoomFactor(this));
+#if ENABLE(TIZEN_VIEWPORT_META_TAG)
+    // FIXME: view->width() and view->height() are frame's rect size. And it's calculated after layout.
+    // But ImageDocument's loading can be begun before frame's rect size is fixed.
+    // So, we use layoutWidth() here.
+    LayoutSize windowSize = LayoutSize(view->layoutWidth(), view->layoutHeight());
+#else
     LayoutSize windowSize = LayoutSize(view->width(), view->height());
+#endif
     
     return imageSize.width() <= windowSize.width() && imageSize.height() <= windowSize.height();    
 }