Added: trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation-expected.txt (0 => 295271)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation-expected.txt 2022-06-05 09:06:26 UTC (rev 295271)
@@ -0,0 +1,17 @@
+
+PASS The table cell width calculation quirk, baseline
+PASS The table cell width calculation quirk, basic
+PASS The table cell width calculation quirk, inline-block
+PASS The table cell width calculation quirk, img in span
+PASS The table cell width calculation quirk, the don't-wrap rule is only for the purpose of calculating the width of the cell
+PASS The table cell width calculation quirk, the quirk only applies when the cell is the containing block
+PASS The table cell width calculation quirk, the quirk shouldn't apply for generated content
+PASS The table cell width calculation quirk, the quirk shouldn't apply for <input>
+PASS The table cell width calculation quirk, the quirk shouldn't apply for <object>
+PASS The table cell width calculation quirk, the quirk shouldn't apply for <embed>
+PASS The table cell width calculation quirk, the quirk shouldn't apply for <video poster>
+PASS The table cell width calculation quirk, non-auto width on cell
+PASS The table cell width calculation quirk, zero width on cell, specified with on table
+PASS The table cell width calculation quirk, display:table-cell on span
+PASS The table cell width calculation quirk, display:table-cell on span, wbr
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation.html (0 => 295271)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/quirks/table-cell-width-calculation.html 2022-06-05 09:06:26 UTC (rev 295271)
@@ -0,0 +1,174 @@
+<!doctype html>
+<html>
+ <head>
+ <title>The table cell width calculation quirk</title>
+ <script src=""
+ <script src=""
+ <style> iframe { width:200px; height:20px; } </style>
+ </head>
+ <body>
+ <div id=log></div>
+ <iframe id=quirks></iframe>
+ <iframe id=almost></iframe>
+ <iframe id=standards></iframe>
+ <script>
+ setup({explicit_done:true});
+
+ var png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==";
+ var preload = new Image();
+ preload.src = ""
+
+ _onload_ = function() {
+ var html = "<style id=style></style><table><tr><td id=test></table><table><tr><td id=ref></table><table><tr><td id=s_ref></table>";
+ var a_doctype = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
+ var s_doctype = '<!DOCTYPE HTML>';
+ var q = document.getElementById('quirks').contentWindow;
+ var a = document.getElementById('almost').contentWindow;
+ var s = document.getElementById('standards').contentWindow;
+ q.document.open();
+ q.document.write(html);
+ q.document.close();
+ a.document.open();
+ a.document.write(a_doctype + html);
+ a.document.close();
+ s.document.open();
+ s.document.write(s_doctype + html);
+ s.document.close();
+ [q, a, s].forEach(function(win) {
+ ['style', 'test', 'ref', 's_ref'].forEach(function(id) {
+ Object.getPrototypeOf(win).__defineGetter__(id, function() { return win.document.getElementById(id); });
+ });
+ });
+ q.title = 'quirks mode';
+ a.title = 'almost standards mode';
+ s.title = 'standards mode';
+
+ var tests = [
+ {desc:"baseline",
+ style:'table { width:8px }', // cell content width should be 2px (2px cell-spacing, 1px padding)
+ test:'<img src=""
+ ref:'<img src=""
+ s_ref:'<img src=""
+
+ {desc:"basic",
+ style:'table { width:8px }',
+ test:'<img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"inline-block",
+ style:'table { width:8px } img { display:inline-block }',
+ test:'<img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"img in span",
+ style:'table { width:8px }',
+ test:'<span><img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"the don't-wrap rule is only for the purpose of calculating the width of the cell",
+ style:'table { width:8px }',
+ test:'<img src="" src="" src="" src=""
+ ref:'<nobr><img src="" src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src="" src=""
+
+ {desc:"the quirk only applies when the cell is the containing block",
+ style:'table { width:8px }',
+ test:'<div><img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src="" src=""
+
+ {desc:"the quirk shouldn't apply for generated content",
+ style:'table { width:8px } #test::before { content:url("{png}") url("{png}") url("{png}") }',
+ test:'',
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"the quirk shouldn't apply for <input>",
+ style:'table { width:8px }',
+ test:'<input type=image src="" type=image src="" type=image src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"the quirk shouldn't apply for <object>",
+ style:'table { width:8px }',
+ test:'<object data="" data="" data=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"the quirk shouldn't apply for <embed>",
+ style:'table { width:8px }',
+ test:'<embed src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"the quirk shouldn't apply for <video poster>",
+ style:'table { width:8px }',
+ test:'<video poster="{png}"></video><video poster="{png}"></video><video poster="{png}"></video>',
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"non-auto width on cell",
+ style:'td { width:2px }',
+ test:'<img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ {desc:"zero width on cell, specified with on table",
+ style:'table { width:8px } td { width:0 }',
+ test:'<img src="" src="" src=""
+ ref:'<nobr><img src="" src="" src=""
+ s_ref:'<nobr><img src="" src="" src=""
+
+ // tests below use overwrite body.innerHTML so tests using test/ref/s_ref props need to be above
+ {desc:"display:table-cell on span",
+ style:'div { display:table; width:2px } span { display:table-cell }',
+ body:'<div><span id=test><img src="" src="" src=""
+ '<div><span id=ref><nobr><img src="" src="" src=""
+ '<div><span id=s_ref><nobr><img src="" src="" src=""
+
+ {desc:"display:table-cell on span, wbr",
+ style:'div { display:table; width:2px } span { display:table-cell }',
+ body:'<div><span id=test><img src="" src="" src="" src=""
+ '<div><span id=ref><nobr><img src="" src="" src="" src=""
+ '<div><span id=s_ref><nobr><img src="" src="" src="" src=""
+ ];
+
+ tests.forEach(function(t) {
+ test(function() {
+ var style = t.style.replace(/\{png\}/g, png);
+ var test = t.test && t.test.replace(/\{png\}/g, png);
+ var ref = t.ref && t.ref.replace(/\{png\}/g, png);
+ var s_ref = t.s_ref && t.s_ref.replace(/\{png\}/g, png);
+ var body = t.body && t.body.replace(/\{png\}/g, png);
+ [q, a, s].forEach(function(win) {
+ win.style.textContent = style;
+ if (body !== undefined) {
+ win.document.body.innerHTML = body;
+ } else {
+ win.test.innerHTML = test;
+ win.ref.innerHTML = ref;
+ win.s_ref.innerHTML = s_ref;
+ }
+ assert_equals(win.getComputedStyle(win.test).width,
+ win.getComputedStyle(win == q ? win.ref : win.s_ref).width,
+ 'cell width, '+win.title);
+ var test_imgs = win.test.querySelectorAll('img');
+ var ref_imgs = win.ref.querySelectorAll('img');
+ var s_ref_imgs = win.s_ref.querySelectorAll('img');
+ for (var i = 0; i < test_imgs.length; ++i) {
+ assert_equals(test_imgs[i].offsetLeft,
+ win == q ? ref_imgs[i].offsetLeft : s_ref_imgs[i].offsetLeft,
+ 'img '+i+' offsetLeft, '+win.title);
+ }
+ });
+ }, document.title+', '+t.desc);
+ });
+
+ done();
+ }
+ </script>
+ </body>
+</html>
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (295270 => 295271)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2022-06-05 06:59:51 UTC (rev 295270)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2022-06-05 09:06:26 UTC (rev 295271)
@@ -1187,6 +1187,20 @@
}
}
+#if ENABLE(SERVICE_WORKER)
+static inline bool mustReloadFromServiceWorkerOptions(const ResourceLoaderOptions& options, const ResourceLoaderOptions& cachedOptions)
+{
+ // FIXME: We should validate/specify this behavior.
+ if (options.serviceWorkerRegistrationIdentifier != cachedOptions.serviceWorkerRegistrationIdentifier)
+ return true;
+
+ if (options.serviceWorkersMode == cachedOptions.serviceWorkersMode)
+ return false;
+
+ return cachedOptions.mode == FetchOptions::Mode::Navigate || cachedOptions.destination == FetchOptions::Destination::Worker || cachedOptions.destination == FetchOptions::Destination::Sharedworker;
+}
+#endif
+
CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, CachedResourceRequest& cachedResourceRequest, CachedResource* existingResource, ForPreload forPreload, ImageLoading imageLoading) const
{
auto& request = cachedResourceRequest.resourceRequest();
@@ -1201,8 +1215,7 @@
return Reload;
#if ENABLE(SERVICE_WORKER)
- // FIXME: We should validate/specify this behavior.
- if (cachedResourceRequest.options().serviceWorkerRegistrationIdentifier != existingResource->options().serviceWorkerRegistrationIdentifier || cachedResourceRequest.options().serviceWorkersMode != existingResource->options().serviceWorkersMode) {
+ if (mustReloadFromServiceWorkerOptions(cachedResourceRequest.options(), existingResource->options())) {
LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading because selected service worker may differ");
return Reload;
}