From 9699702277bbf8a042a9f368f7afae10b2a54bfa Mon Sep 17 00:00:00 2001 From: Changhyup Jwa Date: Tue, 4 Jun 2013 13:47:36 +0900 Subject: [PATCH] Fix ImageDocument's reference size [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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp index 85bc514..9789953 100644 --- a/Source/WebCore/html/ImageDocument.cpp +++ b/Source/WebCore/html/ImageDocument.cpp @@ -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(); } -- 2.7.4