<!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>[163916] 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/163916">163916</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2014-02-11 16:06:01 -0800 (Tue, 11 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Source/WebCore: Convert position:fixed property to position:absolute upon copy
https://bugs.webkit.org/show_bug.cgi?id=128194

Reviewed by Simon Fraser.

This adds a Setting and Preference that allows clients to opt-in to this behavior.

This new behavior is only activated if the entire body is copied. If there is a position:fixed
element in the copied selection, it is replaced with position:absolute, and a containing
block (position:relative) is wrapped around the copied text.

This patch originally converted position:-webkit-sticky to position:relative. However, we
currently don't support copying and pasting of position:-webkit-sticky content (See below).
Therefore, this patch only deals with position:fixed.

Right now we don't copy position:-webkit-sticky. This is because:
1. When copying styled elements, we parse the style properties again
2. CSSParserContext has a flag which can disable parsing -webkit-sticky
3. There are two constructors to CSSParserContext: one that takes a document and sets up the
aforementioned flag, and a simple one that doesn't take a document and sets all the enableFoo
flags to false
4. At the relevant place within copy code, we are far removed from the Document object, so we
instead call the second constructor, thereby disabling parsing of -webkit-sticky

Test: editing/pasteboard/copy-paste-converts-sticky-and-fixed.html

* WebCore.exp.in: Export the Setting setter
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::convertFixedAndStickyPosition): Converts a single style
* editing/EditingStyle.h:
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Remember if we found
an element which needs the position:relative containing block
(WebCore::StyledMarkupAccumulator::appendElement): Surround with the position:relative
containing block if necessary
(WebCore::createMarkupInternal):
* page/Settings.cpp:
(WebCore::Settings::Settings): New setting to opt-in to this new behavior
(WebCore::Settings::setConvertPositionStyleOnCopy):
* page/Settings.h:
(WebCore::Settings::convertPositionStyleOnCopy):
* testing/InternalSettings.cpp: Allow setting the setting from a Layout Test
(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setConvertPositionStyleOnCopy):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit/mac: Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
https://bugs.webkit.org/show_bug.cgi?id=128194

Reviewed by Simon Fraser.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences convertPositionStyleOnCopy]):
(-[WebPreferences setConvertPositionStyleOnCopy:]):
* WebView/WebPreferencesPrivate.h: Opt-in to new behavior
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2: Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
https://bugs.webkit.org/show_bug.cgi?id=128194

Reviewed by Simon Fraser.

* Shared/WebPreferencesStore.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetConvertPositionStyleOnCopy):
(WKPreferencesGetConvertPositionStyleOnCopy):
* UIProcess/API/C/WKPreferencesPrivate.h: Opt-in to new behavior
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests: Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
https://bugs.webkit.org/show_bug.cgi?id=128194

Reviewed by Simon Fraser.

Checks that the style properties get converted.

* editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt: Added.
* editing/pasteboard/copy-paste-converts-sticky-and-fixed.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingStylecpp">trunk/Source/WebCore/editing/EditingStyle.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingStyleh">trunk/Source/WebCore/editing/EditingStyle.h</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingsin">trunk/Source/WebCore/page/Settings.in</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingscpp">trunk/Source/WebCore/testing/InternalSettings.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsh">trunk/Source/WebCore/testing/InternalSettings.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsidl">trunk/Source/WebCore/testing/InternalSettings.idl</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedWebPreferencesStoreh">trunk/Source/WebKit2/Shared/WebPreferencesStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPreferencescpp">trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKPreferencesPrivateh">trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingpasteboardcopypasteconvertsstickyandfixedexpectedtxt">trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingpasteboardcopypasteconvertsstickyandfixedhtml">trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/LayoutTests/ChangeLog        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-02-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
+        https://bugs.webkit.org/show_bug.cgi?id=128194
+
+        Reviewed by Simon Fraser.
+
+        Checks that the style properties get converted.
+
+        * editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt: Added.
+        * editing/pasteboard/copy-paste-converts-sticky-and-fixed.html: Added.
+
</ins><span class="cx"> 2014-02-11  Youenn Fablet  &lt;youennf@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         XMLHttpRequest should not send DNT header
</span></span></pre></div>
<a id="trunkLayoutTestseditingpasteboardcopypasteconvertsstickyandfixedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt (0 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste
+
+first test - before:
+| &lt;html&gt;
+|   &lt;head&gt;
+|     &quot;
+&quot;
+|     &lt;meta&gt;
+|       content=&quot;text/html; charset=utf-8&quot;
+|       http-equiv=&quot;Content-type&quot;
+|     &quot;
+&quot;
+|     &lt;script&gt;
+|       src=&quot;../../resources/dump-as-markup.js&quot;
+|       type=&quot;text/javascript&quot;
+|     &quot;
+&quot;
+|   &quot;
+&quot;
+|   &lt;body&gt;
+|     &quot;
+abc&quot;
+|     &lt;div&gt;
+|       style=&quot;position: fixed; left: 0px; top: 0px;&quot;
+|       &quot;def&quot;
+|     &quot;ghi
+&quot;
+|     &lt;br&gt;
+|     &quot;
+
+&quot;
+|     &lt;script&gt;
+|       &quot;
+
+Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+    window.internals.settings.setConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand(&quot;SelectAll&quot;);
+document.execCommand(&quot;Cut&quot;);
+document.execCommand(&quot;Paste&quot;);
+Markup.dump('test1', 'first test - after');
+
+&quot;
+
+first test - after:
+| &lt;html&gt;
+|   &lt;head&gt;
+|     &quot;
+&quot;
+|     &lt;meta&gt;
+|       content=&quot;text/html; charset=utf-8&quot;
+|       http-equiv=&quot;Content-type&quot;
+|     &quot;
+&quot;
+|     &lt;script&gt;
+|       src=&quot;../../resources/dump-as-markup.js&quot;
+|       type=&quot;text/javascript&quot;
+|     &quot;
+&quot;
+|   &quot;
+&quot;
+|   &lt;body&gt;
+|     &lt;div&gt;
+|       style=&quot;position: relative;&quot;
+|       &quot;abc&quot;
+|       &lt;div&gt;
+|         style=&quot;position: absolute; left: 0px; top: 0px;&quot;
+|         &quot;def&quot;
+|       &quot;ghi &lt;#selection-caret&gt;&quot;
+|     &quot;
+
+&quot;
+|     &lt;script&gt;
+|       &quot;
+
+Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+    window.internals.settings.setConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand(&quot;SelectAll&quot;);
+document.execCommand(&quot;Cut&quot;);
+document.execCommand(&quot;Paste&quot;);
+Markup.dump('test1', 'first test - after');
+
+&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestseditingpasteboardcopypasteconvertsstickyandfixedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html (0 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html                                (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;meta http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
+&lt;script type=&quot;text/javascript&quot; src=&quot;../../resources/dump-as-markup.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+abc&lt;div style=&quot;position: fixed; left: 0px; top: 0px;&quot;&gt;def&lt;/div&gt;ghi
+&lt;br/&gt;
+
+&lt;script&gt;
+
+Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+    window.internals.settings.setConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand(&quot;SelectAll&quot;);
+document.execCommand(&quot;Cut&quot;);
+document.execCommand(&quot;Paste&quot;);
+Markup.dump('test1', 'first test - after');
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/ChangeLog        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2014-02-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Convert position:fixed property to position:absolute upon copy
+        https://bugs.webkit.org/show_bug.cgi?id=128194
+
+        Reviewed by Simon Fraser.
+
+        This adds a Setting and Preference that allows clients to opt-in to this behavior.
+
+        This new behavior is only activated if the entire body is copied. If there is a position:fixed
+        element in the copied selection, it is replaced with position:absolute, and a containing
+        block (position:relative) is wrapped around the copied text.
+
+        This patch originally converted position:-webkit-sticky to position:relative. However, we
+        currently don't support copying and pasting of position:-webkit-sticky content (See below).
+        Therefore, this patch only deals with position:fixed.
+
+        Right now we don't copy position:-webkit-sticky. This is because:
+        1. When copying styled elements, we parse the style properties again
+        2. CSSParserContext has a flag which can disable parsing -webkit-sticky
+        3. There are two constructors to CSSParserContext: one that takes a document and sets up the
+        aforementioned flag, and a simple one that doesn't take a document and sets all the enableFoo
+        flags to false
+        4. At the relevant place within copy code, we are far removed from the Document object, so we
+        instead call the second constructor, thereby disabling parsing of -webkit-sticky
+
+        Test: editing/pasteboard/copy-paste-converts-sticky-and-fixed.html
+
+        * WebCore.exp.in: Export the Setting setter
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::convertFixedAndStickyPosition): Converts a single style
+        * editing/EditingStyle.h:
+        * editing/markup.cpp:
+        (WebCore::StyledMarkupAccumulator::StyledMarkupAccumulator): Remember if we found
+        an element which needs the position:relative containing block
+        (WebCore::StyledMarkupAccumulator::appendElement): Surround with the position:relative
+        containing block if necessary
+        (WebCore::createMarkupInternal):
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings): New setting to opt-in to this new behavior
+        (WebCore::Settings::setConvertPositionStyleOnCopy):
+        * page/Settings.h:
+        (WebCore::Settings::convertPositionStyleOnCopy):
+        * testing/InternalSettings.cpp: Allow setting the setting from a Layout Test
+        (WebCore::InternalSettings::Backup::Backup):
+        (WebCore::InternalSettings::Backup::restoreTo):
+        (WebCore::InternalSettings::setConvertPositionStyleOnCopy):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
</ins><span class="cx"> 2014-02-11  Youenn Fablet  &lt;youennf@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         XMLHttpRequest should not send DNT header
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingStyle.cpp        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1221,6 +1221,20 @@
</span><span class="cx">     m_mutableStyle-&gt;setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsImportant);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool EditingStyle::convertFixedAndStickyPosition()
+{
+    if (!m_mutableStyle)
+        return false;
+
+    RefPtr&lt;CSSPrimitiveValue&gt; sticky = cssValuePool().createIdentifierValue(CSSValueWebkitSticky);
+    RefPtr&lt;CSSPrimitiveValue&gt; fixed = cssValuePool().createIdentifierValue(CSSValueFixed);
+    if (m_mutableStyle-&gt;propertyMatches(CSSPropertyPosition, fixed.get())) {
+        m_mutableStyle-&gt;setProperty(CSSPropertyPosition, cssValuePool().createIdentifierValue(CSSValueAbsolute), m_mutableStyle-&gt;propertyIsImportant(CSSPropertyPosition));
+        return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> int EditingStyle::legacyFontSize(Document* document) const
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSValue&gt; cssValue = m_mutableStyle-&gt;getPropertyCSSValue(CSSPropertyFontSize);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingStyle.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingStyle.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/editing/EditingStyle.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -135,6 +135,7 @@
</span><span class="cx">     void removeStyleFromRulesAndContext(StyledElement*, Node* context);
</span><span class="cx">     void removePropertiesInElementDefaultStyle(Element*);
</span><span class="cx">     void forceInline();
</span><ins>+    bool convertFixedAndStickyPosition();
</ins><span class="cx">     int legacyFontSize(Document*) const;
</span><span class="cx"> 
</span><span class="cx">     float fontSizeDelta() const { return m_fontSizeDelta; }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/editing/markup.cpp        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> #include &quot;MarkupAccumulator.h&quot;
</span><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &quot;RenderBlock.h&quot;
</span><ins>+#include &quot;Settings.h&quot;
</ins><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="cx"> #include &quot;VisibleSelection.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="lines">@@ -122,6 +123,11 @@
</span><span class="cx">     void wrapWithNode(Node&amp;, bool convertBlocksToInlines = false, RangeFullySelectsNode = DoesFullySelectNode);
</span><span class="cx">     void wrapWithStyleNode(StyleProperties*, Document&amp;, bool isBlock = false);
</span><span class="cx">     String takeResults();
</span><ins>+    
+    bool needRelativeStyleWrapper() const
+    {
+        return m_needRelativeStyleWrapper;
+    }
</ins><span class="cx"> 
</span><span class="cx">     using MarkupAccumulator::appendString;
</span><span class="cx"> 
</span><span class="lines">@@ -157,13 +163,14 @@
</span><span class="cx">     const EAnnotateForInterchange m_shouldAnnotate;
</span><span class="cx">     Node* m_highestNodeToBeSerialized;
</span><span class="cx">     RefPtr&lt;EditingStyle&gt; m_wrappingStyle;
</span><ins>+    bool m_needRelativeStyleWrapper;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline StyledMarkupAccumulator::StyledMarkupAccumulator(Vector&lt;Node*&gt;* nodes, EAbsoluteURLs shouldResolveURLs, EAnnotateForInterchange shouldAnnotate,
-    const Range* range, Node* highestNodeToBeSerialized)
</del><ins>+inline StyledMarkupAccumulator::StyledMarkupAccumulator(Vector&lt;Node*&gt;* nodes, EAbsoluteURLs shouldResolveURLs, EAnnotateForInterchange shouldAnnotate, const Range* range, Node* highestNodeToBeSerialized)
</ins><span class="cx">     : MarkupAccumulator(nodes, shouldResolveURLs, range)
</span><span class="cx">     , m_shouldAnnotate(shouldAnnotate)
</span><span class="cx">     , m_highestNodeToBeSerialized(highestNodeToBeSerialized)
</span><ins>+    , m_needRelativeStyleWrapper(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -317,6 +324,9 @@
</span><span class="cx"> 
</span><span class="cx">             if (addDisplayInline)
</span><span class="cx">                 newInlineStyle-&gt;forceInline();
</span><ins>+            
+            if (element.document().settings() &amp;&amp; element.document().settings()-&gt;convertPositionStyleOnCopy())
+                m_needRelativeStyleWrapper |= newInlineStyle-&gt;convertFixedAndStickyPosition();
</ins><span class="cx"> 
</span><span class="cx">             // If the node is not fully selected by the range, then we don't want to keep styles that affect its relationship to the nodes around it
</span><span class="cx">             // only the ones that affect it and the nodes within it.
</span><span class="lines">@@ -613,6 +623,12 @@
</span><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    
+    if (accumulator.needRelativeStyleWrapper() &amp;&amp; body &amp;&amp; fullySelectedRoot == body) {
+        RefPtr&lt;EditingStyle&gt; positionRelativeStyle = styleFromMatchedRulesAndInlineDecl(body);
+        positionRelativeStyle-&gt;style()-&gt;setProperty(CSSPropertyPosition, CSSValueRelative);
+        accumulator.wrapWithStyleNode(positionRelativeStyle-&gt;style(), document, true);
+    }
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: The interchange newline should be placed in the block that it's in, not after all of the content, unconditionally.
</span><span class="cx">     if (shouldAnnotate == AnnotateForInterchange &amp;&amp; needInterchangeNewlineAfter(visibleEnd.previous()))
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.in (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.in        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/page/Settings.in        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -204,3 +204,5 @@
</span><span class="cx"> allowMultiElementImplicitSubmission initial=false
</span><span class="cx"> 
</span><span class="cx"> mediaPlaybackAllowsAirPlay initial=true, conditional=IOS_AIRPLAY
</span><ins>+
+convertPositionStyleOnCopy initial=false
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.cpp        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -94,6 +94,7 @@
</span><span class="cx">     , m_useLegacyBackgroundSizeShorthandBehavior(settings.useLegacyBackgroundSizeShorthandBehavior())
</span><span class="cx">     , m_autoscrollForDragAndDropEnabled(settings.autoscrollForDragAndDropEnabled())
</span><span class="cx">     , m_pluginReplacementEnabled(RuntimeEnabledFeatures::sharedFeatures().pluginReplacementEnabled())
</span><ins>+    , m_convertPositionStyleOnCopy(settings.convertPositionStyleOnCopy())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -155,6 +156,7 @@
</span><span class="cx">     settings.setTimeWithoutMouseMovementBeforeHidingControls(m_originalTimeWithoutMouseMovementBeforeHidingControls);
</span><span class="cx">     settings.setUseLegacyBackgroundSizeShorthandBehavior(m_useLegacyBackgroundSizeShorthandBehavior);
</span><span class="cx">     settings.setAutoscrollForDragAndDropEnabled(m_autoscrollForDragAndDropEnabled);
</span><ins>+    settings.setConvertPositionStyleOnCopy(m_convertPositionStyleOnCopy);
</ins><span class="cx">     RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(m_pluginReplacementEnabled);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -527,4 +529,10 @@
</span><span class="cx">     settings()-&gt;setBackgroundShouldExtendBeyondPage(hasExtendedBackground);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InternalSettings::setConvertPositionStyleOnCopy(bool convert, ExceptionCode&amp; ec)
+{
+    InternalSettingsGuardForSettings();
+    settings()-&gt;setConvertPositionStyleOnCopy(convert);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/testing/InternalSettings.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx">         bool m_useLegacyBackgroundSizeShorthandBehavior;
</span><span class="cx">         bool m_autoscrollForDragAndDropEnabled;
</span><span class="cx">         bool m_pluginReplacementEnabled;
</span><ins>+        bool m_convertPositionStyleOnCopy;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static PassRefPtr&lt;InternalSettings&gt; create(Page* page)
</span><span class="lines">@@ -136,6 +137,7 @@
</span><span class="cx">     void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&amp;);
</span><span class="cx">     void setPluginReplacementEnabled(bool);
</span><span class="cx">     void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&amp;);
</span><ins>+    void setConvertPositionStyleOnCopy(bool convert, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.idl (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.idl        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebCore/testing/InternalSettings.idl        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -60,4 +60,5 @@
</span><span class="cx">     [RaisesException] void setFontFallbackPrefersPictographs(boolean preferPictographs);
</span><span class="cx">     void setPluginReplacementEnabled(boolean enabled);
</span><span class="cx">     [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);
</span><ins>+    [RaisesException] void setConvertPositionStyleOnCopy(boolean convert);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-02-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
+        https://bugs.webkit.org/show_bug.cgi?id=128194
+
+        Reviewed by Simon Fraser.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences convertPositionStyleOnCopy]):
+        (-[WebPreferences setConvertPositionStyleOnCopy:]):
+        * WebView/WebPreferencesPrivate.h: Opt-in to new behavior
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
</ins><span class="cx"> 2014-02-11  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Mac] connection:willStopBufferingData: no longer exists in NSURLConnectionDelegate
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -146,6 +146,7 @@
</span><span class="cx"> #define WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey @&quot;WebKitLowPowerVideoAudioBufferSizeEnabled&quot;
</span><span class="cx"> #define WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey @&quot;WebKitUseLegacyTextAlignPositionedElementBehavior&quot;
</span><span class="cx"> #define WebKitMediaSourceEnabledPreferenceKey @&quot;WebKitMediaSourceEnabled&quot;
</span><ins>+#define WebKitConvertPositionStyleOnCopyPreferenceKey @&quot;WebKitConvertPositionStyleOnCopy&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span><span class="cx"> // These are private both because callers should be using the cover methods and because the
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -2535,6 +2535,16 @@
</span><span class="cx">     [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (BOOL)convertPositionStyleOnCopy
+{
+    return [self _boolValueForKey:WebKitConvertPositionStyleOnCopyPreferenceKey];
+}
+
+- (void)setConvertPositionStyleOnCopy:(BOOL)enabled
+{
+    [self _setBoolValue:enabled forKey:WebKitConvertPositionStyleOnCopyPreferenceKey];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WebPreferences (WebInternal)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -432,4 +432,7 @@
</span><span class="cx"> - (void)setMediaSourceEnabled:(BOOL)flag;
</span><span class="cx"> - (BOOL)mediaSourceEnabled;
</span><span class="cx"> 
</span><ins>+- (void)setConvertPositionStyleOnCopy:(BOOL)flag;
+- (BOOL)convertPositionStyleOnCopy;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -2378,6 +2378,8 @@
</span><span class="cx">     settings.setMediaSourceEnabled([preferences mediaSourceEnabled]);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    settings.setConvertPositionStyleOnCopy([preferences convertPositionStyleOnCopy]);
+
</ins><span class="cx">     switch ([preferences storageBlockingPolicy]) {
</span><span class="cx">     case WebAllowAllStorage:
</span><span class="cx">         settings.setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-02-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Convert position:sticky and position:fixed properties to position:static and position:absolute upon copy
+        https://bugs.webkit.org/show_bug.cgi?id=128194
+
+        Reviewed by Simon Fraser.
+
+        * Shared/WebPreferencesStore.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetConvertPositionStyleOnCopy):
+        (WKPreferencesGetConvertPositionStyleOnCopy):
+        * UIProcess/API/C/WKPreferencesPrivate.h: Opt-in to new behavior
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
</ins><span class="cx"> 2014-02-11  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] Rename screenToWindow to screenToRootView and windowToScreen to rootViewToScreen
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebPreferencesStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -190,6 +190,7 @@
</span><span class="cx">     macro(SpatialNavigationEnabled, spatialNavigationEnabled, Bool, bool, false) \
</span><span class="cx">     macro(MediaSourceEnabled, mediaSourceEnabled, Bool, bool, false) \
</span><span class="cx">     macro(ViewGestureDebuggingEnabled, viewGestureDebuggingEnabled, Bool, bool, false) \
</span><ins>+    macro(ConvertPositionStyleOnCopy, convertPositionStyleOnCopy, Bool, bool, false) \
</ins><span class="cx">     \
</span><span class="cx"> 
</span><span class="cx"> #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPreferencescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -1235,3 +1235,13 @@
</span><span class="cx"> {
</span><span class="cx">     return toImpl(preferencesRef)-&gt;viewGestureDebuggingEnabled();
</span><span class="cx"> }
</span><ins>+
+void WKPreferencesSetConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef, bool convert)
+{
+    toImpl(preferencesRef)-&gt;setConvertPositionStyleOnCopy(convert);
+}
+
+bool WKPreferencesGetConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)-&gt;convertPositionStyleOnCopy();
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKPreferencesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -314,6 +314,10 @@
</span><span class="cx"> WK_EXPORT void WKPreferencesSetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef, bool enabled);
</span><span class="cx"> WK_EXPORT bool WKPreferencesGetViewGestureDebuggingEnabled(WKPreferencesRef preferencesRef);
</span><span class="cx"> 
</span><ins>+// Default to false.
+WK_EXPORT void WKPreferencesSetConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef, bool convert);
+WK_EXPORT bool WKPreferencesGetConvertPositionStyleOnCopy(WKPreferencesRef preferencesRef);
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (163915 => 163916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-12 00:02:31 UTC (rev 163915)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-02-12 00:06:01 UTC (rev 163916)
</span><span class="lines">@@ -2575,6 +2575,8 @@
</span><span class="cx">     settings.setMediaSourceEnabled(store.getBoolValueForKey(WebPreferencesKey::mediaSourceEnabledKey()));
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    settings.setConvertPositionStyleOnCopy(store.getBoolValueForKey(WebPreferencesKey::convertPositionStyleOnCopyKey()));
+
</ins><span class="cx">     if (store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey())) {
</span><span class="cx">         if (m_processSuppressionDisabledByWebPreference.isActive())
</span><span class="cx">             m_processSuppressionDisabledByWebPreference.endActivity();
</span></span></pre>
</div>
</div>

</body>
</html>