<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>57886</bug_id>
          
          <creation_ts>2011-04-05 14:52:24 -0700</creation_ts>
          <short_desc>Defer repaints during style recalc</short_desc>
          <delta_ts>2011-04-05 15:30:00 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Antti Koivisto">koivisto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>379871</commentid>
    <comment_count>0</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-04-05 14:52:24 -0700</bug_when>
    <thetext>We can reduce time spent invalidating system painting surface by deferring repaints in Document::recalcStyle(). We already do this for layouts.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379872</commentid>
    <comment_count>1</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-04-05 14:52:39 -0700</bug_when>
    <thetext>&lt;rdar://problem/9192489&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379877</commentid>
    <comment_count>2</comment_count>
      <attachid>88312</attachid>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-04-05 14:59:28 -0700</bug_when>
    <thetext>Created attachment 88312
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379884</commentid>
    <comment_count>3</comment_count>
      <attachid>88312</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-04-05 15:02:24 -0700</bug_when>
    <thetext>Comment on attachment 88312
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88312&amp;action=review

&gt; Source/WebCore/dom/Document.cpp:1566
&gt; -    if (view())
&gt; -        view()-&gt;resumeScheduledEvents();
&gt; +    if (frameView) {

Is there any change that view() could become 0 during the process of style recalculation?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379887</commentid>
    <comment_count>4</comment_count>
      <attachid>88312</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-04-05 15:02:58 -0700</bug_when>
    <thetext>Comment on attachment 88312
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88312&amp;action=review

&gt;&gt; Source/WebCore/dom/Document.cpp:1566
&gt;&gt; +    if (frameView) {
&gt; 
&gt; Is there any change that view() could become 0 during the process of style recalculation?

chance, not change

&gt; Source/WebCore/dom/Document.cpp:1568
&gt; +        frameView-&gt;endDeferredRepaints();

Is there any chance that repaints were already deferred and we are ending the deferral too soon?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379893</commentid>
    <comment_count>5</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-04-05 15:10:59 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; &gt; Is there any change that view() could become 0 during the process of style recalculation?

That would probably indicate bug elsewhere

Nevertheless, I switched to a protected pointer:

RefPtr&lt;FrameView&gt; frameView = view();

&gt; &gt; Source/WebCore/dom/Document.cpp:1568
&gt; &gt; +        frameView-&gt;endDeferredRepaints();
&gt; 
&gt; Is there any chance that repaints were already deferred and we are ending the deferral too soon?

begin/endDeferredRepaints are counting.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>379911</commentid>
    <comment_count>6</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2011-04-05 15:30:00 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/82992</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>88312</attachid>
            <date>2011-04-05 14:59:28 -0700</date>
            <delta_ts>2011-04-05 15:02:58 -0700</delta_ts>
            <desc>patch</desc>
            <filename>recalcstyle-defer-repaints-2.patch</filename>
            <type>text/plain</type>
            <size>1949</size>
            <attacher name="Antti Koivisto">koivisto</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBTb3VyY2UvV2Vi
Q29yZS9DaGFuZ2VMb2cJKHJldmlzaW9uIDgyOTgyKQorKysgU291cmNlL1dlYkNvcmUvQ2hhbmdl
TG9nCSh3b3JraW5nIGNvcHkpCkBAIC0xLDMgKzEsMTcgQEAKKzIwMTEtMDQtMDUgIEFudHRpIEtv
aXZpc3RvICA8YW50dGlAYXBwbGUuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAo
T09QUyEpLgorCisgICAgICAgIGh0dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9p
ZD01Nzg4NgorICAgICAgICBEZWZlciByZXBhaW50cyBkdXJpbmcgc3R5bGUgcmVjYWxjCisKKyAg
ICAgICAgVGhpcyByZWR1Y2VzIHRoZSBuZWVkIHRvIGRvIChvZnRlbiBleHBlbnNpdmUpIHBsYXRm
b3JtIHN1cmZhY2UgaW52YWxpZGF0aW9uLgorICAgICAgICBXZSBhbHJlYWR5IGRvIHRoaXMgZHVy
aW5nIGxheW91dCBidXQgc3R5bGUgcmVjYWxjdWxhdGlvbiBtYXkgdHJpZ2dlcgorICAgIC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BBU1NFUlQoIXJlbmRlcmVyKCkgfHwgcmVuZGVyQXJlbmEoKSk7CiAgICAgaWYgKCFy
ZW5kZXJlcigpIHx8ICFyZW5kZXJBcmVuYSgpKQogICAgICAgICBnb3RvIGJhaWxfb3V0OwotICAg
IAorCiAgICAgaWYgKG1fcGVuZGluZ1N0eWxlUmVjYWxjU2hvdWxkRm9yY2UpCiAgICAgICAgIGNo
YW5nZSA9IEZvcmNlOwogCkBAIC0xNTU5LDggKzE1NjMsMTAgQEAgYmFpbF9vdXQ6CiAgICAgICAg
IG1fdXNlc0xpbmtSdWxlcyA9IG1fc3R5bGVTZWxlY3Rvci0+dXNlc0xpbmtSdWxlcygpOwogICAg
IH0KIAotICAgIGlmICh2aWV3KCkpCi0gICAgICAgIHZpZXcoKS0+cmVzdW1lU2NoZWR1bGVkRXZl
bnRzKCk7CisgICAgaWYgKGZyYW1lVmlldykgeworICAgICAgICBmcmFtZVZpZXctPnJlc3VtZVNj
aGVkdWxlZEV2ZW50cygpOworICAgICAgICBmcmFtZVZpZXctPmVuZERlZmVycmVkUmVwYWludHMo
KTsKKyAgICB9CiAgICAgUmVuZGVyV2lkZ2V0OjpyZXN1bWVXaWRnZXRIaWVyYXJjaHlVcGRhdGVz
KCk7CiAgICAgcmVzdW1lUG9zdEF0dGFjaENhbGxiYWNrcygpOwogICAgIG1faW5TdHlsZVJlY2Fs
YyA9IGZhbHNlOwo=
</data>
<flag name="review"
          id="80806"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>