From a5c3fb7a27e476a13516c9cc0a1ae7cef527bfb1 Mon Sep 17 00:00:00 2001 From: "eae@chromium.org" Date: Tue, 3 Jul 2012 02:22:46 +0000 Subject: [PATCH] Position replaced elements on pixel bounds https://bugs.webkit.org/show_bug.cgi?id=90354 Reviewed by Eric Seidel. To avoid sizing and repaint issues we should layout replaced elements on pixel bounds. We already ensure that replaced elements are sized in full pixels and that they are painted on pixel bounds. By also ensuring that they are placed on pixel bounds we avoid pixel having the size be expanded by pixel snapping and repainting/invalidation rect issues when scrolling. Test: fast/repaint/repaint-during-scroll-with-zoom.html * rendering/RenderBox.cpp: (WebCore::RenderBox::computePositionedLogicalWidthReplaced): (WebCore::RenderBox::computePositionedLogicalHeightReplaced): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121722 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- .../repaint/repaint-during-scroll-with-zoom.html | 51 +++++++++++++++++++++ .../repaint-during-scroll-with-zoom-expected.png | Bin 0 -> 4340 bytes .../repaint-during-scroll-with-zoom-expected.txt | 14 ++++++ .../fast/box-sizing/box-sizing-expected.txt | 8 ++-- .../media-document-audio-repaint-expected.txt | 2 +- ...-height-75p-on-target-svg-absolute-expected.png | Bin 3081 -> 3060 bytes ...-height-75p-on-target-svg-absolute-expected.txt | 8 ++-- ...width-50p-height-75p-on-target-svg-expected.png | Bin 3068 -> 3050 bytes ...width-50p-height-75p-on-target-svg-expected.txt | 8 ++-- Source/WebCore/ChangeLog | 20 ++++++++ Source/WebCore/rendering/RenderBox.cpp | 4 +- 11 files changed, 100 insertions(+), 15 deletions(-) create mode 100644 LayoutTests/fast/repaint/repaint-during-scroll-with-zoom.html create mode 100644 LayoutTests/platform/chromium-linux/fast/repaint/repaint-during-scroll-with-zoom-expected.png create mode 100644 LayoutTests/platform/chromium-linux/fast/repaint/repaint-during-scroll-with-zoom-expected.txt diff --git a/LayoutTests/fast/repaint/repaint-during-scroll-with-zoom.html b/LayoutTests/fast/repaint/repaint-during-scroll-with-zoom.html new file mode 100644 index 0000000..584c458 --- /dev/null +++ b/LayoutTests/fast/repaint/repaint-during-scroll-with-zoom.html @@ -0,0 +1,51 @@ + + + + + + + + + + + diff --git a/LayoutTests/platform/chromium-linux/fast/repaint/repaint-during-scroll-with-zoom-expected.png b/LayoutTests/platform/chromium-linux/fast/repaint/repaint-during-scroll-with-zoom-expected.png new file mode 100644 index 0000000000000000000000000000000000000000..b21f83e666ccd4532d33f29b1ec4d80abe15014c GIT binary patch literal 4340 zcmeHLdo_ukq|CPN6wnfuh#wRu65Ts_wW3*AM3mK`tJSx?9cb}-S?dx zZDscz-3I`WwYzAI20&5`02oFZ2F)D)+hHxJ(I(hn2zWnlynkp|ATTzA``k44GRNb+ zP0Y_2n4R&4#@E>0dO$M&ib57*}NqVy{)P9i(JJgf8|EZ4NgAT&eU(^b1Y`iM(<&mv2CG4;L>?7~| z<2l8=Nh3~NXugY@Ph3JYCm{NfV+EjL4v`Z-Qb|+w`deFzqux4P$ZX_^Yg)F z1;C0MvL~g>FCd^~@CwMyk*$s+lgT{3r6>PrT1#VNWB*nqy2z!tAKiXOQmWQW8^E8v z!8rlL&&$NpYuF7qpoWiYG^T4g%?(%iuYua!9>0?3Pi|MaJ?oini~;XHHu_R2aqBY` zzHGf?R*LR;@8EtcjQR2&+cQ@5J|as70600^(}djB+}vCh&*?Jd#8+gom$uY)co^Z_I_V zkrAK!ir8m2W}lJHTEwgd`;*@$%b_;s-^On)v_3jvONsiFy=vO2+4J&L+HNZ+nN$)f z3r&exY%3}%dh=$*M1Y8xdyd$`1CdX-n!kd&0<7KE#d{3$q?YJzif8!q>@_qT+@2Wl+h{QORq z2itM!AGh{r5&9R!R9x8?m+~`0r&wWuL=XVy8(}IcD(K<-^-UogtIwt&>2kjWL+ti7T$ub4p@u$&Qu&-Di$_@}IO+03HK+WPIyG z26W>j)K(;K61rY}$SZzB6gO5ByFOD;x-c;@(bQyp>pVR|Fqev29ZUSfx4g)>?D=3i z%rg`M$bEUO?`>_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!7l;aph!aL4ricYU^u3_EnLAD3fbFfe7}W>8Suz`&3MVwhR~|MK<4 zy%w wasfUX8l#~Bsme!F!e~kuO$k)Z1^*dmNf_QgRe$(CusP4*>FVdQ&MBb@0IL0}F#rGn diff --git a/LayoutTests/platform/chromium-win/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt b/LayoutTests/platform/chromium-win/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt index acad5da..9c2c0c5 100644 --- a/LayoutTests/platform/chromium-win/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt +++ b/LayoutTests/platform/chromium-win/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt @@ -14,7 +14,7 @@ layer at (0,0) size 500x155 layerType: foreground only RenderSVGRoot {svg} at (0,0) size 125x113 RenderSVGRect {rect} at (0,0) size 125x113 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=125.00] [height=112.50] RenderSVGRect {rect} at (6,5) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=6.25] [y=5.63] [width=112.50] [height=101.25] -layer at (0,118) size 125x112 - RenderSVGRoot {svg} at (0,117) size 125x113 - RenderSVGRect {rect} at (0,117) size 125x113 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] - RenderSVGRect {rect} at (6,122) size 113x103 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] +layer at (0,118) size 125x113 + RenderSVGRoot {svg} at (0,118) size 125x113 + RenderSVGRect {rect} at (0,118) size 125x113 [fill={[type=SOLID] [color=#ADD8E6]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00] + RenderSVGRect {rect} at (6,123) size 113x102 [fill={[type=SOLID] [color=#008000]}] [x=5.00] [y=5.00] [width=90.00] [height=90.00] diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 4f25e96..d12e0aa 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,23 @@ +2012-07-02 Emil A Eklund + + Position replaced elements on pixel bounds + https://bugs.webkit.org/show_bug.cgi?id=90354 + + Reviewed by Eric Seidel. + + To avoid sizing and repaint issues we should layout replaced elements on + pixel bounds. We already ensure that replaced elements are sized in full + pixels and that they are painted on pixel bounds. By also ensuring that + they are placed on pixel bounds we avoid pixel having the size be + expanded by pixel snapping and repainting/invalidation rect issues when + scrolling. + + Test: fast/repaint/repaint-during-scroll-with-zoom.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computePositionedLogicalWidthReplaced): + (WebCore::RenderBox::computePositionedLogicalHeightReplaced): + 2012-07-02 Nico Weber Fix new -Wunused-private-field violations diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 9a8cc50..3fd97df 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -3265,7 +3265,7 @@ void RenderBox::computePositionedLogicalWidthReplaced() LayoutUnit logicalLeftPos = logicalLeftValue + marginLogicalLeftAlias; computeLogicalLeftPositionedOffset(logicalLeftPos, this, logicalWidth(), containerBlock, containerLogicalWidth); - setLogicalLeft(logicalLeftPos); + setLogicalLeft(logicalLeftPos.round()); } void RenderBox::computePositionedLogicalHeightReplaced() @@ -3394,7 +3394,7 @@ void RenderBox::computePositionedLogicalHeightReplaced() // Use computed values to calculate the vertical position. LayoutUnit logicalTopPos = logicalTopValue + marginBeforeAlias; computeLogicalTopPositionedOffset(logicalTopPos, this, logicalHeight(), containerBlock, containerLogicalHeight); - setLogicalTop(logicalTopPos); + setLogicalTop(logicalTopPos.round()); } LayoutRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit* extraWidthToEndOfLine) -- 2.7.4