Diff
Modified: trunk/LayoutTests/ChangeLog (164298 => 164299)
--- trunk/LayoutTests/ChangeLog 2014-02-18 19:10:38 UTC (rev 164298)
+++ trunk/LayoutTests/ChangeLog 2014-02-18 19:32:54 UTC (rev 164299)
@@ -1,3 +1,17 @@
+2014-02-18 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Convert position:sticky to position:static upon copy and paste
+ https://bugs.webkit.org/show_bug.cgi?id=128982
+
+ Reviewed by Simon Fraser.
+
+ * editing/pasteboard/copy-paste-converts-fixed-expected.txt: Copied from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt.
+ * editing/pasteboard/copy-paste-converts-fixed.html: Copied from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html.
+ * editing/pasteboard/copy-paste-converts-sticky-expected.txt: Copied from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt.
+ * editing/pasteboard/copy-paste-converts-sticky.html: Copied from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html.
+ * editing/pasteboard/copy-paste-wraps-position-absolute-expected.txt: Renamed from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt.
+ * editing/pasteboard/copy-paste-wraps-position-absolute.html: Renamed from LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html.
+
2014-02-18 Mihai Tica <mit...@adobe.com>
[CSS Blending] Add -webkit-blend-mode support for SVG.
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed-expected.txt (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed-expected.txt 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,98 @@
+This tests to see if position:fixed gets converted to position:absolute upon copy/paste
+
+first test - before:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| "
+abc"
+| <div>
+| style="position: fixed; left: 0px; top: 0px;"
+| "def"
+| "ghi
+"
+| <br>
+| "
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
+
+first test - after:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| <div>
+| style="position: relative;"
+| "abc"
+| <div>
+| style="position: absolute; left: 0px; top: 0px;"
+| "def"
+| "ghi <#selection-caret>"
+| "
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed.html (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-fixed.html 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script type="text/_javascript_" src=""
+</head>
+<body>
+abc<div style="position: fixed; left: 0px; top: 0px;">def</div>ghi
+<br/>
+
+<script>
+
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+</script>
+</body>
+</html>
Deleted: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt (164298 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt 2014-02-18 19:10:38 UTC (rev 164298)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt 2014-02-18 19:32:54 UTC (rev 164299)
@@ -1,98 +0,0 @@
-These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste
-
-first test - before:
-| <html>
-| <head>
-| "
-"
-| <meta>
-| content="text/html; charset=utf-8"
-| http-equiv="Content-type"
-| "
-"
-| <script>
-| src=""
-| type="text/_javascript_"
-| "
-"
-| "
-"
-| <body>
-| "
-abc"
-| <div>
-| style="position: fixed; left: 0px; top: 0px;"
-| "def"
-| "ghi
-"
-| <br>
-| "
-
-"
-| <script>
-| "
-
-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.setShouldConvertPositionStyleOnCopy(true);
-
-var s = window.getSelection();
-
-Markup.dump('test1', 'first test - before');
-document.execCommand("SelectAll");
-document.execCommand("Cut");
-document.execCommand("Paste");
-Markup.dump('test1', 'first test - after');
-
-"
-
-first test - after:
-| <html>
-| <head>
-| "
-"
-| <meta>
-| content="text/html; charset=utf-8"
-| http-equiv="Content-type"
-| "
-"
-| <script>
-| src=""
-| type="text/_javascript_"
-| "
-"
-| "
-"
-| <body>
-| <div>
-| style="position: relative;"
-| "abc"
-| <div>
-| style="position: absolute; left: 0px; top: 0px;"
-| "def"
-| "ghi <#selection-caret>"
-| "
-
-"
-| <script>
-| "
-
-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.setShouldConvertPositionStyleOnCopy(true);
-
-var s = window.getSelection();
-
-Markup.dump('test1', 'first test - before');
-document.execCommand("SelectAll");
-document.execCommand("Cut");
-document.execCommand("Paste");
-Markup.dump('test1', 'first test - after');
-
-"
Deleted: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html (164298 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html 2014-02-18 19:10:38 UTC (rev 164298)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html 2014-02-18 19:32:54 UTC (rev 164299)
@@ -1,29 +0,0 @@
-<html>
-<head>
-<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-<script type="text/_javascript_" src=""
-</head>
-<body>
-abc<div style="position: fixed; left: 0px; top: 0px;">def</div>ghi
-<br/>
-
-<script>
-
-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.setShouldConvertPositionStyleOnCopy(true);
-
-var s = window.getSelection();
-
-Markup.dump('test1', 'first test - before');
-document.execCommand("SelectAll");
-document.execCommand("Cut");
-document.execCommand("Paste");
-Markup.dump('test1', 'first test - after');
-
-</script>
-</body>
-</html>
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-expected.txt (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-expected.txt 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,95 @@
+This tests to see if position:sticky gets converted to position:static upon copy/paste
+
+first test - before:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| "
+abc"
+| <div>
+| style="position: -webkit-sticky; left: 0px; top: 0px;"
+| "def"
+| "ghi
+"
+| <br>
+| "
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:sticky gets converted to position:static upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
+
+first test - after:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| "abc"
+| <div>
+| style="position: static; left: 0px; top: 0px;"
+| "def"
+| "ghi <#selection-caret>
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:sticky gets converted to position:static upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky.html (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky.html 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script type="text/_javascript_" src=""
+</head>
+<body>
+abc<div style="position: -webkit-sticky; left: 0px; top: 0px;">def</div>ghi
+<br/>
+
+<script>
+
+Markup.description('This tests to see if position:sticky gets converted to position:static upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+</script>
+</body>
+</html>
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute-expected.txt (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed-expected.txt) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute-expected.txt 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,98 @@
+This tests to see if position:absolute gets wrapped with a position:relative upon copy/paste
+
+first test - before:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| "
+abc"
+| <div>
+| style="position: absolute; left: 0px; top: 0px;"
+| "def"
+| "ghi
+"
+| <br>
+| "
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:absolute gets wrapped with a position:relative upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
+
+first test - after:
+| <html>
+| <head>
+| "
+"
+| <meta>
+| content="text/html; charset=utf-8"
+| http-equiv="Content-type"
+| "
+"
+| <script>
+| src=""
+| type="text/_javascript_"
+| "
+"
+| "
+"
+| <body>
+| <div>
+| style="position: relative;"
+| "abc"
+| <div>
+| style="position: absolute; left: 0px; top: 0px;"
+| "def"
+| "ghi <#selection-caret>"
+| "
+
+"
+| <script>
+| "
+
+Markup.description('This tests to see if position:absolute gets wrapped with a position:relative upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+"
Copied: trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute.html (from rev 164298, trunk/LayoutTests/editing/pasteboard/copy-paste-converts-sticky-and-fixed.html) (0 => 164299)
--- trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-paste-wraps-position-absolute.html 2014-02-18 19:32:54 UTC (rev 164299)
@@ -0,0 +1,29 @@
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script type="text/_javascript_" src=""
+</head>
+<body>
+abc<div style="position: absolute; left: 0px; top: 0px;">def</div>ghi
+<br/>
+
+<script>
+
+Markup.description('This tests to see if position:absolute gets wrapped with a position:relative upon copy/paste');
+
+document.designMode = 'on';
+
+if (window.internals)
+ window.internals.settings.setShouldConvertPositionStyleOnCopy(true);
+
+var s = window.getSelection();
+
+Markup.dump('test1', 'first test - before');
+document.execCommand("SelectAll");
+document.execCommand("Cut");
+document.execCommand("Paste");
+Markup.dump('test1', 'first test - after');
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (164298 => 164299)
--- trunk/Source/WebCore/ChangeLog 2014-02-18 19:10:38 UTC (rev 164298)
+++ trunk/Source/WebCore/ChangeLog 2014-02-18 19:32:54 UTC (rev 164299)
@@ -1,3 +1,23 @@
+2014-02-18 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Convert position:sticky to position:static upon copy and paste
+ https://bugs.webkit.org/show_bug.cgi?id=128982
+
+ Reviewed by Simon Fraser.
+
+ This patch has two parts:
+
+ 1. Make sure that position:absolute elements trigger the position:relative wrapping (as
+ well as position:fixed)
+ 2. Now that we copy position:sticky, convert that to position:fixed
+
+ Tests: editing/pasteboard/copy-paste-converts-fixed.html
+ editing/pasteboard/copy-paste-converts-sticky.html
+ editing/pasteboard/copy-paste-wraps-position-absolute.html
+
+ * editing/EditingStyle.cpp:
+ (WebCore::EditingStyle::convertFixedAndStickyPosition):
+
2014-02-18 David Kilzer <ddkil...@apple.com>
Add type-checked casts for StyleImage and subclasses
Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (164298 => 164299)
--- trunk/Source/WebCore/editing/EditingStyle.cpp 2014-02-18 19:10:38 UTC (rev 164298)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp 2014-02-18 19:32:54 UTC (rev 164299)
@@ -1227,11 +1227,18 @@
return false;
RefPtr<CSSPrimitiveValue> sticky = cssValuePool().createIdentifierValue(CSSValueWebkitSticky);
+ if (m_mutableStyle->propertyMatches(CSSPropertyPosition, sticky.get())) {
+ m_mutableStyle->setProperty(CSSPropertyPosition, cssValuePool().createIdentifierValue(CSSValueStatic), m_mutableStyle->propertyIsImportant(CSSPropertyPosition));
+ return false;
+ }
RefPtr<CSSPrimitiveValue> fixed = cssValuePool().createIdentifierValue(CSSValueFixed);
if (m_mutableStyle->propertyMatches(CSSPropertyPosition, fixed.get())) {
m_mutableStyle->setProperty(CSSPropertyPosition, cssValuePool().createIdentifierValue(CSSValueAbsolute), m_mutableStyle->propertyIsImportant(CSSPropertyPosition));
return true;
}
+ RefPtr<CSSPrimitiveValue> absolute = cssValuePool().createIdentifierValue(CSSValueAbsolute);
+ if (m_mutableStyle->propertyMatches(CSSPropertyPosition, absolute.get()))
+ return true;
return false;
}