[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

simon.fraser at apple.com simon.fraser at apple.com
Mon Feb 21 00:23:16 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 4f8c2fc90905daa0f2e6a8be34bd1d75731cf9fc
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 30 18:19:54 2011 +0000

    2011-01-29  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            CSS3 gradients with em-based stops fail to repaint when font size changes
            https://bugs.webkit.org/show_bug.cgi?id=51845
    
            Mark as uncacheable gradidients whose color stops depend on font size,
            and don't attempt to put these into CSSImageGeneratorValue's image cache.
            This means we return a new gradient each time, which is fairly cheap, and
            fixes repaint issues under changing font size.
    
            Test: fast/repaint/gradients-em-stops-repaint.html
    
            * css/CSSGradientValue.cpp:
            (WebCore::CSSGradientValue::image):
            (WebCore::CSSGradientValue::isCacheable):
            * css/CSSGradientValue.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77089 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dcd2f51..a824f6b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-29  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        CSS3 gradients with em-based stops fail to repaint when font size changes
+        https://bugs.webkit.org/show_bug.cgi?id=51845
+        
+        Test repaint of a gradient with 'em' stops when the font size changes.
+
+        * fast/repaint/gradients-em-stops-repaint.html: Added.
+        * platform/mac/fast/repaint/gradients-em-stops-repaint-expected.checksum: Added.
+        * platform/mac/fast/repaint/gradients-em-stops-repaint-expected.png: Added.
+        * platform/mac/fast/repaint/gradients-em-stops-repaint-expected.txt: Added.
+
 2011-01-29  Maciej Stachowiak  <mjs at apple.com>
 
         Unreviewed fix for last commit.
diff --git a/LayoutTests/fast/repaint/gradients-em-stops-repaint.html b/LayoutTests/fast/repaint/gradients-em-stops-repaint.html
new file mode 100644
index 0000000..c03b690
--- /dev/null
+++ b/LayoutTests/fast/repaint/gradients-em-stops-repaint.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    .box {
+      display: inline-block;
+      height: 120px;
+      width: 300px;
+      margin: 10px;
+      border: 1px solid black;
+      background-repeat: no-repeat;
+      font-size: 12pt;
+    }
+    
+    .em-units > .box {
+      background-image: -webkit-linear-gradient(left, yellow, yellow 5em, green 5em);
+      background-image: -moz-linear-gradient(left, yellow, yellow 5em, green 5em);
+    }
+    
+    .indicator {
+      background-color: black;
+      height: 20px;
+    }
+  </style>
+  <script type="text/javascript" src="resources/repaint.js"></script>
+  <script type="text/javascript">
+      function repaintTest()
+      {
+          document.getElementById("box4").style.fontSize = "36pt";
+      }
+  </script>
+  </script>
+</head>
+<body onload="runRepaintTest();">
+
+  <div class="em-units">
+    <div id="box3" class="box"><div class="indicator" style="width: 5em;"></div></div>
+    <div id="box4" class="box"><div class="indicator" style="width: 5em;"></div></div>
+  </div>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.checksum b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.checksum
new file mode 100644
index 0000000..d2a6d04
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.checksum
@@ -0,0 +1 @@
+92fa2e6554c47d2d89f10a7a5563fff0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.png b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.png
new file mode 100644
index 0000000..b7b6e97
Binary files /dev/null and b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.txt b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.txt
new file mode 100644
index 0000000..7ea8e55
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/repaint/gradients-em-stops-repaint-expected.txt
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x162
+  RenderBlock {HTML} at (0,0) size 800x162
+    RenderBody {BODY} at (8,8) size 784x146
+      RenderBlock {DIV} at (0,0) size 784x146
+        RenderBlock {DIV} at (10,10) size 302x122 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 80x20 [bgcolor=#000000]
+        RenderText {#text} at (322,128) size 4x18
+          text run at (322,128) width 4: " "
+        RenderBlock {DIV} at (336,10) size 302x122 [border: (1px solid #000000)]
+          RenderBlock {DIV} at (1,1) size 240x20 [bgcolor=#000000]
+        RenderText {#text} at (0,0) size 0x0
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 2145725..77fc2a0 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2011-01-29  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        CSS3 gradients with em-based stops fail to repaint when font size changes
+        https://bugs.webkit.org/show_bug.cgi?id=51845
+        
+        Mark as uncacheable gradidients whose color stops depend on font size,
+        and don't attempt to put these into CSSImageGeneratorValue's image cache.
+        This means we return a new gradient each time, which is fairly cheap, and
+        fixes repaint issues under changing font size.
+
+        Test: fast/repaint/gradients-em-stops-repaint.html
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSGradientValue::image):
+        (WebCore::CSSGradientValue::isCacheable):
+        * css/CSSGradientValue.h:
+
 2011-01-29  Geoffrey Garen  <ggaren at apple.com>
 
         Undo try to fix the Qt build.
diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp
index eb24fc9..e1fb916 100644
--- a/Source/WebCore/css/CSSGradientValue.cpp
+++ b/Source/WebCore/css/CSSGradientValue.cpp
@@ -43,22 +43,24 @@ namespace WebCore {
 
 PassRefPtr<Image> CSSGradientValue::image(RenderObject* renderer, const IntSize& size)
 {
-    if (!m_clients.contains(renderer))
-        return 0;
-
-    // Need to look up our size.  Create a string of width*height to use as a hash key.
-    // FIXME: hashing based only on size is not sufficient. Color stops may use context-sensitive units (like em)
-    // that should force the color stop positions to be recomputed.
-    Image* result = getImage(renderer, size);
-    if (result)
-        return result;
-
     if (size.isEmpty())
         return 0;
 
+    bool cacheable = isCacheable();
+    if (cacheable) {
+        if (!m_clients.contains(renderer))
+            return 0;
+
+        // Need to look up our size.  Create a string of width*height to use as a hash key.
+        Image* result = getImage(renderer, size);
+        if (result)
+            return result;
+    }
+    
     // We need to create an image.
     RefPtr<Image> newImage = GeneratedImage::create(createGradient(renderer, size), size);
-    putImage(size, newImage);
+    if (cacheable)
+        putImage(size, newImage);
 
     return newImage.release();
 }
@@ -405,6 +407,21 @@ FloatPoint CSSGradientValue::computeEndPoint(CSSPrimitiveValue* first, CSSPrimit
     return result;
 }
 
+bool CSSGradientValue::isCacheable() const
+{
+    for (size_t i = 0; i < m_stops.size(); ++i) {
+        const CSSGradientColorStop& stop = m_stops[i];
+        if (!stop.m_position)
+            continue;
+
+        unsigned short unitType = stop.m_position->primitiveType();
+        if (unitType == CSSPrimitiveValue::CSS_EMS || unitType == CSSPrimitiveValue::CSS_EXS || unitType == CSSPrimitiveValue::CSS_REMS)
+            return false;
+    }
+    
+    return true;
+}
+
 String CSSLinearGradientValue::cssText() const
 {
     String result;
diff --git a/Source/WebCore/css/CSSGradientValue.h b/Source/WebCore/css/CSSGradientValue.h
index 413dd2e..b19548e 100644
--- a/Source/WebCore/css/CSSGradientValue.h
+++ b/Source/WebCore/css/CSSGradientValue.h
@@ -81,6 +81,8 @@ protected:
 
     // Resolve points/radii to front end values.
     FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle, const IntSize&);
+    
+    bool isCacheable() const;
 
     // Points. Some of these may be null for linear gradients.
     RefPtr<CSSPrimitiveValue> m_firstX;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list