<!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>[171320] trunk/Source</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/171320">171320</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-07-21 16:44:33 -0700 (Mon, 21 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Turn off position:fixed behavior when the keyboard is up
https://bugs.webkit.org/show_bug.cgi?id=132537

Reviewed by Benjamin Poulain.

Source/WebCore:

Export RenderObject::localToContainerPoint().

* WebCore.exp.in:

Source/WebKit2:

Make interaction with form elements inside position:fixed less terrible by re-laying out
fixed elements relative to the document while we have an assisted node. This ensures
that all parts of a position:fixed are accessible (e.g. inputs on the right side
of a fixed-width top bar).

* Shared/AssistedNodeInformation.cpp: Add a flag for being inside postion:fixed,
and encode/decode it.
(WebKit::AssistedNodeInformation::encode):
(WebKit::AssistedNodeInformation::decode):
* Shared/AssistedNodeInformation.h:
(WebKit::AssistedNodeInformation::AssistedNodeInformation):
* UIProcess/PageClient.h: Add isAssistingNode().
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::isAssistingNode):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::computeCustomFixedPositionRect): If we have an assisted
node, just use the document rect as the custom fixed position rect.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getAssistedNodeInformation): Get the selection rect first,
since we have to fix it up for position:fixed. If the element is inside fixed
position in the main frame, re-set the fixed position rect to the document rect
(which forces a layout), re-fetch elementRect, then set it back. This ensures
that the UI process gets an elementRect which it can zoom to correctly.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAssistedNodeInformationcpp">trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedAssistedNodeInformationh">trunk/Source/WebKit2/Shared/AssistedNodeInformation.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebCore/ChangeLog        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-07-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Turn off position:fixed behavior when the keyboard is up
+        https://bugs.webkit.org/show_bug.cgi?id=132537
+
+        Reviewed by Benjamin Poulain.
+
+        Export RenderObject::localToContainerPoint().
+
+        * WebCore.exp.in:
+
</ins><span class="cx"> 2014-07-21  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [MSE] YouTube video decode error when variant-switching
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -1613,6 +1613,7 @@
</span><span class="cx"> __ZNK7WebCore12RenderObject15localToAbsoluteERKNS_10FloatPointEj
</span><span class="cx"> __ZNK7WebCore12RenderObject16repaintRectangleERKNS_10LayoutRectEb
</span><span class="cx"> __ZNK7WebCore12RenderObject20localToContainerQuadERKNS_9FloatQuadEPKNS_22RenderLayerModelObjectEjPb
</span><ins>+__ZNK7WebCore12RenderObject21localToContainerPointERKNS_10FloatPointEPKNS_22RenderLayerModelObjectEjPb
</ins><span class="cx"> __ZNK7WebCore12RenderObject23absoluteBoundingBoxRectEb
</span><span class="cx"> __ZNK7WebCore12RenderObject39pixelSnappedAbsoluteClippedOverflowRectEv
</span><span class="cx"> __ZNK7WebCore12RenderObject7childAtEj
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-07-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Turn off position:fixed behavior when the keyboard is up
+        https://bugs.webkit.org/show_bug.cgi?id=132537
+
+        Reviewed by Benjamin Poulain.
+        
+        Make interaction with form elements inside position:fixed less terrible by re-laying out
+        fixed elements relative to the document while we have an assisted node. This ensures
+        that all parts of a position:fixed are accessible (e.g. inputs on the right side
+        of a fixed-width top bar).
+        
+        * Shared/AssistedNodeInformation.cpp: Add a flag for being inside postion:fixed,
+        and encode/decode it.
+        (WebKit::AssistedNodeInformation::encode):
+        (WebKit::AssistedNodeInformation::decode):
+        * Shared/AssistedNodeInformation.h:
+        (WebKit::AssistedNodeInformation::AssistedNodeInformation):
+        * UIProcess/PageClient.h: Add isAssistingNode().
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::isAssistingNode):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::computeCustomFixedPositionRect): If we have an assisted
+        node, just use the document rect as the custom fixed position rect.
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::getAssistedNodeInformation): Get the selection rect first,
+        since we have to fix it up for position:fixed. If the element is inside fixed
+        position in the main frame, re-set the fixed position rect to the document rect
+        (which forces a layout), re-fetch elementRect, then set it back. This ensures
+        that the UI process gets an elementRect which it can zoom to correctly.
+
</ins><span class="cx"> 2014-07-21  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Random crashes on the Web Thread due to Timers firing on the wrong thread in the UI process
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAssistedNodeInformationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.cpp        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx">     encoder &lt;&lt; isMultiSelect;
</span><span class="cx">     encoder &lt;&lt; isReadOnly;
</span><span class="cx">     encoder &lt;&lt; allowsUserScaling;
</span><ins>+    encoder &lt;&lt; insideFixedPosition;
</ins><span class="cx">     encoder &lt;&lt; value;
</span><span class="cx">     encoder &lt;&lt; valueAsNumber;
</span><span class="cx">     encoder &lt;&lt; title;
</span><span class="lines">@@ -134,6 +135,9 @@
</span><span class="cx">     if (!decoder.decode(result.allowsUserScaling))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(result.insideFixedPosition))
+        return false;
+
</ins><span class="cx">     if (!decoder.decode(result.value))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAssistedNodeInformationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/AssistedNodeInformation.h (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/AssistedNodeInformation.h        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/Shared/AssistedNodeInformation.h        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -102,6 +102,7 @@
</span><span class="cx">         , isMultiSelect(false)
</span><span class="cx">         , isReadOnly(false)
</span><span class="cx">         , allowsUserScaling(false)
</span><ins>+        , insideFixedPosition(false)
</ins><span class="cx">         , autocapitalizeType(WebAutocapitalizeTypeDefault)
</span><span class="cx">         , elementType(InputType::None)
</span><span class="cx">         , selectedIndex(-1)
</span><span class="lines">@@ -120,6 +121,7 @@
</span><span class="cx">     bool isMultiSelect;
</span><span class="cx">     bool isReadOnly;
</span><span class="cx">     bool allowsUserScaling;
</span><ins>+    bool insideFixedPosition;
</ins><span class="cx">     WebAutocapitalizeType autocapitalizeType;
</span><span class="cx">     InputType elementType;
</span><span class="cx">     String formAction;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -259,6 +259,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) = 0;
</span><span class="cx">     virtual void stopAssistingNode() = 0;
</span><ins>+    virtual bool isAssistingNode() = 0;
</ins><span class="cx">     virtual void selectionDidChange() = 0;
</span><span class="cx">     virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&amp;, bool isCharEvent) = 0;
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -119,6 +119,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) override;
</span><span class="cx">     virtual void stopAssistingNode() override;
</span><ins>+    virtual bool isAssistingNode() override;
</ins><span class="cx">     virtual void selectionDidChange() override;
</span><span class="cx">     virtual bool interpretKeyEvent(const NativeWebKeyboardEvent&amp;, bool isCharEvent) override;
</span><span class="cx">     virtual void positionInformationDidChange(const InteractionInformationAtPosition&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -530,6 +530,11 @@
</span><span class="cx">     [m_contentView _startAssistingNode:nodeInformation userIsInteracting:userIsInteracting blurPreviousNode:blurPreviousNode userObject:userObject];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool PageClientImpl::isAssistingNode()
+{
+    return [m_contentView isAssistingNode];
+}
+
</ins><span class="cx"> void PageClientImpl::stopAssistingNode()
</span><span class="cx"> {
</span><span class="cx">     [m_contentView _stopAssistingNode];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import &quot;WKFormSelectControl.h&quot;
</span><span class="cx"> #import &quot;WKInspectorNodeSearchGestureRecognizer.h&quot;
</span><span class="cx"> #import &quot;WKWebViewConfiguration.h&quot;
</span><ins>+#import &quot;WKWebViewInternal.h&quot;
</ins><span class="cx"> #import &quot;WKWebViewPrivate.h&quot;
</span><span class="cx"> #import &quot;WebEvent.h&quot;
</span><span class="cx"> #import &quot;WebIOSEventFactory.h&quot;
</span><span class="lines">@@ -2548,6 +2549,10 @@
</span><span class="cx">         [self _startAssistingKeyboard];
</span><span class="cx">         break;
</span><span class="cx">     }
</span><ins>+    
+    if (information.insideFixedPosition)
+        [_webView _updateVisibleContentRects];
+
</ins><span class="cx">     [self reloadInputViews];
</span><span class="cx">     [self _displayFormNodeInputView];
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -220,6 +220,9 @@
</span><span class="cx">     FloatSize contentsSize = m_pageClient.contentsSize();
</span><span class="cx">     FloatRect documentRect = FloatRect(FloatPoint(), contentsSize);
</span><span class="cx"> 
</span><ins>+    if (m_pageClient.isAssistingNode())
+        return documentRect;
+
</ins><span class="cx">     if (constraint == UnobscuredRectConstraint::ConstrainedToDocumentRect)
</span><span class="cx">         constrainedUnobscuredRect.intersect(documentRect);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (171319 => 171320)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-07-21 23:10:44 UTC (rev 171319)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-07-21 23:44:33 UTC (rev 171320)
</span><span class="lines">@@ -1989,14 +1989,33 @@
</span><span class="cx"> {
</span><span class="cx">     layoutIfNeeded();
</span><span class="cx"> 
</span><ins>+    // FIXME: This should return the selection rect, but when this is called at focus time
+    // we don't have a selection yet. Using the last interaction location is a reasonable approximation for now.
+    // FIXME: should the selection rect always be inside the elementRect?
+    information.selectionRect = IntRect(m_lastInteractionLocation, IntSize(1, 1));
+
</ins><span class="cx">     if (RenderObject* renderer = m_assistedNode-&gt;renderer()) {
</span><del>-        information.elementRect = m_page-&gt;focusController().focusedOrMainFrame().view()-&gt;contentsToRootView(renderer-&gt;absoluteBoundingBoxRect());
</del><ins>+        Frame&amp; elementFrame = m_page-&gt;focusController().focusedOrMainFrame();
+        information.elementRect = elementFrame.view()-&gt;contentsToRootView(renderer-&gt;absoluteBoundingBoxRect());
</ins><span class="cx">         information.nodeFontSize = renderer-&gt;style().fontDescription().computedSize();
</span><ins>+
+        bool inFixed = false;
+        renderer-&gt;localToContainerPoint(FloatPoint(), nullptr, 0, &amp;inFixed);
+        information.insideFixedPosition = inFixed;
+        
+        if (inFixed &amp;&amp; elementFrame.isMainFrame()) {
+            FrameView* frameView = elementFrame.view();
+            IntRect currentFixedPositionRect = frameView-&gt;customFixedPositionLayoutRect();
+            frameView-&gt;setCustomFixedPositionLayoutRect(frameView-&gt;renderView()-&gt;documentRect());
+            information.elementRect = frameView-&gt;contentsToRootView(renderer-&gt;absoluteBoundingBoxRect());
+            frameView-&gt;setCustomFixedPositionLayoutRect(currentFixedPositionRect);
+            
+            if (!information.elementRect.contains(information.selectionRect))
+                information.selectionRect.setLocation(information.elementRect.location());
+        }
</ins><span class="cx">     } else
</span><span class="cx">         information.elementRect = IntRect();
</span><del>-    // FIXME: This should return the selection rect, but when this is called at focus time
-    // we don't have a selection yet. Using the last interaction location is a reasonable approximation for now.
-    information.selectionRect = IntRect(m_lastInteractionLocation, IntSize(1, 1));
</del><ins>+
</ins><span class="cx">     information.minimumScaleFactor = m_viewportConfiguration.minimumScale();
</span><span class="cx">     information.maximumScaleFactor = m_viewportConfiguration.maximumScale();
</span><span class="cx">     information.allowsUserScaling = m_viewportConfiguration.allowsUserScaling();
</span></span></pre>
</div>
</div>

</body>
</html>