author | Boris Chiou <boris.chiou@gmail.com> |
Tue, 21 May 2019 18:17:16 +0000 | |
changeset 474865 | b9ce11f1880ab7650c4ed80b097a6a440a9d5453 |
parent 474864 | 601eed526befc2ec213dc56ca63b896a84411b4e |
child 474866 | aa35720a213212373e03effdd8f7c406a3dcb0c9 |
push id | 86028 |
push user | bchiou@mozilla.com |
push date | Tue, 21 May 2019 21:29:30 +0000 |
treeherder | autoland@aa35720a2132 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | dholbert, smaug |
bugs | 1552911 |
milestone | 69.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/ResizeObserver.cpp +++ b/dom/base/ResizeObserver.cpp @@ -1,16 +1,17 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/dom/ResizeObserver.h" +#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/Document.h" #include "nsIContent.h" #include "nsSVGUtils.h" #include <limits> namespace mozilla { namespace dom { @@ -266,38 +267,31 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Re mContentBoxSize) NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObserverEntry) NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObserverEntry) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserverEntry) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -already_AddRefed<ResizeObserverEntry> ResizeObserverEntry::Constructor( - const GlobalObject& aGlobal, Element& aTarget, ErrorResult& aRv) { - RefPtr<ResizeObserverEntry> observerEntry = - new ResizeObserverEntry(aGlobal.GetAsSupports(), aTarget); - return observerEntry.forget(); -} - void ResizeObserverEntry::SetBorderBoxSize(const nsSize& aSize) { nsIFrame* frame = mTarget->GetPrimaryFrame(); const WritingMode wm = frame ? frame->GetWritingMode() : WritingMode(); mBorderBoxSize = new ResizeObserverSize(this, aSize, wm); } void ResizeObserverEntry::SetContentRectAndSize(const nsSize& aSize) { nsIFrame* frame = mTarget->GetPrimaryFrame(); // 1. Update mContentRect. nsMargin padding = frame ? frame->GetUsedPadding(): nsMargin(); // Per the spec, we need to use the top-left padding offset as the origin of // our contentRect. nsRect rect(nsPoint(padding.left, padding.top), aSize); - RefPtr<DOMRect> contentRect = new DOMRect(mTarget); + RefPtr<DOMRect> contentRect = new DOMRect(this); contentRect->SetLayoutRect(rect); mContentRect = contentRect.forget(); // 2. Update mContentBoxSize. const WritingMode wm = frame ? frame->GetWritingMode() : WritingMode(); mContentBoxSize = new ResizeObserverSize(this, aSize, wm); }
--- a/dom/base/ResizeObserver.h +++ b/dom/base/ResizeObserver.h @@ -183,19 +183,16 @@ class ResizeObserverEntry final : public nsISupports* GetParentObject() const { return mOwner; } JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override { return ResizeObserverEntry_Binding::Wrap(aCx, this, aGivenProto); } - static already_AddRefed<ResizeObserverEntry> Constructor( - const GlobalObject& global, Element& target, ErrorResult& aRv); - Element* Target() const { return mTarget; } /** * Returns the DOMRectReadOnly of target's content rect so it can be * accessed from JavaScript in callback function of ResizeObserver. */ DOMRectReadOnly* ContentRect() const { return mContentRect; }
--- a/dom/webidl/ResizeObserver.webidl +++ b/dom/webidl/ResizeObserver.webidl @@ -24,18 +24,17 @@ interface ResizeObserver { void observe(Element target, optional ResizeObserverOptions options); [Throws] void unobserve(Element target); void disconnect(); }; callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, ResizeObserver observer); -[Constructor(Element target), - Pref="layout.css.resizeobserver.enabled"] +[Pref="layout.css.resizeobserver.enabled"] interface ResizeObserverEntry { readonly attribute Element target; readonly attribute DOMRectReadOnly contentRect; readonly attribute ResizeObserverSize borderBoxSize; readonly attribute ResizeObserverSize contentBoxSize; }; [Pref="layout.css.resizeobserver.enabled"]
new file mode 100644 --- /dev/null +++ b/layout/style/crashtests/1552911.html @@ -0,0 +1,15 @@ +<html> +<head> + <script> + function start() { + const o1 = + document.createElementNS('http://www.w3.org/1999/xhtml', 'slot'); + const observer = new ResizeObserverEntry(o1); + typeof observer.borderBoxSize; + typeof observer.contentBoxSize; + } + + window.addEventListener('load', start); + </script> +</head> +</html>
--- a/layout/style/crashtests/crashtests.list +++ b/layout/style/crashtests/crashtests.list @@ -301,8 +301,9 @@ load 1502893.html load 1509989.html load 1514086.html pref(layout.css.moz-binding.content.enabled,false) load 1517319.html load 1533783.html load 1533891.html pref(gfx.omta.background-color,true) load 1533968.html load 1541126.html load 1545177.html +pref(layout.css.resizeobserver.enabled,true) load 1552911.html
--- a/testing/web-platform/meta/resize-observer/idlharness.window.js.ini +++ b/testing/web-platform/meta/resize-observer/idlharness.window.js.ini @@ -41,8 +41,12 @@ [ResizeObservation interface: attribute lastReportedSize] expected: FAIL bug: https://github.com/w3c/csswg-drafts/issues/3839 [ResizeObservation interface: attribute observedBox] expected: FAIL bug: https://github.com/w3c/csswg-drafts/issues/3839 + + [ResizeObserverEntry interface object length] + expected: FAIL + bug: https://github.com/w3c/csswg-drafts/issues/3946