Title: [140228] trunk/Source/WebKit2
Revision
140228
Author
[email protected]
Date
2013-01-18 18:10:41 -0800 (Fri, 18 Jan 2013)

Log Message

[wk2] Intrinsic content size should report a flexible width if the content is not wider than the minimum layout width
https://bugs.webkit.org/show_bug.cgi?id=107334
<rdar://problem/12960009>

Reviewed by Anders Carlsson.

* UIProcess/API/mac/WKView.mm:
(-[WKView _setIntrinsicContentSize:]): If the content is laid-out at or below the minimum layout width, it's flexible; otherwise, we need to inform autolayout that we require more space via our intrinsic content size.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Allow auto-sizing to expand its width beyond the minimum if needed.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setMinimumLayoutWidth): Allow auto-sizing to expand its width beyond the minimum if needed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (140227 => 140228)


--- trunk/Source/WebKit2/ChangeLog	2013-01-19 01:53:36 UTC (rev 140227)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-19 02:10:41 UTC (rev 140228)
@@ -1,3 +1,18 @@
+2013-01-18  Tim Horton  <[email protected]>
+
+        [wk2] Intrinsic content size should report a flexible width if the content is not wider than the minimum layout width
+        https://bugs.webkit.org/show_bug.cgi?id=107334
+        <rdar://problem/12960009>
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setIntrinsicContentSize:]): If the content is laid-out at or below the minimum layout width, it's flexible; otherwise, we need to inform autolayout that we require more space via our intrinsic content size.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Allow auto-sizing to expand its width beyond the minimum if needed.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setMinimumLayoutWidth): Allow auto-sizing to expand its width beyond the minimum if needed.
+
 2013-01-18  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/13042826> REGRESSION (r139985): Full Screen Youtube loses keyboard and mouse control

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (140227 => 140228)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-01-19 01:53:36 UTC (rev 140227)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-01-19 02:10:41 UTC (rev 140228)
@@ -2857,7 +2857,15 @@
 
 - (void)_setIntrinsicContentSize:(NSSize)intrinsicContentSize
 {
-    _data->_intrinsicContentSize = intrinsicContentSize;
+    // If the intrinsic content size is the same as the minimum layout width, the content flowed to fit,
+    // so we can report that that dimension is flexible. If not, we need to report our greater intrinsic width
+    // so that autolayout will know to provide space for us.
+
+    NSSize intrinsicContentSizeAcknowledgingFlexibleWidth = intrinsicContentSize;
+    if (intrinsicContentSize.width <= _data->_page->minimumLayoutWidth())
+        intrinsicContentSizeAcknowledgingFlexibleWidth.width = NSViewNoInstrinsicMetric;
+
+    _data->_intrinsicContentSize = intrinsicContentSizeAcknowledgingFlexibleWidth;
     [self invalidateIntrinsicContentSize];
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (140227 => 140228)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-01-19 01:53:36 UTC (rev 140227)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2013-01-19 02:10:41 UTC (rev 140228)
@@ -1243,8 +1243,9 @@
         defaultScrollbarMode, /* lock */ shouldHideScrollbars, defaultScrollbarMode, /* lock */ shouldHideScrollbars);
 
     int minimumLayoutWidth = webPage->minimumLayoutWidth();
+    int maximumSize = std::numeric_limits<int>::max();
     if (minimumLayoutWidth)
-        m_frame->coreFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(minimumLayoutWidth, INT_MAX));
+        m_frame->coreFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(maximumSize, maximumSize));
 
     m_frame->coreFrame()->view()->setProhibitsScrolling(shouldDisableScrolling);
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (140227 => 140228)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-19 01:53:36 UTC (rev 140227)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-01-19 02:10:41 UTC (rev 140228)
@@ -3788,8 +3788,10 @@
 
     m_minimumLayoutWidth = minimumLayoutWidth;
 
+    int maximumSize = std::numeric_limits<int>::max();
+
     if (minimumLayoutWidth > 0)
-        corePage()->mainFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(minimumLayoutWidth, INT_MAX));
+        corePage()->mainFrame()->view()->enableAutoSizeMode(true, IntSize(minimumLayoutWidth, 1), IntSize(maximumSize, maximumSize));
     else
         corePage()->mainFrame()->view()->enableAutoSizeMode(false, IntSize(), IntSize());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to