Changeset 181488 in webkit
- Timestamp:
- Mar 13, 2015, 2:07:06 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/ViewportConfiguration.cpp (modified) (5 diffs)
-
WebCore/page/ViewportConfiguration.h (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/ios/WKScrollView.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r181485 r181488 1 2015-03-13 Timothy Horton <timothy_horton@apple.com> 2 3 Sites that use a device-width viewport but don't have enough height to fill the view are scaled up 4 https://bugs.webkit.org/show_bug.cgi?id=142664 5 <rdar://problem/18859470> 6 7 Reviewed by Benjamin Poulain. 8 9 * page/ViewportConfiguration.cpp: 10 (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints): 11 (WebCore::ViewportConfiguration::shouldIgnoreVerticalScalingConstraints): 12 (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraints): 13 Split shouldIgnoreScalingConstraints into one for each dimension. 14 15 (WebCore::ViewportConfiguration::initialScale): 16 (WebCore::ViewportConfiguration::minimumScale): 17 Don't force the initial and minimum scales to cover the whole view if the 18 page claims to want to lay out to device width but then lays out too big. 19 This will allow pages that misbehave in this way to scale down further 20 than they previously could, but will result in a region of empty background 21 color being exposed at the initial/minimum scale. 22 23 (WebCore::ViewportConfiguration::description): 24 Update the logging to show each dimension separately. 25 26 * page/ViewportConfiguration.h: 27 1 28 2015-03-13 Mark Lam <mark.lam@apple.com> 2 29 -
trunk/Source/WebCore/page/ViewportConfiguration.cpp
r181400 r181488 98 98 } 99 99 100 bool ViewportConfiguration::shouldIgnore ScalingConstraints() const100 bool ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints() const 101 101 { 102 102 if (!m_canIgnoreScalingConstraints) … … 107 107 return laidOutWiderThanViewport; 108 108 109 if (m_configuration.initialScaleIsSet && m_configuration.initialScale == 1) 110 return laidOutWiderThanViewport; 111 112 return false; 113 } 114 115 bool ViewportConfiguration::shouldIgnoreVerticalScalingConstraints() const 116 { 117 if (!m_canIgnoreScalingConstraints) 118 return false; 119 109 120 bool laidOutTallerThanViewport = m_contentSize.height() > layoutHeight(); 110 121 if (m_viewportArguments.height == ViewportArguments::ValueDeviceHeight) 111 122 return laidOutTallerThanViewport; 112 123 113 if (m_configuration.initialScaleIsSet && m_configuration.initialScale == 1)114 return laidOutWiderThanViewport;115 116 124 return false; 125 } 126 127 bool ViewportConfiguration::shouldIgnoreScalingConstraints() const 128 { 129 return shouldIgnoreHorizontalScalingConstraints() || shouldIgnoreVerticalScalingConstraints(); 117 130 } 118 131 … … 131 144 double width = m_contentSize.width() > 0 ? m_contentSize.width() : layoutWidth(); 132 145 double initialScale = 0; 133 if (width > 0 )146 if (width > 0 && !shouldIgnoreVerticalScalingConstraints()) 134 147 initialScale = minimumLayoutSize.width() / width; 135 148 136 // Prevent the in tial scale from shrinking to a height smaller than our view's minimum height.149 // Prevent the initial scale from shrinking to a height smaller than our view's minimum height. 137 150 double height = m_contentSize.height() > 0 ? m_contentSize.height() : layoutHeight(); 138 if (height > 0 && height * initialScale < minimumLayoutSize.height() )151 if (height > 0 && height * initialScale < minimumLayoutSize.height() && !shouldIgnoreHorizontalScalingConstraints()) 139 152 initialScale = minimumLayoutSize.height() / height; 140 153 return std::min(std::max(initialScale, shouldIgnoreScalingConstraints() ? m_defaultConfiguration.minimumScale : m_configuration.minimumScale), m_configuration.maximumScale); … … 152 165 const FloatSize& minimumLayoutSize = m_minimumLayoutSize; 153 166 double contentWidth = m_contentSize.width(); 154 if (contentWidth > 0 && contentWidth * minimumScale < minimumLayoutSize.width() )167 if (contentWidth > 0 && contentWidth * minimumScale < minimumLayoutSize.width() && !shouldIgnoreVerticalScalingConstraints()) 155 168 minimumScale = minimumLayoutSize.width() / contentWidth; 156 169 157 170 double contentHeight = m_contentSize.height(); 158 if (contentHeight > 0 && contentHeight * minimumScale < minimumLayoutSize.height() )171 if (contentHeight > 0 && contentHeight * minimumScale < minimumLayoutSize.height() && !shouldIgnoreHorizontalScalingConstraints()) 159 172 minimumScale = minimumLayoutSize.height() / contentHeight; 160 173 … … 491 504 ts << "(computed layout size " << layoutSize() << ")\n"; 492 505 ts.writeIndent(); 493 ts << "(ignoring scaling constraints " << (shouldIgnoreScalingConstraints() ? "true" : "false") << ")"; 506 ts << "(ignoring horizontal scaling constraints " << (shouldIgnoreHorizontalScalingConstraints() ? "true" : "false") << ")\n"; 507 ts.writeIndent(); 508 ts << "(ignoring vertical scaling constraints " << (shouldIgnoreVerticalScalingConstraints() ? "true" : "false") << ")"; 494 509 ts.decreaseIndent(); 495 510 -
trunk/Source/WebCore/page/ViewportConfiguration.h
r181400 r181488 102 102 int layoutWidth() const; 103 103 int layoutHeight() const; 104 104 105 bool shouldIgnoreScalingConstraints() const; 106 bool shouldIgnoreVerticalScalingConstraints() const; 107 bool shouldIgnoreHorizontalScalingConstraints() const; 105 108 106 109 Parameters m_configuration; -
trunk/Source/WebKit2/ChangeLog
r181485 r181488 1 2015-03-13 Timothy Horton <timothy_horton@apple.com> 2 3 Sites that use a device-width viewport but don't have enough height to fill the view are scaled up 4 https://bugs.webkit.org/show_bug.cgi?id=142664 5 <rdar://problem/18859470> 6 7 Reviewed by Benjamin Poulain. 8 9 * UIProcess/ios/WKScrollView.mm: 10 (-[WKScrollView _rubberBandOffsetForOffset:maxOffset:minOffset:range:outside:]): 11 Now that the WKContentView can (without pinching) be smaller than the unobscured 12 region of the WKWebView, we need to take that into account when deciding where 13 to retarget scrolling. 14 1 15 2015-03-13 Mark Lam <mark.lam@apple.com> 2 16 -
trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm
r176140 r181488 177 177 178 178 CGFloat minimalHorizontalRange = bounds.size.width - contentInsets.left - contentInsets.right; 179 CGFloat contentWidthAtMinimumScale = contentSize.width * (self.minimumZoomScale / self.zoomScale); 180 if (contentWidthAtMinimumScale < minimalHorizontalRange) { 181 CGFloat unobscuredEmptyHorizontalMarginAtMinimumScale = minimalHorizontalRange - contentWidthAtMinimumScale; 182 minimalHorizontalRange -= unobscuredEmptyHorizontalMarginAtMinimumScale; 183 } 179 184 if (contentSize.width < minimalHorizontalRange) { 180 185 if (valuesAreWithinOnePixel(minOffset, -contentInsets.left) … … 189 194 190 195 CGFloat minimalVerticalRange = bounds.size.height - contentInsets.top - contentInsets.bottom; 196 CGFloat contentHeightAtMinimumScale = contentSize.height * (self.minimumZoomScale / self.zoomScale); 197 if (contentHeightAtMinimumScale < minimalVerticalRange) { 198 CGFloat unobscuredEmptyVerticalMarginAtMinimumScale = minimalVerticalRange - contentHeightAtMinimumScale; 199 minimalVerticalRange -= unobscuredEmptyVerticalMarginAtMinimumScale; 200 } 191 201 if (contentSize.height < minimalVerticalRange) { 192 202 if (valuesAreWithinOnePixel(minOffset, -contentInsets.top)
Note:
See TracChangeset
for help on using the changeset viewer.