Title: [109960] branches/chromium/1025
Revision
109960
Author
mih...@chromium.org
Date
2012-03-06 14:41:00 -0800 (Tue, 06 Mar 2012)

Log Message

Merge 109543 - REGRESSION (r104060): Page contents not painted if inserting a new stylesheet and temporary body node
https://bugs.webkit.org/show_bug.cgi?id=76590

Reviewed by Maciej Stachowiak.

Source/WebCore: 

Test: fast/css/pending-stylesheet-repaint.html
        
If there has been a style recalc with a pending stylesheet, the forced repaint will need to be triggered even
if the stylesheet doesn't affect the rendering. Otherwise we may end up never painting at all.

* dom/Document.cpp:
(WebCore::Document::styleSelectorChanged):

LayoutTests: 

* fast/css/pending-stylesheet-repaint-expected.png: Added.
* fast/css/pending-stylesheet-repaint-expected.txt: Added.
* fast/css/pending-stylesheet-repaint.html: Added.



TBR=an...@apple.com
Review URL: https://chromiumcodereview.appspot.com/9618030

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint-expected.png (from rev 109543, trunk/LayoutTests/fast/css/pending-stylesheet-repaint-expected.png)


(Binary files differ)

Copied: branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint-expected.txt (from rev 109543, trunk/LayoutTests/fast/css/pending-stylesheet-repaint-expected.txt) (0 => 109960)


--- branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint-expected.txt	                        (rev 0)
+++ branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint-expected.txt	2012-03-06 22:41:00 UTC (rev 109960)
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x8
+  RenderBlock {HTML} at (0,0) size 800x8
+    RenderBody {BODY} at (8,8) size 784x0
+layer at (8,8) size 32x32
+  RenderBlock (positioned) {DIV} at (8,8) size 32x32 [bgcolor=#008000]

Copied: branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint.html (from rev 109543, trunk/LayoutTests/fast/css/pending-stylesheet-repaint.html) (0 => 109960)


--- branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint.html	                        (rev 0)
+++ branches/chromium/1025/LayoutTests/fast/css/pending-stylesheet-repaint.html	2012-03-06 22:41:00 UTC (rev 109960)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Test case</title>
+</head>
+
+<body>
+  <div style="background: green; width: 32px; height: 32px; position: absolute"></div>
+
+  <script>
+    window.addEventListener(
+        'DOMContentLoaded',
+        function() {
+          // Must dynamically fetch another stylesheet
+          var el = document.createElement('link');
+          el.href = '';
+          el.type = 'text/css';
+          el.rel = 'stylesheet';
+          document.getElementsByTagName('head')[0].appendChild(el);
+
+          // Based on jQuery pre-1.6.2 code, which creates a temporary <body>
+          // element to do tests on:
+          // https://github.com/jquery/jquery/blob/304dd618b7aa17158446bedd80af330375d8d4d4/src/support.js#L138
+          // The behavior was changed for jQuery 1.6.2 with this commit:
+          // https://github.com/jquery/jquery/commit/ceba855c010c792aad8fc15edc06b86285f71142/
+          var anotherBody = document.createElement('body');
+
+          document.documentElement.insertBefore(
+              anotherBody, document.documentElement.firstChild);
+
+          // Triggering a style recalc here is necessary.
+          anotherBody.offsetHeight;
+
+          anotherBody.parentNode.removeChild(anotherBody);
+        },
+        false);
+  </script>
+</body>
+</html>

Modified: branches/chromium/1025/Source/WebCore/dom/Document.cpp (109959 => 109960)


--- branches/chromium/1025/Source/WebCore/dom/Document.cpp	2012-03-06 22:16:32 UTC (rev 109959)
+++ branches/chromium/1025/Source/WebCore/dom/Document.cpp	2012-03-06 22:41:00 UTC (rev 109960)
@@ -3003,20 +3003,21 @@
 #endif
 
     bool stylesheetChangeRequiresStyleRecalc = updateActiveStylesheets(updateFlag);
-    if (!stylesheetChangeRequiresStyleRecalc)
-        return;
 
     if (updateFlag == DeferRecalcStyle) {
         scheduleForcedStyleRecalc();
         return;
     }
-    
+
     if (didLayoutWithPendingStylesheets() && m_pendingStylesheets <= 0) {
         m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
         if (renderer())
             renderer()->repaint();
     }
 
+    if (!stylesheetChangeRequiresStyleRecalc)
+        return;
+
     // This recalcStyle initiates a new recalc cycle. We need to bracket it to
     // make sure animations get the correct update time
     if (m_frame)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to