Commit 96e3c90e authored by donal meehan's avatar donal meehan
Browse files

Backed out changeset c830e54eaf58 (bug 1834081) for causing bug 1838045

parent 40fe87e6
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@
#include "mozilla/ServoUtils.h"
#include "mozilla/css/StreamLoader.h"
#include "mozilla/SharedStyleSheetCache.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/StaticPrefs_dom.h"
#include "ReferrerInfo.h"

@@ -1756,9 +1755,7 @@ Result<Loader::LoadSheetResult, nsresult> Loader::LoadInlineStyle(

  // We only cache sheets if in shadow trees, since regular document sheets are
  // likely to be unique.
  const bool isWorthCaching =
      StaticPrefs::layout_css_inline_style_caching_always_enabled() ||
      aInfo.mContent->IsInShadowTree();
  const bool isWorthCaching = aInfo.mContent->IsInShadowTree();
  RefPtr<StyleSheet> sheet;
  if (isWorthCaching) {
    sheet = LookupInlineSheetInCache(aBuffer);
@@ -1801,11 +1798,6 @@ Result<Loader::LoadSheetResult, nsresult> Loader::LoadInlineStyle(
  if (sheetFromCache) {
    MOZ_ASSERT(sheet->IsComplete());
    completed = Completed::Yes;
    if (dom::Document* doc = GetDocument()) {
      // We post these events for devtools, even though the applicable state has
      // not actually changed, to make the cache not observable.
      doc->PostStyleSheetApplicableStateChangeEvent(*sheet);
    }
  } else {
    auto data = MakeRefPtr<SheetLoadData>(
        this, aInfo.mTitle, nullptr, sheet, false, aInfo.mContent, isAlternate,
@@ -1822,9 +1814,8 @@ Result<Loader::LoadSheetResult, nsresult> Loader::LoadInlineStyle(
    NS_ConvertUTF16toUTF8 utf8(aBuffer);
    completed = ParseSheet(utf8, *data, AllowAsyncParse::No);
    if (completed == Completed::Yes) {
      // TODO(emilio): Try to cache sheets with @import rules, maybe? Should be
      // a matter of scheduling the load event appropriately...
      if (isWorthCaching && sheet->ChildSheets().IsEmpty()) {
      // TODO(emilio): Try to cache sheets with @import rules, maybe?
      if (isWorthCaching) {
        mInlineSheets.InsertOrUpdate(aBuffer, std::move(sheet));
      }
    } else {
+0 −6
Original line number Diff line number Diff line
@@ -8344,12 +8344,6 @@
  value: true
  mirror: always

# Whether we cache inline styles in a document unconditionally or not.
- name: layout.css.inline-style-caching.always-enabled
  type: bool
  value: true
  mirror: always

# Whether we should return an empty style on invalid pseudo-elements starting
# with a colon.
#