<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182499] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182499">182499</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-04-07 15:37:11 -0700 (Tue, 07 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Expose and test fixedLayoutSize via modern WebKit SPI
https://bugs.webkit.org/show_bug.cgi?id=143500
Reviewed by Simon Fraser.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _isFixedLayoutEnabled]):
(-[WKWebView _setFixedLayoutEnabled:]):
(-[WKWebView _fixedLayoutSize]):
(-[WKWebView _setFixedLayoutSize:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _isFixedLayoutEnabled]):
(-[WKView _setFixedLayoutEnabled:]):
(-[WKView _fixedLayoutSize]):
(-[WKView _setFixedLayoutSize:]):
Add API for adjusting the fixed layout size, and whether or not we use it.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
Repair a mistake I made in <a href="http://trac.webkit.org/projects/webkit/changeset/139822">r139822</a>, where I brought odd TILED_BACKING_STORE-only
logic (which disables scrollbars if fixedLayoutSize is enabled) to the rest of the ports.
Put it back as TILED_BACKING_STORE-only.
Persist the fixedLayoutSize through view creation; we already persist the enabled state,
but not the size, which doesn't make any sense.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::fixedLayoutSize):
* WebProcess/WebPage/WebPage.h:
Add a fixedLayoutSize() getter.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm: Added.
(-[FixedLayoutSizeNavigationDelegate webView:didFinishNavigation:]):
(TEST):
Add a test that verifies that fixedLayoutSize works at all, that
it persists through a navigation, and that turning it back off reverts to
laying out at the size of the view.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaFixedLayoutSizemm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/ChangeLog        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2015-04-07 Tim Horton <timothy_horton@apple.com>
+
+ Expose and test fixedLayoutSize via modern WebKit SPI
+ https://bugs.webkit.org/show_bug.cgi?id=143500
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _isFixedLayoutEnabled]):
+ (-[WKWebView _setFixedLayoutEnabled:]):
+ (-[WKWebView _fixedLayoutSize]):
+ (-[WKWebView _setFixedLayoutSize:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _isFixedLayoutEnabled]):
+ (-[WKView _setFixedLayoutEnabled:]):
+ (-[WKView _fixedLayoutSize]):
+ (-[WKView _setFixedLayoutSize:]):
+ Add API for adjusting the fixed layout size, and whether or not we use it.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
+ Repair a mistake I made in r139822, where I brought odd TILED_BACKING_STORE-only
+ logic (which disables scrollbars if fixedLayoutSize is enabled) to the rest of the ports.
+ Put it back as TILED_BACKING_STORE-only.
+
+ Persist the fixedLayoutSize through view creation; we already persist the enabled state,
+ but not the size, which doesn't make any sense.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::fixedLayoutSize):
+ * WebProcess/WebPage/WebPage.h:
+ Add a fixedLayoutSize() getter.
+
</ins><span class="cx"> 2015-04-07 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> ContextMenuItem refactoring
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -90,6 +90,9 @@
</span><span class="cx"> @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
</span><span class="cx"> @property (nonatomic, setter=_setTotalHeightOfBanners:) CGFloat _totalHeightOfBanners;
</span><span class="cx">
</span><ins>+@property (nonatomic, getter=_isFixedLayoutEnabled, setter=_setFixedLayoutEnabled:) BOOL _fixedLayoutEnabled;
+@property (nonatomic, setter=_setFixedLayoutSize:) CGSize _fixedLayoutSize;
+
</ins><span class="cx"> @property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
</span><span class="cx">
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -2232,6 +2232,26 @@
</span><span class="cx"> return _page->isShowingNavigationGestureSnapshot();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)_isFixedLayoutEnabled
+{
+ return _page->useFixedLayout();
+}
+
+- (void)_setFixedLayoutEnabled:(BOOL)fixedLayoutEnabled
+{
+ _page->setUseFixedLayout(fixedLayoutEnabled);
+}
+
+- (CGSize)_fixedLayoutSize
+{
+ return _page->fixedLayoutSize();
+}
+
+- (void)_setFixedLayoutSize:(CGSize)fixedLayoutSize
+{
+ _page->setFixedLayoutSize(WebCore::expandedIntSize(WebCore::FloatSize(fixedLayoutSize)));
+}
+
</ins><span class="cx"> #pragma mark scrollperf methods
</span><span class="cx">
</span><span class="cx"> - (void)_setScrollPerformanceDataCollectionEnabled:(BOOL)enabled
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -91,6 +91,9 @@
</span><span class="cx">
</span><span class="cx"> - (void)_close;
</span><span class="cx">
</span><ins>+@property (nonatomic, getter=_isFixedLayoutEnabled, setter=_setFixedLayoutEnabled:) BOOL _fixedLayoutEnabled;
+@property (nonatomic, setter=_setFixedLayoutSize:) CGSize _fixedLayoutSize;
+
</ins><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> // DERECATED: The setters of the three following function are deprecated, please use overrideLayoutParameters.
</span><span class="cx"> // Define the smallest size a page take with a regular viewport.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -4322,6 +4322,26 @@
</span><span class="cx"> return _data->_overrideDeviceScaleFactor;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)_isFixedLayoutEnabled
+{
+ return _data->_page->useFixedLayout();
+}
+
+- (void)_setFixedLayoutEnabled:(BOOL)fixedLayoutEnabled
+{
+ _data->_page->setUseFixedLayout(fixedLayoutEnabled);
+}
+
+- (CGSize)_fixedLayoutSize
+{
+ return _data->_page->fixedLayoutSize();
+}
+
+- (void)_setFixedLayoutSize:(NSSize)fixedLayoutSize
+{
+ _data->_page->setFixedLayoutSize(expandedIntSize(FloatSize(fixedLayoutSize)));
+}
+
</ins><span class="cx"> - (void)_dispatchSetTopContentInset
</span><span class="cx"> {
</span><span class="cx"> if (!_data->_didScheduleSetTopContentInset)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebFrameLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -1257,12 +1257,14 @@
</span><span class="cx"> bool isTransparent = !webPage->drawsBackground();
</span><span class="cx"> bool shouldUseFixedLayout = isMainFrame && webPage->useFixedLayout();
</span><span class="cx"> bool shouldDisableScrolling = isMainFrame && !webPage->mainFrameIsScrollable();
</span><del>- bool shouldHideScrollbars = shouldUseFixedLayout || shouldDisableScrolling;
</del><ins>+ bool shouldHideScrollbars = shouldDisableScrolling;
</ins><span class="cx"> IntRect fixedVisibleContentRect;
</span><span class="cx">
</span><span class="cx"> #if USE(TILED_BACKING_STORE)
</span><span class="cx"> if (m_frame->coreFrame()->view())
</span><span class="cx"> fixedVisibleContentRect = m_frame->coreFrame()->view()->fixedVisibleContentRect();
</span><ins>+ if (shouldUseFixedLayout)
+ shouldHideScrollbars = true;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> const ResourceResponse& response = m_frame->coreFrame()->loader().documentLoader()->response();
</span><span class="lines">@@ -1272,7 +1274,7 @@
</span><span class="cx"> ScrollbarMode defaultScrollbarMode = shouldHideScrollbars ? ScrollbarAlwaysOff : ScrollbarAuto;
</span><span class="cx">
</span><span class="cx"> m_frame->coreFrame()->createView(webPage->size(), backgroundColor, isTransparent,
</span><del>- IntSize(), fixedVisibleContentRect, shouldUseFixedLayout,
</del><ins>+ webPage->fixedLayoutSize(), fixedVisibleContentRect, shouldUseFixedLayout,
</ins><span class="cx"> defaultScrollbarMode, /* lock */ shouldHideScrollbars, defaultScrollbarMode, /* lock */ shouldHideScrollbars);
</span><span class="cx">
</span><span class="cx"> if (int minimumLayoutWidth = webPage->minimumLayoutSize().width()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -1494,6 +1494,14 @@
</span><span class="cx"> view->setFixedLayoutSize(size);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IntSize WebPage::fixedLayoutSize() const
+{
+ FrameView* view = mainFrameView();
+ if (!view)
+ return IntSize();
+ return view->fixedLayoutSize();
+}
+
</ins><span class="cx"> void WebPage::listenForLayoutMilestones(uint32_t milestones)
</span><span class="cx"> {
</span><span class="cx"> if (!m_page)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -359,6 +359,7 @@
</span><span class="cx"> void setUseFixedLayout(bool);
</span><span class="cx"> bool useFixedLayout() const { return m_useFixedLayout; }
</span><span class="cx"> void setFixedLayoutSize(const WebCore::IntSize&);
</span><ins>+ WebCore::IntSize fixedLayoutSize() const;
</ins><span class="cx">
</span><span class="cx"> void listenForLayoutMilestones(uint32_t /* LayoutMilestones */);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Tools/ChangeLog        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-04-07 Tim Horton <timothy_horton@apple.com>
+
+ Expose and test fixedLayoutSize via modern WebKit SPI
+ https://bugs.webkit.org/show_bug.cgi?id=143500
+
+ Reviewed by Simon Fraser.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm: Added.
+ (-[FixedLayoutSizeNavigationDelegate webView:didFinishNavigation:]):
+ (TEST):
+ Add a test that verifies that fixedLayoutSize works at all, that
+ it persists through a navigation, and that turning it back off reverts to
+ laying out at the size of the view.
+
</ins><span class="cx"> 2015-04-07 Michael Catanzaro <mcatanzaro@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed. Add myself as a committer.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (182498 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-04-07 22:09:15 UTC (rev 182498)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">                 290A9BB91735F63800D71BBC /* OpenNewWindow.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290A9BB81735F42300D71BBC /* OpenNewWindow.html */; };
</span><span class="cx">                 290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
</span><span class="cx">                 297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
</span><ins>+                2D1FE0B01AD465C1006CD9E6 /* FixedLayoutSize.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */; };
</ins><span class="cx">                 2D950FBE1A2217D300012434 /* ActionMenusBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D950FBB1A2217D000012434 /* ActionMenusBundle.mm */; };
</span><span class="cx">                 2D950FC01A230C3A00012434 /* action-menu-targets.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2D950FBF1A230C1E00012434 /* action-menu-targets.html */; };
</span><span class="cx">                 2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
</span><span class="lines">@@ -449,6 +450,7 @@
</span><span class="cx">                 29AB8A9F164C735800D49BEC /* CustomProtocolsTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CustomProtocolsTest.mm; path = WebKit2ObjC/CustomProtocolsTest.mm; sourceTree = "<group>"; };
</span><span class="cx">                 29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; };
</span><span class="cx">                 29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; };
</span><ins>+                2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FixedLayoutSize.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2D950FBA1A2217D000012434 /* ActionMenus.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ActionMenus.mm; path = WebKit2ObjC/ActionMenus.mm; sourceTree = "<group>"; };
</span><span class="cx">                 2D950FBB1A2217D000012434 /* ActionMenusBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ActionMenusBundle.mm; path = WebKit2ObjC/ActionMenusBundle.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -811,6 +813,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */,
</span><span class="cx">                                 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
</span><ins>+                                2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */,
</ins><span class="cx">                                 1ABC3DED1899BE6D004F0626 /* Navigation.mm */,
</span><span class="cx">                                 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */,
</span><span class="cx">                                 C95501BE19AD2FAF0049BE3E /* Preferences.mm */,
</span><span class="lines">@@ -1562,6 +1565,7 @@
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><span class="cx">                                 7AA021BB1AB09EA70052953F /* DateMath.cpp in Sources */,
</span><ins>+                                2D1FE0B01AD465C1006CD9E6 /* FixedLayoutSize.mm in Sources */,
</ins><span class="cx">                                 1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */,
</span><span class="cx">                                 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */,
</span><span class="cx">                                 7AA6A1521AAC0B31002B2ED3 /* WorkQueue.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaFixedLayoutSizemm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm (0 => 182499)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm        2015-04-07 22:37:11 UTC (rev 182499)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKPreferences.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED
+
+static bool fixedLayoutSizeDone;
+static bool fixedLayoutSizeAfterNavigationDone;
+static bool fixedLayoutSizeDisabledDone;
+
+@interface FixedLayoutSizeNavigationDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation FixedLayoutSizeNavigationDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ // After navigating, fixed layout size should be persisted.
+ [webView evaluateJavaScript:@"document.body.clientWidth" completionHandler:^(id result, NSError *error) {
+ EXPECT_EQ(200, [result integerValue]);
+ fixedLayoutSizeAfterNavigationDone = true;
+ }];
+}
+
+@end
+
+TEST(WebKit2, FixedLayoutSize)
+{
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)]);
+
+ FixedLayoutSizeNavigationDelegate *delegate = [[FixedLayoutSizeNavigationDelegate alloc] init];
+ [webView setNavigationDelegate:delegate];
+
+ [webView evaluateJavaScript:@"document.body.clientWidth" completionHandler:^(id result, NSError *error) {
+ EXPECT_EQ(100, [result integerValue]);
+
+ [webView _setFixedLayoutEnabled:YES];
+ [webView _setFixedLayoutSize:NSMakeSize(200, 200)];
+
+ [webView evaluateJavaScript:@"document.body.clientWidth" completionHandler:^(id result, NSError *error) {
+ EXPECT_EQ(200, [result integerValue]);
+
+ fixedLayoutSizeDone = true;
+ }];
+ }];
+
+ TestWebKitAPI::Util::run(&fixedLayoutSizeDone);
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+
+ TestWebKitAPI::Util::run(&fixedLayoutSizeAfterNavigationDone);
+
+ [webView _setFixedLayoutEnabled:NO];
+ [webView evaluateJavaScript:@"document.body.clientWidth" completionHandler:^(id result, NSError *error) {
+ EXPECT_EQ(100, [result integerValue]);
+ fixedLayoutSizeDisabledDone = true;
+ }];
+
+ TestWebKitAPI::Util::run(&fixedLayoutSizeDisabledDone);
+}
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>