WebKit Bugzilla
Attachment 343745 Details for
Bug 187113
: Don't invoke post resolution callbacks when resolving computed style
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
post-resolution-computed-style.patch (text/plain), 8.86 KB, created by
Antti Koivisto
on 2018-06-27 13:17:32 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2018-06-27 13:17:32 PDT
Size:
8.86 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 233272) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,32 @@ >+2018-06-27 Antti Koivisto <antti@apple.com> >+ >+ Don't invoke post resolution callbacks when resolving computed style >+ https://bugs.webkit.org/show_bug.cgi?id=187113 >+ <rdar://problem/41365766> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Post-resolution callbacks should only be invoked when we resolve the full document style, >+ not when resolving computed style for a single element. >+ >+ Tests: fast/dom/object-computed-style-event.html >+ >+ * dom/Document.cpp: >+ (WebCore::Document::styleForElementIgnoringPendingStylesheets): >+ * dom/Element.cpp: >+ (WebCore::Element::resolveComputedStyle): >+ >+ Also ref the ancestor stack to be safe. >+ >+ * style/StyleTreeResolver.cpp: >+ (WebCore::Style::PostResolutionCallbackDisabler::PostResolutionCallbackDisabler): >+ (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler): >+ >+ Add an option to not drain the callback queue on destruction. In this mode we >+ just block network loads. >+ >+ * style/StyleTreeResolver.h: >+ > 2018-06-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Out-of-flow positioned element's height depends on its containing block's height. >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 233164) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -2021,7 +2021,7 @@ std::unique_ptr<RenderStyle> Document::s > ASSERT(pseudoElementSpecifier == PseudoId::None || parentStyle); > > // On iOS request delegates called during styleForElement may result in re-entering WebKit and killing the style resolver. >- Style::PostResolutionCallbackDisabler disabler(*this); >+ Style::PostResolutionCallbackDisabler disabler(*this, Style::PostResolutionCallbackDisabler::DrainCallbacks::No); > > SetForScope<bool> change(m_ignorePendingStylesheets, true); > auto& resolver = element.styleResolver(); >Index: Source/WebCore/dom/Element.cpp >=================================================================== >--- Source/WebCore/dom/Element.cpp (revision 233164) >+++ Source/WebCore/dom/Element.cpp (working copy) >@@ -2746,7 +2746,7 @@ const RenderStyle& Element::resolveCompu > ASSERT(isConnected()); > ASSERT(!existingComputedStyle()); > >- Deque<Element*, 32> elementsRequiringComputedStyle({ this }); >+ Deque<RefPtr<Element>, 32> elementsRequiringComputedStyle({ this }); > const RenderStyle* computedStyle = nullptr; > > // Collect ancestors until we find one that has style. >@@ -2760,7 +2760,7 @@ const RenderStyle& Element::resolveCompu > } > > // Resolve and cache styles starting from the most distant ancestor. >- for (auto* element : elementsRequiringComputedStyle) { >+ for (auto& element : elementsRequiringComputedStyle) { > auto style = document().styleForElementIgnoringPendingStylesheets(*element, computedStyle); > computedStyle = style.get(); > ElementRareData& rareData = element->ensureElementRareData(); >Index: Source/WebCore/style/StyleTreeResolver.cpp >=================================================================== >--- Source/WebCore/style/StyleTreeResolver.cpp (revision 233164) >+++ Source/WebCore/style/StyleTreeResolver.cpp (working copy) >@@ -604,7 +604,8 @@ static void suspendMemoryCacheClientCall > > static unsigned resolutionNestingDepth; > >-PostResolutionCallbackDisabler::PostResolutionCallbackDisabler(Document& document) >+PostResolutionCallbackDisabler::PostResolutionCallbackDisabler(Document& document, DrainCallbacks drainCallbacks) >+ : m_drainCallbacks(drainCallbacks) > { > ++resolutionNestingDepth; > >@@ -618,12 +619,13 @@ PostResolutionCallbackDisabler::PostReso > PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler() > { > if (resolutionNestingDepth == 1) { >- // Get size each time through the loop because a callback can add more callbacks to the end of the queue. >- auto& queue = postResolutionCallbackQueue(); >- for (size_t i = 0; i < queue.size(); ++i) >- queue[i](); >- queue.clear(); >- >+ if (m_drainCallbacks == DrainCallbacks::Yes) { >+ // Get size each time through the loop because a callback can add more callbacks to the end of the queue. >+ auto& queue = postResolutionCallbackQueue(); >+ for (size_t i = 0; i < queue.size(); ++i) >+ queue[i](); >+ queue.clear(); >+ } > platformStrategies()->loaderStrategy()->resumePendingRequests(); > } > >Index: Source/WebCore/style/StyleTreeResolver.h >=================================================================== >--- Source/WebCore/style/StyleTreeResolver.h (revision 233164) >+++ Source/WebCore/style/StyleTreeResolver.h (working copy) >@@ -112,8 +112,11 @@ bool postResolutionCallbacksAreSuspended > > class PostResolutionCallbackDisabler { > public: >- explicit PostResolutionCallbackDisabler(Document&); >+ enum class DrainCallbacks { Yes, No }; >+ explicit PostResolutionCallbackDisabler(Document&, DrainCallbacks = DrainCallbacks::Yes); > ~PostResolutionCallbackDisabler(); >+private: >+ DrainCallbacks m_drainCallbacks; > }; > > } >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 233164) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,27 @@ >+2018-06-27 Antti Koivisto <antti@apple.com> >+ >+ Don't invoke post resolution callbacks when resolving computed style >+ https://bugs.webkit.org/show_bug.cgi?id=187113 >+ <rdar://problem/41365766> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * css3/color-filters/color-filter-ignore-semantic-expected.html: Replaced. >+ * css3/color-filters/color-filter-ignore-semantic.html: Replaced. >+ * fast/dom/object-computed-style-event-expected.txt: Added. >+ * fast/dom/object-computed-style-event.html: Added. >+ >+2018-06-15 Antti Koivisto <antti@apple.com> >+ >+ Semantic colors should not be transformed by color-filter >+ https://bugs.webkit.org/show_bug.cgi?id=186566 >+ <rdar://problem/40705739> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * css3/color-filters/color-filter-ignore-semantic-expected.html: Added. >+ * css3/color-filters/color-filter-ignore-semantic.html: Added. >+ > 2018-06-25 Antoine Quint <graouts@apple.com> > > REGRESSION: hardware-accelerated animation fails on inline element >Index: LayoutTests/fast/dom/object-computed-style-event-expected.txt >=================================================================== >--- LayoutTests/fast/dom/object-computed-style-event-expected.txt (nonexistent) >+++ LayoutTests/fast/dom/object-computed-style-event-expected.txt (working copy) >@@ -0,0 +1 @@ >+This test passes if there is no exception. >Index: LayoutTests/fast/dom/object-computed-style-event.html >=================================================================== >--- LayoutTests/fast/dom/object-computed-style-event.html (nonexistent) >+++ LayoutTests/fast/dom/object-computed-style-event.html (working copy) >@@ -0,0 +1,61 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script> >+if (window.testRunner) { >+ testRunner.dumpAsText(); >+ testRunner.waitUntilDone(); >+} >+</script> >+<style> >+.class1 { -webkit-mask-box-image-source: url(#nonexistentURL); } >+</style> >+<script> >+function freememory() { >+ var a; >+ for(var i=0;i<100;i++) { >+ a = new Uint8Array(1024*1024); >+ } >+ document.implementation.createHTMLDocument("doc"); >+} >+ >+function createTestRange() { >+ var testRange = document.createRange(); >+ testRange.setEndAfter(testSelectOption); >+ testRange.deleteContents(); >+} >+ >+function eventhandler1() { >+ var testDataList = document.createElement("datalist"); >+ testSelect.appendChild(testObjectParam); >+ document.title = "foo"; >+ testDataList.addEventListener("DOMNodeInsertedIntoDocument", createTestRange); >+ testObject.appendChild(testDataList); >+ freememory(); >+} >+ >+function eventhandler2() { >+ testObject.setAttribute("onbeforeload", "eventhandler1()"); >+ testSelect.addEventListener("DOMNodeRemovedFromDocument", eventhandler1); >+ testSelect.replaceWith("This test passes if there is no exception."); >+} >+ >+function runTest() { >+ var testSource = document.createElement("source"); >+ testSource.addEventListener("DOMSubtreeModified", eventhandler2); >+ testSource.setAttribute("onsubmit", ""); >+ if (window.testRunner) >+ testRunner.notifyDone(); >+} >+</script> >+</head> >+<body onload=runTest()> >+ <li class="class1">Test List</li> >+ <object id="testObject"> >+ <param id="testObjectParam"></param> >+ </object> >+ <select id="testSelect"> >+ <option id="testSelectOption">Test Option</option> >+ </select> >+</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:
ggaren
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187113
:
343745
|
343749