<!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>[170667] 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/170667">170667</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2014-07-01 14:16:14 -0700 (Tue, 01 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa][Mac] WKWebView should automatically set topContentInset when beneath a toolbar
&lt;rdar://problem/17523159&gt;
https://bugs.webkit.org/show_bug.cgi?id=134496

Reviewed by Beth Dakin.


Source/WebKit2: 
- Adds _automaticallyAdjustsContentInsets SPI to both WKView and WKWebView.
- Defaults _automaticallyAdjustsContentInsets to NO for WKView to keep legacy clients working.
- Defaults _automaticallyAdjustsContentInsets to YES for WKWebView.

* UIProcess/API/Cocoa/WKViewPrivate.h:
Add _automaticallyAdjustsContentInsets SPI.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
Default _automaticallyAdjustsContentInsets to YES for WKWebView.

(-[WKWebView _setTopContentInset:]):
(-[WKWebView _topContentInset]):
Change to forward to the WKView, since we now do coalescing and caching there.

(-[WKWebView _setAutomaticallyAdjustsContentInsets:]):
(-[WKWebView _automaticallyAdjustsContentInsets]):
Forward to the WKView.

* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Add _automaticallyAdjustsContentInsets SPI.

* UIProcess/API/mac/WKView.mm:
(-[WKView renewGState]):
Ensure the contentInset is updated when the view changes, as its relative location to the toolbar may have changed.

(-[WKView addWindowObserversForWindow:]):
(-[WKView removeWindowObservers]):
(-[WKView observeValueForKeyPath:ofObject:change:context:]):
Add observers for the contentLayoutRect and titlebarAppearsTransparent properties on the window. If either of them
change, we need to recalculate the content inset.

(-[WKView _updateContentInsetsIfAutomatic]):
If _automaticallyAdjustsContentInsets is YES, follow the same rules as AppKit in setting the top content inset. Like
AppKit this is only done when:
    - The window's style mask has the NSFullSizeContentViewWindowMask bit.
    - The window does not have titlebarAppearsTransparent set.
    - And we are not in an enclosing NSScrollView.

(-[WKView _setTopContentInset:]):
(-[WKView _topContentInset]):
Coalesce setting the topContentInset to avoid a visual lag when resizing the window that was caused by us sending
multiple topContentInsets to the WebContentProcess per runloop cycle. The reason for the lag was that at the time
we observe the contentLayoutRect changing, our view may not yet be in its final position yet, so the inset will be
temporarily wrong. When the view is finally positioned correctly, we will get a renewGState, at which point we will
again calculate the inset, which now will be correct. Since these both happen in the same runloop iteration, we can
just defer sending the inset to the WebContentProcess.

(-[WKView _setAutomaticallyAdjustsContentInsets:]):
(-[WKView _automaticallyAdjustsContentInsets]):
Add the new SPI.

Tools: 
* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController windowDidLoad]):
Use the NSFullSizeContentViewWindowMask bit on Yosemite and later to enable toolbar blurring.</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="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsMiniBrowsermacBrowserWindowControllerm">trunk/Tools/MiniBrowser/mac/BrowserWindowController.m</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2014-07-01  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [Cocoa][Mac] WKWebView should automatically set topContentInset when beneath a toolbar
+        &lt;rdar://problem/17523159&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=134496
+
+        Reviewed by Beth Dakin.
+
+        - Adds _automaticallyAdjustsContentInsets SPI to both WKView and WKWebView.
+        - Defaults _automaticallyAdjustsContentInsets to NO for WKView to keep legacy clients working.
+        - Defaults _automaticallyAdjustsContentInsets to YES for WKWebView.
+
+        * UIProcess/API/Cocoa/WKViewPrivate.h:
+        Add _automaticallyAdjustsContentInsets SPI.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        Default _automaticallyAdjustsContentInsets to YES for WKWebView.
+
+        (-[WKWebView _setTopContentInset:]):
+        (-[WKWebView _topContentInset]):
+        Change to forward to the WKView, since we now do coalescing and caching there.
+
+        (-[WKWebView _setAutomaticallyAdjustsContentInsets:]):
+        (-[WKWebView _automaticallyAdjustsContentInsets]):
+        Forward to the WKView.
+
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        Add _automaticallyAdjustsContentInsets SPI.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView renewGState]):
+        Ensure the contentInset is updated when the view changes, as its relative location to the toolbar may have changed.
+
+        (-[WKView addWindowObserversForWindow:]):
+        (-[WKView removeWindowObservers]):
+        (-[WKView observeValueForKeyPath:ofObject:change:context:]):
+        Add observers for the contentLayoutRect and titlebarAppearsTransparent properties on the window. If either of them
+        change, we need to recalculate the content inset.
+
+        (-[WKView _updateContentInsetsIfAutomatic]):
+        If _automaticallyAdjustsContentInsets is YES, follow the same rules as AppKit in setting the top content inset. Like
+        AppKit this is only done when:
+            - The window's style mask has the NSFullSizeContentViewWindowMask bit.
+            - The window does not have titlebarAppearsTransparent set.
+            - And we are not in an enclosing NSScrollView.
+
+        (-[WKView _setTopContentInset:]):
+        (-[WKView _topContentInset]):
+        Coalesce setting the topContentInset to avoid a visual lag when resizing the window that was caused by us sending
+        multiple topContentInsets to the WebContentProcess per runloop cycle. The reason for the lag was that at the time
+        we observe the contentLayoutRect changing, our view may not yet be in its final position yet, so the inset will be
+        temporarily wrong. When the view is finally positioned correctly, we will get a renewGState, at which point we will
+        again calculate the inset, which now will be correct. Since these both happen in the same runloop iteration, we can
+        just defer sending the inset to the WebContentProcess.
+
+        (-[WKView _setAutomaticallyAdjustsContentInsets:]):
+        (-[WKView _automaticallyAdjustsContentInsets]):
+        Add the new SPI.
+
</ins><span class="cx"> 2014-07-01  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add a function for restoring page state given a SessionState object
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -83,6 +83,10 @@
</span><span class="cx"> @property (readwrite) BOOL allowsBackForwardNavigationGestures;
</span><span class="cx"> @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+@property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
+#endif
+
</ins><span class="cx"> @property (readonly) NSColor *_pageExtendedBackgroundColor;
</span><span class="cx"> @property(copy, nonatomic) NSColor *underlayColor;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -306,7 +306,11 @@
</span><span class="cx">     _wkView = [[WKView alloc] initWithFrame:bounds context:context configuration:std::move(webPageConfiguration) webView:self];
</span><span class="cx">     [self addSubview:_wkView.get()];
</span><span class="cx">     _page = WebKit::toImpl([_wkView pageRef]);
</span><ins>+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+    [_wkView _setAutomaticallyAdjustsContentInsets:YES];
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     _page-&gt;setBackgroundExtendsBeyondPage(true);
</span><span class="cx"> 
</span><span class="lines">@@ -2240,16 +2244,30 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_setTopContentInset:(CGFloat)contentInset
</span><span class="cx"> {
</span><del>-    _page-&gt;setTopContentInset(contentInset);
</del><ins>+    [_wkView _setTopContentInset:contentInset];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CGFloat)_topContentInset
</span><span class="cx"> {
</span><del>-    return _page-&gt;topContentInset();
</del><ins>+    return [_wkView _topContentInset];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+- (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
+{
+    [_wkView _setAutomaticallyAdjustsContentInsets:automaticallyAdjustsContentInsets];
+}
+
+- (BOOL)_automaticallyAdjustsContentInsets
+{
+    return [_wkView _automaticallyAdjustsContentInsets];
+}
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#endif
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -146,7 +146,10 @@
</span><span class="cx"> @property (readonly) NSColor *_pageExtendedBackgroundColor;
</span><span class="cx"> @property (nonatomic, setter=_setDrawsTransparentBackground:) BOOL _drawsTransparentBackground;
</span><span class="cx"> @property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+@property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> - (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
</span><span class="cx"> - (void)_getWebArchiveDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -241,6 +241,13 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CALayer&gt; _rootLayer;
</span><span class="cx"> 
</span><ins>+    BOOL _didScheduleSetTopContentInset;
+    CGFloat _topContentInset;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+    BOOL _automaticallyAdjustsContentInsets;
+#endif
+
</ins><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">     _WKThumbnailView *_thumbnailView;
</span><span class="cx"> #endif
</span><span class="lines">@@ -481,6 +488,10 @@
</span><span class="cx">     if ([self window])
</span><span class="cx">         [self _updateWindowAndViewFrames];
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+    [self _updateContentInsetsIfAutomatic];
+#endif
+
</ins><span class="cx">     [super renewGState];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2402,6 +2413,10 @@
</span><span class="cx">     return NSMouseInRect(localPoint, visibleThumbRect, [self isFlipped]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+static void* keyValueObservingContext = &amp;keyValueObservingContext;
+#endif
+
</ins><span class="cx"> - (void)addWindowObserversForWindow:(NSWindow *)window
</span><span class="cx"> {
</span><span class="cx">     if (window) {
</span><span class="lines">@@ -2431,6 +2446,10 @@
</span><span class="cx">         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeOcclusionState:)
</span><span class="cx">                                                      name:NSWindowDidChangeOcclusionStateNotification object:window];
</span><span class="cx"> #endif
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+        [window addObserver:self forKeyPath:@&quot;contentLayoutRect&quot; options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
+        [window addObserver:self forKeyPath:@&quot;titlebarAppearsTransparent&quot; options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
+#endif
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2455,6 +2474,10 @@
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090
</span><span class="cx">     [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
</span><span class="cx"> #endif
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+    [window removeObserver:self forKeyPath:@&quot;contentLayoutRect&quot; context:keyValueObservingContext];
+    [window removeObserver:self forKeyPath:@&quot;titlebarAppearsTransparent&quot; context:keyValueObservingContext];
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)viewWillMoveToWindow:(NSWindow *)window
</span><span class="lines">@@ -3550,6 +3573,35 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // WK_API_ENABLED
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+- (void)_updateContentInsetsIfAutomatic
+{
+    if (!self._automaticallyAdjustsContentInsets)
+        return;
+
+    if ((self.window.styleMask &amp; NSFullSizeContentViewWindowMask) &amp;&amp; !self.window.titlebarAppearsTransparent &amp;&amp; ![self enclosingScrollView]) {
+        NSRect contentLayoutRect = [self convertRect:self.window.contentLayoutRect fromView:nil];
+        CGFloat newTopContentInset = NSMaxY(contentLayoutRect) - NSHeight(contentLayoutRect);
+        if (self._topContentInset != newTopContentInset)
+            self._topContentInset = newTopContentInset;
+    } else
+        self._topContentInset = 0;
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    if (context == keyValueObservingContext) {
+        if ([keyPath isEqualToString:@&quot;contentLayoutRect&quot;] || [keyPath isEqualToString:@&quot;titlebarAppearsTransparent&quot;])
+            [self _updateContentInsetsIfAutomatic];
+        return;
+    }
+
+    [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+}
+
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKView (Private)
</span><span class="lines">@@ -3835,12 +3887,23 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_setTopContentInset:(CGFloat)contentInset
</span><span class="cx"> {
</span><del>-    _data-&gt;_page-&gt;setTopContentInset(contentInset);
</del><ins>+    _data-&gt;_topContentInset = contentInset;
+
+    if (_data-&gt;_didScheduleSetTopContentInset)
+        return;
+
+    _data-&gt;_didScheduleSetTopContentInset = YES;
+
+    dispatch_async(dispatch_get_main_queue(), ^{
+        _data-&gt;_didScheduleSetTopContentInset = NO;
+
+        _data-&gt;_page-&gt;setTopContentInset(_data-&gt;_topContentInset);
+    });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CGFloat)_topContentInset
</span><span class="cx"> {
</span><del>-    return _data-&gt;_page-&gt;topContentInset();
</del><ins>+    return _data-&gt;_topContentInset;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSColor *)_pageExtendedBackgroundColor
</span><span class="lines">@@ -3988,6 +4051,21 @@
</span><span class="cx">     return handledEvent;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+- (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
+{
+    _data-&gt;_automaticallyAdjustsContentInsets = automaticallyAdjustsContentInsets;
+    [self _updateContentInsetsIfAutomatic];
+}
+
+- (BOOL)_automaticallyAdjustsContentInsets
+{
+    return _data-&gt;_automaticallyAdjustsContentInsets;
+}
+
+#endif
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKResponderChainSink
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Tools/ChangeLog        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-07-01  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        [Cocoa][Mac] WKWebView should automatically set topContentInset when beneath a toolbar
+        &lt;rdar://problem/17523159&gt;
+        https://bugs.webkit.org/show_bug.cgi?id=134496
+
+        Reviewed by Beth Dakin.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController windowDidLoad]):
+        Use the NSFullSizeContentViewWindowMask bit on Yosemite and later to enable toolbar blurring.
+
</ins><span class="cx"> 2014-07-01  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CMake] Add necessary support for building for the Wayland target
</span></span></pre></div>
<a id="trunkToolsMiniBrowsermacBrowserWindowControllerm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/MiniBrowser/mac/BrowserWindowController.m (170666 => 170667)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2014-07-01 21:13:42 UTC (rev 170666)
+++ trunk/Tools/MiniBrowser/mac/BrowserWindowController.m        2014-07-01 21:16:14 UTC (rev 170667)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)windowDidLoad
</span><span class="cx"> {
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+    self.window.styleMask |= NSFullSizeContentViewWindowMask;
+#endif
+
</ins><span class="cx">     [super windowDidLoad];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>