Changeset 120473 in webkit
- Timestamp:
- Jun 15, 2012, 10:10:06 AM (14 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 2 edited
-
Api/WebPage.cpp (modified) (2 diffs)
-
ChangeLog (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/Api/WebPage.cpp
r120300 r120473 207 207 208 208 const double minimumExpandingRatio = 0.15; 209 210 const double minimumZoomToFitScale = 0.25; 209 211 210 212 // Helper function to parse a URL and fill in missing parts. … … 1673 1675 double WebPagePrivate::zoomToFitScale() const 1674 1676 { 1675 // We must clamp the contents for this calculation so that we do not allow an 1676 // arbitrarily small zoomToFitScale much like we clamp the fixedLayoutSize() 1677 // so that we do not have arbitrarily large layout size. 1678 // If we have a specified viewport, we may need to be able to zoom out more. 1679 int contentWidth = std::min(contentsSize().width(), std::max(m_virtualViewportWidth, static_cast<int>(defaultMaxLayoutSize().width()))); 1680 1681 // defaultMaxLayoutSize().width() is a safeguard for excessively large page layouts that 1682 // is too restrictive for image documents. In this case, the document width is sufficient. 1683 Document* doc = m_page->mainFrame()->document(); 1684 if (doc && doc->isImageDocument()) 1685 contentWidth = contentsSize().width(); 1686 1687 // If we have a virtual viewport and its aspect ratio caused content to layout 1688 // wider than the default layout aspect ratio we need to zoom to fit the content height 1689 // in order to avoid showing a grey area below the web page. 1690 // Without virtual viewport we can never get into this situation. 1691 if (hasVirtualViewport()) { 1692 int contentHeight = std::min(contentsSize().height(), std::max(m_virtualViewportHeight, static_cast<int>(defaultMaxLayoutSize().height()))); 1693 1694 // Aspect ratio check without division. 1695 if (contentWidth * m_defaultLayoutSize.height() > contentHeight * m_defaultLayoutSize.width()) 1696 return contentHeight > 0 ? static_cast<double>(m_defaultLayoutSize.height()) / contentHeight : 1.0; 1697 } 1698 1699 return contentWidth > 0.0 ? static_cast<double>(m_actualVisibleWidth) / contentWidth : 1.0; 1677 int contentWidth = contentsSize().width(); 1678 int contentHeight = contentsSize().height(); 1679 double zoomToFitScale = contentWidth > 0.0 ? static_cast<double>(m_actualVisibleWidth) / contentWidth : 1.0; 1680 if (contentHeight * zoomToFitScale < static_cast<double>(m_defaultLayoutSize.height())) 1681 zoomToFitScale = contentHeight > 0 ? static_cast<double>(m_defaultLayoutSize.height()) / contentHeight : 1.0; 1682 1683 return std::max(zoomToFitScale, minimumZoomToFitScale); 1700 1684 } 1701 1685 -
trunk/Source/WebKit/blackberry/ChangeLog
r120463 r120473 1 2012-06-15 Jacky Jiang <zhajiang@rim.com> 2 3 [BlackBerry] Certain web pages (i.e., http://www.cloudtweaks.com/) are allowed to be wider than the screen 4 https://bugs.webkit.org/show_bug.cgi?id=89211 5 6 Reviewed by Rob Buis. 7 Patch by Jacky Jiang <zhajiang@rim.com> 8 9 PR: 135215 10 Make simpler rules for zoom to fit scale: 11 - Zoom to fit horizontally first without clamping the contents width. 12 - Zoom to fit vertically instead without clamping the contents height 13 if the horizontal zoom to fit can cause a grey area below the web 14 page. Get rid of the virtual viewport guard as there may be cases 15 that zooming can cause a grey area without a virtual viewport. 16 - Clamp the scale by the minimum zoom to fit scale 0.25 and apply 17 this rule to image documents as well. This minimum scale can be 18 changed if there is a better vaule in the future. 19 In this way, we can get rid of the issue that many web pages don't fit 20 the screen. 21 22 Reviewed internally by Arvid Nilsson. 23 24 * Api/WebPage.cpp: 25 (WebKit): 26 (BlackBerry::WebKit::WebPagePrivate::zoomToFitScale): 27 1 28 2012-06-15 Yong Li <yoli@rim.com> 2 29
Note:
See TracChangeset
for help on using the changeset viewer.