2007-02-07 Mitz Pettel <mitz@webkit.org>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Feb 2007 04:56:20 +0000 (04:56 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Feb 2007 04:56:20 +0000 (04:56 +0000)
        Reviewed by Dave Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=5399
          no-repeat on negatively positioned background images are ignored

        Test: fast/backgrounds/repeat/negative-offset-repeat.html

        - fix http://bugs.webkit.org/show_bug.cgi?id=5821
          Changing background of <col> doesn't repaint the column

        Test: fast/repaint/table-col-background.html

        - fix http://bugs.webkit.org/show_bug.cgi?id=11720
          REGRESSION: large amounts of CPU consumed viewing this site

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::imageChanged): Added. Finds the border and/or background
        layer(s) that use the image and invalidates only the rect in which the image
        actually paints. There are two special cases in this function: 1) for the body
        element, the background is propagated to the root; 2) inline flows do a full
        repaint.
        (WebCore::RenderBox::calculateBackgroundImageGeometry): Added. Factored out,
        simplified and corrected the calculation of the rectangle into which the background
        image paints, the tile size and the pattern phase.
        (WebCore::RenderBox::paintBackgroundExtended):
        * rendering/RenderBox.h:
        * rendering/RenderObject.cpp:
        * rendering/RenderObject.h:
        (WebCore::RenderObject::imageChanged): Moved the implementation to RenderBox.
        * rendering/RenderTableCol.cpp:
        (WebCore::RenderTableCol::getAbsoluteRepaintRect): Overridden to return the
        table's repaint rect.
        (WebCore::RenderTableCol::imageChanged): Overridden to do a full repaint, which
        currently repaints the entire table.
        * rendering/RenderTableCol.h:
        * rendering/RenderTableRow.cpp:
        (WebCore::RenderTableRow::imageChanged): Overridden to do a full repaint
        of the row, since the backgrounds are painted by the cells.
        * rendering/RenderTableRow.h:
        * rendering/RenderTableSection.cpp:
        (WebCore::RenderTableSection::imageChanged): Overridden to do a full
        repaint of the section, since the backgrounds are painted by the cells.
        * rendering/RenderTableSection.h:

2007-02-07  Mitz Pettel  <mitz@webkit.org>

        Reviewed by Dave Hyatt.

        - pixel test and updated results for http://bugs.webkit.org/show_bug.cgi?id=5399
          no-repeat on negatively positioned background images are ignored

        - repaint test for http://bugs.webkit.org/show_bug.cgi?id=5821
          Changing background of <col> doesn't repaint the column

        * fast/backgrounds/repeat/negative-offset-repeat-expected.checksum: Added.
        * fast/backgrounds/repeat/negative-offset-repeat-expected.png: Added.
        * fast/backgrounds/repeat/negative-offset-repeat-expected.txt: Added.
        * fast/backgrounds/repeat/negative-offset-repeat.html: Added. Based on a test by Mark Rowe.
        * fast/backgrounds/repeat/resources/gradient.gif: Added.
        * fast/repaint/table-col-background-expected.checksum: Added.
        * fast/repaint/table-col-background-expected.png: Added.
        * fast/repaint/table-col-background-expected.txt: Added.
        * fast/repaint/table-col-background.html: Added.
        * tables/mozilla/marvin/backgr_position-table-expected.checksum:
        * tables/mozilla/marvin/backgr_position-table-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-cell-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-cell-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-group-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-group-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-group-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-group-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_layers-hide-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_layers-hide-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-cell-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-cell-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-group-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-group-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-expected.png:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-group-expected.checksum:
        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-group-expected.png:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.checksum [new file with mode: 0644]
LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.txt [new file with mode: 0644]
LayoutTests/fast/backgrounds/repeat/negative-offset-repeat.html [new file with mode: 0644]
LayoutTests/fast/repaint/table-col-background-expected.checksum [new file with mode: 0644]
LayoutTests/fast/repaint/table-col-background-expected.txt [new file with mode: 0644]
LayoutTests/fast/repaint/table-col-background.html [new file with mode: 0644]
LayoutTests/tables/mozilla/marvin/backgr_position-table-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-cell-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-column-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-column-group-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-row-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_border-table-row-group-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_layers-hide-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_position-table-cell-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_position-table-column-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_position-table-column-group-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_position-table-row-expected.checksum
LayoutTests/tables/mozilla_expected_failures/marvin/backgr_position-table-row-group-expected.checksum
WebCore/ChangeLog
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderBox.h
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderTableCol.cpp
WebCore/rendering/RenderTableCol.h
WebCore/rendering/RenderTableRow.cpp
WebCore/rendering/RenderTableRow.h
WebCore/rendering/RenderTableSection.cpp
WebCore/rendering/RenderTableSection.h

index 81b4200ff36e6a06adce19006b6cb50797607d61..a1f006d64ed57c42d87277b817cfaa4d7f7ea3a5 100644 (file)
@@ -1,3 +1,49 @@
+2007-02-07  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Dave Hyatt.
+
+        - pixel test and updated results for http://bugs.webkit.org/show_bug.cgi?id=5399
+          no-repeat on negatively positioned background images are ignored
+
+        - repaint test for http://bugs.webkit.org/show_bug.cgi?id=5821
+          Changing background of <col> doesn't repaint the column
+        
+        * fast/backgrounds/repeat/negative-offset-repeat-expected.checksum: Added.
+        * fast/backgrounds/repeat/negative-offset-repeat-expected.png: Added.
+        * fast/backgrounds/repeat/negative-offset-repeat-expected.txt: Added.
+        * fast/backgrounds/repeat/negative-offset-repeat.html: Added. Based on a test by Mark Rowe.
+        * fast/backgrounds/repeat/resources/gradient.gif: Added.
+        * fast/repaint/table-col-background-expected.checksum: Added.
+        * fast/repaint/table-col-background-expected.png: Added.
+        * fast/repaint/table-col-background-expected.txt: Added.
+        * fast/repaint/table-col-background.html: Added.
+        * tables/mozilla/marvin/backgr_position-table-expected.checksum:
+        * tables/mozilla/marvin/backgr_position-table-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-cell-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-cell-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-group-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-column-group-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-group-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_border-table-row-group-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_layers-hide-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_layers-hide-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-cell-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-cell-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-group-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-column-group-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-expected.png:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-group-expected.checksum:
+        * tables/mozilla_expected_failures/marvin/backgr_position-table-row-group-expected.png:
+
 2007-02-07  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.checksum b/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.checksum
new file mode 100644 (file)
index 0000000..dad3450
--- /dev/null
@@ -0,0 +1 @@
+0ccc9539337d80ee8c4c134fad5860c2
\ No newline at end of file
diff --git a/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.txt b/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat-expected.txt
new file mode 100644 (file)
index 0000000..5add2ab
--- /dev/null
@@ -0,0 +1,53 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x484
+  RenderBlock {HTML} at (0,0) size 800x484
+    RenderBody {BODY} at (8,16) size 784x452
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 53x18
+          text run at (0,0) width 53: "Test for "
+        RenderInline {I} at (0,0) size 722x18
+          RenderInline {A} at (0,0) size 293x18 [color=#0000EE]
+            RenderText {#text} at (53,0) size 293x18
+              text run at (53,0) width 293: "http://bugs.webkit.org/show_bug.cgi?id=5399"
+          RenderText {#text} at (346,0) size 429x18
+            text run at (346,0) width 4: " "
+            text run at (350,0) width 425: "no-repeat on negatively positioned background images are ignored"
+        RenderText {#text} at (775,0) size 4x18
+          text run at (775,0) width 4: "."
+      RenderBlock {P} at (0,34) size 784x18
+        RenderText {#text} at (0,0) size 454x18
+          text run at (0,0) width 454: "Element with background image starting at (-13, -13) with no-repeat set:"
+      RenderBlock (floating) {DIV} at (6,74) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,74) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,74) size 24x24 [border: (1px dotted #008000)]
+      RenderBlock {P} at (0,114) size 784x18
+        RenderText {#text} at (0,0) size 446x18
+          text run at (0,0) width 446: "Element with background image starting at (-13, -13) with repeat-y set:"
+      RenderBlock (floating) {DIV} at (6,154) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,154) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,154) size 24x24 [border: (1px dotted #008000)]
+      RenderBlock {P} at (0,194) size 784x18
+        RenderText {#text} at (0,0) size 446x18
+          text run at (0,0) width 446: "Element with background image starting at (-13, -13) with repeat-x set:"
+      RenderBlock (floating) {DIV} at (6,234) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,234) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,234) size 24x24 [border: (1px dotted #008000)]
+      RenderBlock {P} at (0,274) size 784x18
+        RenderText {#text} at (0,0) size 444x18
+          text run at (0,0) width 444: "Element with background image starting at (13, 13) with no-repeat set:"
+      RenderBlock (floating) {DIV} at (6,314) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,314) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,314) size 24x24 [border: (1px dotted #008000)]
+      RenderBlock {P} at (0,354) size 784x18
+        RenderText {#text} at (0,0) size 436x18
+          text run at (0,0) width 436: "Element with background image starting at (13, 13) with repeat-y set:"
+      RenderBlock (floating) {DIV} at (6,394) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,394) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,394) size 24x24 [border: (1px dotted #008000)]
+      RenderBlock {P} at (0,434) size 784x18
+        RenderText {#text} at (0,0) size 436x18
+          text run at (0,0) width 436: "Element with background image starting at (13, 13) with repeat-x set:"
+      RenderBlock (floating) {DIV} at (6,474) size 34x34 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (52,474) size 29x29 [border: (1px dotted #008000)]
+      RenderBlock (floating) {DIV} at (93,474) size 24x24 [border: (1px dotted #008000)]
diff --git a/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat.html b/LayoutTests/fast/backgrounds/repeat/negative-offset-repeat.html
new file mode 100644 (file)
index 0000000..d1fad71
--- /dev/null
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+    <style type="text/css">
+    .s300
+    {
+        width: 30px;
+        height: 30px;
+    }
+
+    .s250
+    {
+        width: 25px;
+        height: 25px;
+    }
+
+    .s200
+    {
+        width: 20px;
+        height: 20px;
+    }
+
+    div
+    {
+        margin: 6px;
+        border: 1px dotted green;
+        background-image: url(resources/gradient.gif);
+    }
+
+    div
+    {
+        padding: 1px;
+        float: left;
+    }
+
+    p
+    {
+        clear: both;
+    }
+
+    .negative
+    {
+        background-position: -13px -13px;
+    }
+
+    .positive
+    {
+        background-position: 13px 13px;
+    }
+    </style>
+</head>
+<body>
+    <p>
+        Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=5399">http://bugs.webkit.org/show_bug.cgi?id=5399</a>
+        no-repeat on negatively positioned background images are ignored</i>.
+    </p>
+    <p>Element with background image starting at (-13, -13) with no-repeat set:</p>
+    <div class="negative s300" style="background-repeat: no-repeat;"></div>
+    <div class="negative s250" style="background-repeat: no-repeat;"></div>
+    <div class="negative s200" style="background-repeat: no-repeat;"></div>
+
+    <p>Element with background image starting at (-13, -13) with repeat-y set:</p>
+    <div class="negative s300" style="background-repeat: repeat-y"></div>
+    <div class="negative s250" style="background-repeat: repeat-y"></div>
+    <div class="negative s200" style="background-repeat: repeat-y"></div>
+
+    <p>Element with background image starting at (-13, -13) with repeat-x set:</p>
+    <div class="negative s300" style="background-repeat: repeat-x"></div>
+    <div class="negative s250" style="background-repeat: repeat-x"></div>
+    <div class="negative s200" style="background-repeat: repeat-x"></div>
+
+    <p>Element with background image starting at (13, 13) with no-repeat set:</p>
+    <div class="positive s300" style="background-repeat: no-repeat;"></div>
+    <div class="positive s250" style="background-repeat: no-repeat;"></div>
+    <div class="positive s200" style="background-repeat: no-repeat;"></div>
+
+    <p>Element with background image starting at (13, 13) with repeat-y set:</p>
+    <div class="positive s300" style="background-repeat: repeat-y"></div>
+    <div class="positive s250" style="background-repeat: repeat-y"></div>
+    <div class="positive s200" style="background-repeat: repeat-y"></div>
+
+    <p>Element with background image starting at (13, 13) with repeat-x set:</p>
+    <div class="positive s300" style="background-repeat: repeat-x"></div>
+    <div class="positive s250" style="background-repeat: repeat-x"></div>
+    <div class="positive s200" style="background-repeat: repeat-x"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/repaint/table-col-background-expected.checksum b/LayoutTests/fast/repaint/table-col-background-expected.checksum
new file mode 100644 (file)
index 0000000..ad9bc97
--- /dev/null
@@ -0,0 +1 @@
+1d234ba80f6452b47a7d3239562c5013
\ No newline at end of file
diff --git a/LayoutTests/fast/repaint/table-col-background-expected.txt b/LayoutTests/fast/repaint/table-col-background-expected.txt
new file mode 100644 (file)
index 0000000..9df25d4
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTable {TABLE} at (0,0) size 106x104
+        RenderTableCol {COL} at (0,0) size 0x0 [bgcolor=#008000]
+        RenderTableSection {TBODY} at (0,0) size 106x104
+          RenderTableRow {TR} at (0,2) size 106x100
+            RenderTableCell {TD} at (2,51) size 102x2 [r=0 c=0 rs=1 cs=1]
diff --git a/LayoutTests/fast/repaint/table-col-background.html b/LayoutTests/fast/repaint/table-col-background.html
new file mode 100644 (file)
index 0000000..554da86
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+    <title>Test for http://bugs.webkit.org/show_bug.cgi?id=5821</title>
+    <script src="repaint.js" type="text/javascript"></script>
+    <script type="text/javascript">
+        function repaintTest()
+        {
+            document.getElementById("col").style.backgroundColor = "green";
+        }
+    </script>
+</head>
+<body onload="runRepaintTest()">
+    <table>
+        <col id="col" style="background-color: red;">
+        <tr>
+            <td style="width: 100px; height: 100px;">
+            </td>
+        </tr>
+    </table>
+</body>
+</html>
index 6e712345b51e85574b7625fc85f8cd0ea42f1ac3..6e56bbbcb8721f2281ca530874748c44362c8762 100644 (file)
@@ -1 +1 @@
-9e3bb79bd78b9e3f580b82a67a517568
\ No newline at end of file
+5519b5e5b59e2a89e024454517cea5cf
\ No newline at end of file
index 7d60a6f52d4f1ee75fd8d007d92191437d361642..7320f8b5aa049a11aab368f4c057a6c1f964dbdd 100644 (file)
@@ -1 +1 @@
-22c2723ce3a4adbae647d381624b3354
\ No newline at end of file
+458734e62651b4448337609d062a0e10
\ No newline at end of file
index e18d8f5552d32ab67e83776fff2a7da7aaa36dac..2a20f6ffc6727b4d4dfa5c6809f11d728f04e938 100644 (file)
@@ -1 +1 @@
-11aea40d8a088c218ed398d957ee1c5a
\ No newline at end of file
+cdbda5a78e1964e60f21648b73388051
\ No newline at end of file
index 52076aed5af9eccaba4f84dde57017f950177106..2bc768658314283ea9dd688f6540cbaf9ab3e714 100644 (file)
@@ -1 +1 @@
-715622c45c202d32e3e284afe39929cd
\ No newline at end of file
+6164e3920fee6daf534001d09b8b1d20
\ No newline at end of file
index df139dafebedacf4fe13c047a7e709c1f9d90545..c739d49fdded65cd2a9d72d5d5411c2ef70f62af 100644 (file)
@@ -1 +1 @@
-a75e93da1f5ed6b01c46b8ed88697ae3
\ No newline at end of file
+ced700275e441bb9b08fe0ab7db91963
\ No newline at end of file
index 43472aa37283d0913a41a19009be6aaa618ecee4..76325c0fe8702e978d7d51b7c0704df06267d5da 100644 (file)
@@ -1 +1 @@
-7b159e701e21d2d453eb2ef92874f219
\ No newline at end of file
+15da77d84da3c0558385b9e4e97ae354
\ No newline at end of file
index edec2419e13b1f0ab373c61169673f41845a5acb..ec08ccf7cbbc3f82c306824b5c075ec8f8d4a47e 100644 (file)
@@ -1 +1 @@
-667d2ee93ca7429127e70d9caa1e17c8
\ No newline at end of file
+df9e46da604c984ee32a918df09269fc
\ No newline at end of file
index d55a416087125d70fec7286612f2fbff87fd62ea..b1e875edbd6eec24fa10487c90a55e984a264814 100644 (file)
@@ -1 +1 @@
-a26e01a730c98c275267ceee4c855ca3
\ No newline at end of file
+46a01c8f7c24f6284a293f0baabde796
\ No newline at end of file
index 06f4cb46882e3cbb259c4ad66a1f61083bad0ba3..5baaaa5d4e01f0e695a2c7aca853256a784e1f9b 100644 (file)
@@ -1 +1 @@
-b010fa8dc84034bcb186cf1c06e818b9
\ No newline at end of file
+71854b1c335328d0415e9cbf6a6935ba
\ No newline at end of file
index cfbc530da0693f53b29751e9f6b2dddda06d989a..2b2bd755575b5a8d74de6418355bc92eba9e7138 100644 (file)
@@ -1 +1 @@
-f42af1e7f26dbd3bf20765eb812a81f7
\ No newline at end of file
+15b5ea713f96342e30dfc4b3cf96634b
\ No newline at end of file
index 783c4046cfd5ea0351a99b7e0a1be20bbc324640..a7c4c91e8117b9a585bfa27e4052eec98f6879ca 100644 (file)
@@ -1 +1 @@
-03e42de19426feaa0ea9869ca5f8c554
\ No newline at end of file
+f815e51edd7e3de490df9c2b4e08ffe2
\ No newline at end of file
index 7fd917354842e141512bf7c06fa2273ac1e3c065..fc161a61ec986d6a32b47ebd5ef7aa2293c5f104 100644 (file)
@@ -1,3 +1,49 @@
+2007-02-07  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Dave Hyatt.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=5399
+          no-repeat on negatively positioned background images are ignored
+
+        Test: fast/backgrounds/repeat/negative-offset-repeat.html
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=5821
+          Changing background of <col> doesn't repaint the column
+
+        Test: fast/repaint/table-col-background.html
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=11720
+          REGRESSION: large amounts of CPU consumed viewing this site
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::imageChanged): Added. Finds the border and/or background
+        layer(s) that use the image and invalidates only the rect in which the image
+        actually paints. There are two special cases in this function: 1) for the body
+        element, the background is propagated to the root; 2) inline flows do a full
+        repaint.
+        (WebCore::RenderBox::calculateBackgroundImageGeometry): Added. Factored out,
+        simplified and corrected the calculation of the rectangle into which the background
+        image paints, the tile size and the pattern phase.
+        (WebCore::RenderBox::paintBackgroundExtended):
+        * rendering/RenderBox.h:
+        * rendering/RenderObject.cpp:
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::imageChanged): Moved the implementation to RenderBox.
+        * rendering/RenderTableCol.cpp:
+        (WebCore::RenderTableCol::getAbsoluteRepaintRect): Overridden to return the
+        table's repaint rect.
+        (WebCore::RenderTableCol::imageChanged): Overridden to do a full repaint, which
+        currently repaints the entire table.
+        * rendering/RenderTableCol.h:
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::imageChanged): Overridden to do a full repaint
+        of the row, since the backgrounds are painted by the cells.
+        * rendering/RenderTableRow.h:
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::imageChanged): Overridden to do a full
+        repaint of the section, since the backgrounds are painted by the cells.
+        * rendering/RenderTableSection.h:
+
 2007-02-07  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Maciej.
index 1b18c3ee8ee70dd5fcc38721867a7467287ebf68..c946de866371c9a0f5cf54f940e76d7e60418d2d 100644 (file)
@@ -425,6 +425,140 @@ static void cacluateBackgroundSize(const BackgroundLayer* bgLayer, int& scaledWi
     }
 }
 
+void RenderBox::imageChanged(CachedImage* image)
+{
+    if (!image || !image->canRender() || !parent())
+        return;
+
+    if (isInlineFlow() || style()->borderImage().image() == image) {
+        repaint();
+        return;
+    }
+
+    bool didFullRepaint = false;
+    IntRect absoluteRect;
+    RenderBox* backgroundRenderer;
+
+    if (view() && (isBody() || isRoot())) {
+        // Our background propagates to the root.
+        backgroundRenderer = view();
+
+        int rw;
+        int rh;
+
+        if (FrameView* frameView = static_cast<RenderView*>(backgroundRenderer)->frameView()) {
+            rw = frameView->contentsWidth();
+            rh = frameView->contentsHeight();
+        } else {
+            rw = backgroundRenderer->width();
+            rh = backgroundRenderer->height();
+        }
+        absoluteRect = IntRect(-backgroundRenderer->marginLeft(),
+            -backgroundRenderer->marginTop(),
+            max(backgroundRenderer->width() + backgroundRenderer->marginLeft() + backgroundRenderer->marginRight() + backgroundRenderer->borderLeft() + backgroundRenderer->borderRight(), rw),
+            max(backgroundRenderer->height() + backgroundRenderer->marginTop() + backgroundRenderer->marginBottom() + backgroundRenderer->borderTop() + backgroundRenderer->borderBottom(), rh));
+    } else {
+        backgroundRenderer = this;
+        absoluteRect = borderBox();
+    }
+
+    backgroundRenderer->computeAbsoluteRepaintRect(absoluteRect);
+
+    for (const BackgroundLayer* bgLayer = style()->backgroundLayers(); bgLayer && !didFullRepaint; bgLayer = bgLayer->next()) {
+        if (image == bgLayer->backgroundImage()) {
+            IntRect repaintRect;
+            IntPoint phase;
+            IntSize tileSize;
+            backgroundRenderer->calculateBackgroundImageGeometry(bgLayer, absoluteRect.x(), absoluteRect.y(), absoluteRect.width(), absoluteRect.height(), repaintRect, phase, tileSize);
+            view()->repaintViewRectangle(repaintRect);
+            if (repaintRect == absoluteRect)
+                didFullRepaint = true;
+        }
+    }
+}
+
+void RenderBox::calculateBackgroundImageGeometry(const BackgroundLayer* bgLayer, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize)
+{
+    int pw;
+    int ph;
+    int left = 0;
+    int right = 0;
+    int top = 0;
+    int bottom = 0;
+    int cx;
+    int cy;
+
+    // CSS2 chapter 14.2.1
+
+    if (bgLayer->backgroundAttachment()) {
+        // Scroll
+        if (bgLayer->backgroundOrigin() != BGBORDER) {
+            left = borderLeft();
+            right = borderRight();
+            top = borderTop();
+            bottom = borderBottom();
+            if (bgLayer->backgroundOrigin() == BGCONTENT) {
+                left += paddingLeft();
+                right += paddingRight();
+                top += paddingTop();
+                bottom += paddingBottom();
+            }
+        }
+        cx = tx;
+        cy = ty;
+        pw = w - left - right;
+        ph = h - top - bottom;
+    } else {
+        // Fixed
+        IntRect vr = viewRect();
+        cx = vr.x();
+        cy = vr.y();
+        pw = vr.width();
+        ph = vr.height();
+    }
+
+    int sx = 0;
+    int sy = 0;
+    int cw;
+    int ch;
+    int scaledImageWidth = pw;
+    int scaledImageHeight = ph;
+
+    cacluateBackgroundSize(bgLayer, scaledImageWidth, scaledImageHeight);
+
+    EBackgroundRepeat backgroundRepeat = bgLayer->backgroundRepeat();
+    
+    int xPosition = bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth);
+    if (backgroundRepeat == REPEAT || backgroundRepeat == REPEAT_X) {
+        cw = pw + left + right;
+        sx = scaledImageWidth ? scaledImageWidth - (xPosition + left) % scaledImageWidth : 0;
+    } else {
+        cx += max(xPosition + left, 0);
+        sx = -min(xPosition + left, 0);
+        cw = scaledImageWidth + min(xPosition + left, 0);
+    }
+
+    int yPosition = bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight);
+    if (backgroundRepeat == REPEAT || backgroundRepeat == REPEAT_Y) {
+        ch = ph + top + bottom;
+        sy = scaledImageHeight ? scaledImageHeight - (yPosition + top) % scaledImageHeight : 0;
+    } else {
+        cy += max(yPosition + top, 0);
+        sy = -min(yPosition + top, 0);
+        ch = scaledImageHeight + min(yPosition + top, 0);
+    }
+
+    if (!bgLayer->backgroundAttachment()) {
+        sx += max(tx - cx, 0);
+        sy += max(ty - cy, 0);
+    }
+
+    destRect = IntRect(cx, cy, cw, ch);
+    destRect.intersect(IntRect(tx, ty, w, h));
+    phase = IntPoint(sx, sy);
+    tileSize = IntSize(scaledImageWidth, scaledImageHeight);
+}
+
 void RenderBox::paintBackgroundExtended(GraphicsContext* context, const Color& c, const BackgroundLayer* bgLayer, int clipY, int clipH,
                                         int tx, int ty, int w, int h, bool includeLeftEdge, bool includeRightEdge)
 {
@@ -516,144 +650,13 @@ void RenderBox::paintBackgroundExtended(GraphicsContext* context, const Color& c
 
     // no progressive loading of the background image
     if (shouldPaintBackgroundImage) {
-        int sx = 0;
-        int sy = 0;
-        int cw;
-        int ch;
-        int cx;
-        int cy;
-        int scaledImageWidth;
-        int scaledImageHeight;
-
-        // CSS2 chapter 14.2.1
-
-        if (bgLayer->backgroundAttachment()) {
-            // scroll
-            int horizontalPaddingPlusBorder = 0;
-            int verticalPaddingPlusBorder = 0;
-            int left = 0;
-            int top = 0; // Init to 0 for background-origin of 'border'
-            if (bgLayer->backgroundOrigin() != BGBORDER) {
-                horizontalPaddingPlusBorder += bLeft + bRight;
-                verticalPaddingPlusBorder += borderTop() + borderBottom();
-                left += bLeft;
-                top += borderTop();
-                if (bgLayer->backgroundOrigin() == BGCONTENT) {
-                    horizontalPaddingPlusBorder += pLeft + pRight;
-                    verticalPaddingPlusBorder += paddingTop() + paddingBottom();
-                    left += pLeft;
-                    top += paddingTop();
-                }
-            }
-
-            int pw = w - horizontalPaddingPlusBorder;
-            int ph = h - verticalPaddingPlusBorder;
-            scaledImageWidth = pw;
-            scaledImageHeight = ph;
-            cacluateBackgroundSize(bgLayer, scaledImageWidth, scaledImageHeight);
-
-            EBackgroundRepeat bgr = bgLayer->backgroundRepeat();
-            if ((bgr == NO_REPEAT || bgr == REPEAT_Y) && w > scaledImageWidth) {
-                cw = scaledImageWidth;
-                int xPosition = bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth);
-                if (xPosition >= 0)
-                    cx = tx + xPosition;
-                else {
-                    cx = tx;
-                    if (scaledImageWidth > 0) {
-                        sx = -xPosition;
-                        cw += xPosition;
-                    }
-                }
-                cx += left;
-            } else {
-                // repeat over x or background is wider than box
-                cw = w;
-                cx = tx;
-                if (scaledImageWidth > 0) {
-                    int xPosition = bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth);
-                    if ((xPosition > 0) && (bgr == NO_REPEAT)) {
-                        cx += xPosition;
-                        cw -= xPosition;
-                    } else {
-                        sx = scaledImageWidth - (xPosition % scaledImageWidth);
-                        sx -= left % scaledImageWidth;
-                    }
-                }
-            }
+        IntRect destRect;
+        IntPoint phase;
+        IntSize tileSize;
 
-            if ((bgr == NO_REPEAT || bgr == REPEAT_X) && h > scaledImageHeight) {
-                ch = scaledImageHeight;
-                int yPosition = bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight);
-                if (yPosition >= 0)
-                    cy = ty + yPosition;
-                else {
-                    cy = ty;
-                    if (scaledImageHeight > 0) {
-                        sy = -yPosition;
-                        ch += yPosition;
-                    }
-                }
-
-                cy += top;
-            } else {
-                // repeat over y or background is taller than box
-                ch = h;
-                cy = ty;
-                if (scaledImageHeight > 0) {
-                    int yPosition = bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight);
-                    if ((yPosition > 0) && (bgr == NO_REPEAT)) {
-                        cy += yPosition;
-                        ch -= yPosition;
-                    } else {
-                        sy = scaledImageHeight - (yPosition % scaledImageHeight);
-                        sy -= top % scaledImageHeight;
-                    }
-                }
-            }
-        } else {
-            // fixed
-            IntRect vr = viewRect();
-            int pw = vr.width();
-            int ph = vr.height();
-            scaledImageWidth = pw;
-            scaledImageHeight = ph;
-            cacluateBackgroundSize(bgLayer, scaledImageWidth, scaledImageHeight);
-            EBackgroundRepeat bgr = bgLayer->backgroundRepeat();
-
-            if ((bgr == NO_REPEAT || bgr == REPEAT_Y) && pw > scaledImageWidth) {
-                cw = scaledImageWidth;
-                cx = vr.x() + bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth);
-            } else {
-                cw = pw;
-                cx = vr.x();
-                if (scaledImageWidth > 0)
-                    sx = scaledImageWidth - bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth) % scaledImageWidth;
-            }
-
-            if ((bgr == NO_REPEAT || bgr == REPEAT_X) && ph > scaledImageHeight) {
-                ch = scaledImageHeight;
-                cy = vr.y() + bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight);
-            } else {
-                ch = ph;
-                cy = vr.y();
-                if (scaledImageHeight > 0)
-                    sy = scaledImageHeight - bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight) % scaledImageHeight;
-            }
-
-            IntRect b = intersection(IntRect(cx, cy, cw, ch), IntRect(tx, ty, w, h));
-            sx += b.x() - cx;
-            sy += b.y() - cy;
-            cx = b.x();
-            cy = b.y();
-            cw = b.width();
-            ch = b.height();
-        }
-
-        if (cw > 0 && ch > 0) {
-            context->drawTiledImage(bg->image(), IntRect(cx, cy, cw, ch), IntPoint(sx, sy), IntSize(scaledImageWidth, scaledImageHeight),
-                bgLayer->backgroundComposite());
-        }
+        calculateBackgroundImageGeometry(bgLayer, tx, ty, w, h, destRect, phase, tileSize);
+        if (!destRect.isEmpty())
+            context->drawTiledImage(bg->image(), destRect, phase, tileSize, bgLayer->backgroundComposite());
     }
 
     if (bgLayer->backgroundClip() != BGBORDER)
index 2044119583d93828c0fca1c24d1c4f61f0902cd1..7da0435b8903e7efe539b1d7eb529135f68662c4 100644 (file)
@@ -148,6 +148,7 @@ public:
     virtual IntRect getClipRect(int tx, int ty);
 
     virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
+    virtual void imageChanged(CachedImage*);
 
 protected:
     void paintBackground(GraphicsContext*, const Color&, const BackgroundLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
@@ -160,6 +161,7 @@ protected:
 private:
     void paintRootBoxDecorations(PaintInfo&, int tx, int ty);
 
+    void calculateBackgroundImageGeometry(const BackgroundLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize);
     void paintBackgrounds(GraphicsContext*, const Color&, const BackgroundLayer*, int clipY, int clipHeight, int tx, int ty, int width, int height);
 
     int containingBlockWidthForPositioned(const RenderObject* containingBlock) const;
index 064d3f031e46851c0cdfd10fd708ae4ba67781df..9289e7da4b5a6397d889dcc948f081ecb8105bac 100644 (file)
@@ -2932,23 +2932,6 @@ UChar RenderObject::backslashAsCurrencySymbol() const
     return '\\';
 }
 
-void RenderObject::imageChanged(CachedImage* image)
-{
-    // Repaint when the background image or border image finishes loading.
-    // This is needed for RenderBox objects, and also for table objects that hold
-    // backgrounds that are then respected by the table cells (which are RenderBox
-    // subclasses). It would be even better to find a more elegant way of doing this that
-    // would avoid putting this function and the CachedResourceClient base class into RenderObject.
-    if (image && image->canRender() && parent()) {
-        if (view() && element() && (element()->hasTagName(htmlTag) || element()->hasTagName(bodyTag)))
-            // repaint the entire canvas since the background gets propagated up
-            view()->repaint();
-        else
-            // repaint object, which is a box or a container with boxes inside it
-            repaint();
-    }
-}
-
 bool RenderObject::willRenderImage(CachedImage*)
 {
     // Without visibility we won't render (and therefore don't care about animation).
index f011ab0cc48c83278ccd80bf511cca5e9400b63c..24cf1e688bad56b08131d3f0910b9bf3775272ad 100644 (file)
@@ -869,7 +869,7 @@ public:
     virtual int previousOffset(int current) const;
     virtual int nextOffset(int current) const;
 
-    virtual void imageChanged(CachedImage*);
+    virtual void imageChanged(CachedImage*) { }
     virtual bool willRenderImage(CachedImage*);
 
     virtual void selectionStartEnd(int& spos, int& epos) const;
index dc93e8c9c9c2d404c38c50c0ef56a5cd9909a471..b2a51b2570142f3ec537ee067b9b74a244938a13 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "RenderTableCol.h"
 
+#include "CachedImage.h"
 #include "HTMLNames.h"
 #include "HTMLTableColElement.h"
 #include "TextStream.h"
@@ -63,6 +64,29 @@ bool RenderTableCol::canHaveChildren() const
     return style()->display() == TABLE_COLUMN_GROUP;
 }
 
+IntRect RenderTableCol::getAbsoluteRepaintRect()
+{
+    // For now, just repaint the whole table.
+    // FIXME: Find a better way to do this, e.g., need to repaint all the cells that we
+    // might have propagated a background color or borders into.
+    RenderObject* table = parent();
+    if (table && !table->isTable())
+        table = table->parent();
+    if (table && table->isTable())
+        return table->getAbsoluteRepaintRect();
+
+    return IntRect();
+}
+
+void RenderTableCol::imageChanged(CachedImage* image)
+{
+    if (!image || !image->canRender() || !parent())
+        return;
+
+    // FIXME: Repaint only the rect the image paints in.
+    repaint();
+}
+
 #ifndef NDEBUG
 void RenderTableCol::dump(TextStream* stream, DeprecatedString ind) const
 {
index 017f036fedd979059cf9c32662f268fe70fd3dd4..8898d3d0b68604f0e4a65b95437fa1244be95959 100644 (file)
@@ -43,6 +43,9 @@ public:
     virtual bool canHaveChildren() const;
     virtual bool requiresLayer() { return false; }
 
+    virtual IntRect getAbsoluteRepaintRect();
+    virtual void imageChanged(CachedImage*);
+
 #ifndef NDEBUG
     virtual void dump(TextStream*, DeprecatedString) const;
 #endif
index 861dfc155dbaa7d8404427121e2cef8396a19e00..39142f7fb2a3e207d6281aec1e28ef1cd38195b6 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "RenderTableRow.h"
 
+#include "CachedImage.h"
 #include "Document.h"
 #include "HTMLNames.h"
 #include "RenderTableCell.h"
@@ -174,4 +175,13 @@ void RenderTableRow::paint(PaintInfo& paintInfo, int tx, int ty)
     }
 }
 
+void RenderTableRow::imageChanged(CachedImage* image)
+{
+    if (!image || !image->canRender() || !parent())
+        return;
+    
+    // FIXME: Examine cells and repaint only the rect the image paints in.
+    repaint();
+}
+
 } // namespace WebCore
index d73f13ebf984fdc0a28cc1db90cb9c742097d278..302459a9286f76cc9b66a4fdfafd396ab59815dc 100644 (file)
@@ -56,6 +56,7 @@ public:
     virtual bool requiresLayer() { return isTransparent() || hasOverflowClip(); }
 
     virtual void paint(PaintInfo&, int tx, int ty);
+    virtual void imageChanged(CachedImage*);
 };
 
 } // namespace WebCore
index 97049878cf3a35cbcb9d58886dc34dc844ae22fd..6beddeebf06a686b9052043267031e929bad8c71 100644 (file)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "RenderTableSection.h"
 
+#include "CachedImage.h"
 #include "Document.h"
 #include "HTMLNames.h"
 #include "RenderTableCell.h"
@@ -917,6 +918,15 @@ void RenderTableSection::paint(PaintInfo& paintInfo, int tx, int ty)
     }
 }
 
+void RenderTableSection::imageChanged(CachedImage* image)
+{
+    if (!image || !image->canRender() || !parent())
+        return;
+    
+    // FIXME: Examine cells and repaint only the rect the image paints in.
+    repaint();
+}
+
 void RenderTableSection::recalcCells()
 {
     m_cCol = 0;
index 98e8dd7758511d4fee9c2b16cf53d48504090055..fd61e7bf656904207d4288f20a5797220a0ccc51 100644 (file)
@@ -99,6 +99,7 @@ public:
     int outerBorderRight() const { return m_outerBorderRight; }
 
     virtual void paint(PaintInfo&, int tx, int ty);
+    virtual void imageChanged(CachedImage*);
 
     int numRows() const { return m_gridRows; }
     int numColumns() const;