WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-88869-20120613180400.patch (text/plain), 7.27 KB, created by
Shrey Banga
on 2012-06-13 18:04:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Shrey Banga
Created:
2012-06-13 18:04:01 PDT
Size:
7.27 KB
patch
obsolete
>Subversion Revision: 120162 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index eef9d66bb207fc0527cb6747c055cca695074cbb..23e184f7d0800425c5b5c59c93a123824b619b55 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2012-06-13 Shrey Banga <banga@chromium.org> >+ >+ renderer should not block on script-inserted stylesheets >+ https://bugs.webkit.org/show_bug.cgi?id=88869 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ According to the HTML5 spec, section 4.2.7, we don't need to block on >+ script-inserted stylesheets. This fix achieves that by checking the >+ m_createdByParser flag before marking a sheet as blocking. >+ www.nytimes.com showed a ~100ms improvement in page load times after >+ this change, measured via http://code.google.com/p/web-page-replay/ >+ >+ Test: http/tests/css/script-inserted-stylesheet.html >+ >+ * html/HTMLLinkElement.cpp: >+ (WebCore::HTMLLinkElement::process): added m_createdByParser to blocking flag's checks >+ > 2012-06-12 Wei James <james.wei@intel.com> > > webcore should depend on webcore_arm_neon for only arm target_arch >diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp >index f378de5dcc34a8a4ecb388fac47cbe1c8873155b..e61c8a8227ddaf63f50a85ecf4fa53bbc57b59af 100644 >--- a/Source/WebCore/html/HTMLLinkElement.cpp >+++ b/Source/WebCore/html/HTMLLinkElement.cpp >@@ -214,7 +214,7 @@ void HTMLLinkElement::process() > > // Don't hold up render tree construction and script execution on stylesheets > // that are not needed for the rendering at the moment. >- bool blocking = mediaQueryMatches && !isAlternate(); >+ bool blocking = m_createdByParser && mediaQueryMatches && !isAlternate(); > addPendingSheet(blocking ? Blocking : NonBlocking); > > // Load stylesheets that are not needed for the rendering immediately with low priority. >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 21ccad2fadc51c194fc41e81a29e689f0817ef97..0e3c9e3b4d2985d20bf66bdd9bfe6b1997f6fa47 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,19 @@ >+2012-06-13 Shrey Banga <banga@chromium.org> >+ >+ renderer should not block on script-inserted stylesheets >+ https://bugs.webkit.org/show_bug.cgi?id=88869 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This test attempts to insert a slow stylesheet, followed by two loads >+ to scripts which should not block on the stylesheet. >+ >+ * http/tests/css/resources/script-inserted-stylesheet-external-script-1.js: Added. >+ * http/tests/css/resources/script-inserted-stylesheet-external-script-2.js: Added. >+ * http/tests/css/resources/script-inserted-stylesheet-external-stylesheet.php: Added. >+ * http/tests/css/script-inserted-stylesheet-expected.txt: Added. >+ * http/tests/css/script-inserted-stylesheet.html: Added. >+ > 2012-06-12 Edaena Salinas Jasso <edaena@apple.com> > > Can't set el.type on a <button> element >diff --git a/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-1.js b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-1.js >new file mode 100644 >index 0000000000000000000000000000000000000000..8818184271e66e36b6aa5d5966493ae5dfced8ff >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-1.js >@@ -0,0 +1 @@ >+onScript1Loaded(); >diff --git a/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-2.js b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-2.js >new file mode 100644 >index 0000000000000000000000000000000000000000..5d9996dda725163e297a7763dfa10ef87c8e9d4b >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-script-2.js >@@ -0,0 +1 @@ >+onScript2Loaded(); >diff --git a/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-stylesheet.php b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-stylesheet.php >new file mode 100644 >index 0000000000000000000000000000000000000000..bf551466c4534fca71a1a1ce5dc0a384932f972a >--- /dev/null >+++ b/LayoutTests/http/tests/css/resources/script-inserted-stylesheet-external-stylesheet.php >@@ -0,0 +1,6 @@ >+<?php >+ header('Content-type: text/css'); >+ sleep(intval($_GET['delay'])); >+?> >+body { background: #F00; } >+ >diff --git a/LayoutTests/http/tests/css/script-inserted-stylesheet-expected.txt b/LayoutTests/http/tests/css/script-inserted-stylesheet-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..43e56d9e088d076a5f900759c238faec87701a4e >--- /dev/null >+++ b/LayoutTests/http/tests/css/script-inserted-stylesheet-expected.txt >@@ -0,0 +1,11 @@ >+This tests that stylesheets inserted through scripts don't block the parser (https://bugs.webkit.org/show_bug.cgi?id=88869) >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS elapsedTime() is within 100 of 0 >+PASS elapsedTime() is within 100 of 0 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/css/script-inserted-stylesheet.html b/LayoutTests/http/tests/css/script-inserted-stylesheet.html >new file mode 100644 >index 0000000000000000000000000000000000000000..fac22691e9d10cf244ad61a18cb889e235eb6c62 >--- /dev/null >+++ b/LayoutTests/http/tests/css/script-inserted-stylesheet.html >@@ -0,0 +1,62 @@ >+<html> >+ <head> >+ <script type="text/javascript" src="../resources/js-test-pre.js"></script> >+ <script> >+ description("This tests that stylesheets inserted through scripts don't block the parser (https://bugs.webkit.org/show_bug.cgi?id=88869)"); >+ >+ if (window.layoutTestController) { >+ layoutTestController.waitUntilDone(); >+ layoutTestController.dumpAsText(); >+ } >+ >+ function onScript1Loaded() { >+ shouldBeCloseTo("elapsedTime()", 0, 100); >+ } >+ >+ function onScript2Loaded() { >+ shouldBeCloseTo("elapsedTime()", 0, 100); >+ } >+ >+ var timerID; >+ function checkStyleSheetLoaded(elem) { >+ if(elem && elem.sheet && elem.sheet.rules && elem.sheet.rules.length > 0) { >+ window.clearInterval(timerID); >+ >+ if (window.layoutTestController) { >+ layoutTestController.notifyDone(); >+ } >+ } >+ } >+ >+ function createLinkElem() { >+ var elem = document.createElement('link'); >+ linkElem = elem; >+ elem.rel = 'stylesheet'; >+ elem.type = 'text/css'; >+ elem.href = 'resources/script-inserted-stylesheet-external-stylesheet.php?delay=1'; >+ document.getElementsByTagName('head')[0].appendChild(elem); >+ >+ timerID = window.setInterval(function() {checkStyleSheetLoaded(elem)}, 30); >+ } >+ >+ var startTime = new Date().getTime(); >+ function elapsedTime() { >+ return new Date().getTime() - startTime; >+ } >+ >+ createLinkElem(); >+ >+ document.write('<scr' + 'ipt type="text/javascript" src="resources/script-inserted-stylesheet-external-script-1.js"></scr' + 'ipt>'); >+ </script> >+ >+ <script> >+ document.write('<scr' + 'ipt type="text/javascript" src="resources/script-inserted-stylesheet-external-script-2.js"></scr' + 'ipt>'); >+ </script> >+ >+ </head> >+ >+<body> >+<script type="text/javascript" src="../resources/js-test-post.js"></script> >+</body> >+</html> >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 88869
:
147411
|
147416
| 147455 |
167836
|
460137