[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:23:45 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 4e51fbef81fa6553d073ac9b4dc2eb4b72a11935
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Feb 18 06:44:48 2010 +0000

    2010-02-17  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=34914
            When pasting absolute font sizes into a content editable area with
            page zoom, adjust the font sizes to be the same after page zoom is
            applied.
    
            * editing/pasteboard/page-zoom-expected.txt: Added.
            * editing/pasteboard/page-zoom.html: Added.
    2010-02-17  Tony Chang  <tony at chromium.org>
    
            Reviewed by Eric Seidel.
    
            https://bugs.webkit.org/show_bug.cgi?id=34914
            When pasting absolute font sizes into a content editable area with
            page zoom, adjust the font sizes to be the same after page zoom is
            applied.
    
            Test: editing/pasteboard/page-zoom.html
    
            * editing/ReplaceSelectionCommand.cpp:
            (WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7af1252..78dd38a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -2,6 +2,18 @@
 
         Reviewed by Eric Seidel.
 
+        https://bugs.webkit.org/show_bug.cgi?id=34914
+        When pasting absolute font sizes into a content editable area with
+        page zoom, adjust the font sizes to be the same after page zoom is
+        applied.
+
+        * editing/pasteboard/page-zoom-expected.txt: Added.
+        * editing/pasteboard/page-zoom.html: Added.
+
+2010-02-17  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
         https://bugs.webkit.org/show_bug.cgi?id=34737
         Test to verify that pasting styled list items works
         the same as pasting unstyle list items.
diff --git a/LayoutTests/editing/pasteboard/page-zoom-expected.txt b/LayoutTests/editing/pasteboard/page-zoom-expected.txt
new file mode 100644
index 0000000..ad2d1c0
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/page-zoom-expected.txt
@@ -0,0 +1,12 @@
+Copy this 16px text.
+Paste Copy this 16px text it here.
+The pasted text should have a font size of 16px.
+
+
+Copy this x-small text.
+Paste Copy this x-small it here.
+The pasted text should have a font size of x-small.
+
+
+PASS
+
diff --git a/LayoutTests/editing/pasteboard/page-zoom.html b/LayoutTests/editing/pasteboard/page-zoom.html
new file mode 100644
index 0000000..a49c776
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/page-zoom.html
@@ -0,0 +1,49 @@
+<body>
+<div id="test" style="font-size:16px;zoom:200%;">Copy this 16px text.</div> 
+<div id="target" contentEditable style="zoom:200%; border:1px solid">Paste it here.</div> 
+<div>The pasted text should have a font size of 16px.</div>
+<br /><br />
+<div id="test2" style="font-size:x-small;zoom:200%;">Copy this x-small text.</div> 
+<div id="target2" contentEditable style="zoom:150%; border:1px solid">Paste it here.</div> 
+<div>The pasted text should have a font size of x-small.</div>
+<br /><br />
+<div id="results">FAIL (this test requires DRT)<div>
+</body>
+<script src="../editing.js"></script>
+<script>
+function editingTest()
+{
+    for (var i = 0; i < 4; ++i)
+        execExtendSelectionForwardByWordCommand();
+    execCopyCommand();
+
+    var elem = document.getElementById("target");
+    var selection = window.getSelection();
+    selection.setPosition(elem, 0);
+    execMoveSelectionForwardByWordCommand();
+    execPasteCommand();
+
+    if (document.getElementById("target").innerHTML.toString().indexOf("font-size: 16px") == -1)
+        throw "absolute font size is wrong";
+
+    // Make sure relative font sizes are not adjusted.
+    var elem = document.getElementById("test2");
+    var selection = window.getSelection();
+    selection.setPosition(elem, 0);
+    for (var i = 0; i < 4; ++i)
+        execExtendSelectionForwardByWordCommand();
+    execCopyCommand();
+
+    var elem = document.getElementById("target2");
+    var selection = window.getSelection();
+    selection.setPosition(elem, 0);
+    execMoveSelectionForwardByWordCommand();
+    execPasteCommand();
+
+    if (document.getElementById("target2").innerHTML.toString().indexOf("font-size: x-small") == -1)
+        throw "relative font size not preserved";
+    document.getElementById("results").innerText = "PASS";
+}
+
+runDumpAsTextEditingTest(false);
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b397a7f..dd7cef3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,20 @@
 
         Reviewed by Eric Seidel.
 
+        https://bugs.webkit.org/show_bug.cgi?id=34914
+        When pasting absolute font sizes into a content editable area with
+        page zoom, adjust the font sizes to be the same after page zoom is
+        applied.
+
+        Test: editing/pasteboard/page-zoom.html
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance):
+
+2010-02-17  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Eric Seidel.
+
         https://bugs.webkit.org/show_bug.cgi?id=34737
         Copying styled list items then pasting into a list
         should work the same as copying unstyle list items:
diff --git a/WebCore/editing/ReplaceSelectionCommand.cpp b/WebCore/editing/ReplaceSelectionCommand.cpp
index 47c5540..0c256d5 100644
--- a/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -468,6 +468,17 @@ void ReplaceSelectionCommand::negateStyleRulesThatAffectAppearance()
                 e->getInlineStyleDecl()->setProperty(CSSPropertyDisplay, CSSValueInline);
             if (e->renderer() && e->renderer()->style()->floating() != FNONE)
                 e->getInlineStyleDecl()->setProperty(CSSPropertyFloat, CSSValueNone);
+
+            // Undo the effects of page zoom if we have an absolute font size.  When we copy, we
+            // compute the new font size as an absolute size so pasting will cause the zoom to be
+            // applied twice.
+            if (e->renderer() && e->renderer()->style() && e->renderer()->style()->effectiveZoom() != 1.0
+                && e->renderer()->style()->fontDescription().isAbsoluteSize()) {
+                float newSize = e->renderer()->style()->fontDescription().specifiedSize() / e->renderer()->style()->effectiveZoom();
+                ExceptionCode ec = 0;
+                e->style()->setProperty(CSSPropertyFontSize, String::number(newSize), false, ec);
+                ASSERT(!ec);
+            }
         }
         if (node == m_lastLeafInserted)
             break;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list