W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2020

Re: [csswg-drafts] [cssom-view] scrollingElement quirksmode description looks wrong... a typo I think? (#5326)

From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
Date: Sat, 25 Jul 2020 13:32:52 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-663856077-1595683971-sysbot+gh@w3.org>
Firefox implements what the spec says https://searchfox.org/mozilla-central/rev/828f2319c0195d7f561ed35533aef6fe183e68e3/dom/base/Document.cpp#12534-12546

```cpp
Element* Document::GetScrollingElement() {
  // Keep this in sync with IsScrollingElement.
  if (GetCompatibilityMode() == eCompatibility_NavQuirks) {
    RefPtr<HTMLBodyElement> body = GetBodyElement();
    if (body && !IsPotentiallyScrollable(body)) {
      return body;
    }
    return nullptr;
  }
  return GetRootElement();
}
```

And Chromium does something similar (but doesn't check the `overflow` of the root element): https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/dom/document.cc;drc=d2d9d94b1b8a0174ff40bf5475a4bcd15d5f9484;l=1693-1710

```cpp
Element* Document::ScrollingElementNoLayout() {
  if (RuntimeEnabledFeatures::ScrollTopLeftInteropEnabled()) {
    if (InQuirksMode()) {
      DCHECK(!IsActive() ||
             lifecycle_.GetState() >= DocumentLifecycle::kStyleClean);
      HTMLBodyElement* body = FirstBodyElement();
      if (body && body->GetLayoutObject() &&
          body->GetLayoutObject()->HasOverflowClip())
        return nullptr;
      return body;
    }
    return documentElement();
  }
  return body();
}
```

Note `ScrollTopLeftInterop` is enabled by default, and `HasOverflowClip()` checks if `overflow` is not `visible`.

-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5326#issuecomment-663856077 using your GitHub account
Received on Saturday, 25 July 2020 13:32:54 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:11 UTC