https://bugs.webkit.org/show_bug.cgi?id=128982
Reviewed by NOBODY (OOPS!).
Source/WebCore:
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):
LayoutTests:
* 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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164299
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-02-18 Myles C. Maxfield <mmaxfield@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 <mitica@adobe.com>
[CSS Blending] Add -webkit-blend-mode support for SVG.
-These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste
+This tests to see if position:fixed gets converted to position:absolute upon copy/paste
first test - before:
| <html>
| <script>
| "
-Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
document.designMode = 'on';
| <script>
| "
-Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
document.designMode = 'on';
<script>
-Markup.description('These tests to see if position:sticky and position:fixed get converted to position:static and position:absolute upon copy/paste');
+Markup.description('This tests to see if position:fixed gets converted to position:absolute upon copy/paste');
document.designMode = 'on';
--- /dev/null
+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="../../resources/dump-as-markup.js"
+| 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="../../resources/dump-as-markup.js"
+| 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');
+
+"
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../../resources/dump-as-markup.js"></script>
+</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>
--- /dev/null
+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="../../resources/dump-as-markup.js"
+| 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="../../resources/dump-as-markup.js"
+| 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');
+
+"
--- /dev/null
+<html>
+<head>
+<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../../resources/dump-as-markup.js"></script>
+</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>
+2014-02-18 Myles C. Maxfield <mmaxfield@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 <ddkilzer@apple.com>
Add type-checked casts for StyleImage and subclasses
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;
}