Re: Include out of viewport frames in display list

Boris Zbarsky <[email protected]> Thu, 21 Jul 2016 10:49:16 -0400
Newsgroups gmane.comp.mozilla.devel.layout
Message-ID <[email protected]>
On 7/21/16 10:12 AM, [email protected] wrote:
>  0:15.57 /source/release/dom/base/nsDocument.cpp:3585:24: error: 'AppendElement' is a protected member of 'nsTArray_Impl<mozilla::OwningNonNull<nsINode>, nsTArrayFallibleAllocator>'
>  0:15.57         aResult.mNodes.AppendElement(node);

Right.  With the fallible allocator (which is what Sequence uses), the 
one-arg signature of AppendElement is protected.  The two-arg signature 
that takes a const fallible_t& second arg and returns a boolean 
indicating whether the append succeeded.

>  0:15.57 /source/release/dom/base/nsDocument.cpp:3586:25: error: 'EnsureLengthAtLeast' is a protected member of 'nsTArray_Impl<mozilla::dom::Sequence<mozilla::dom::myFunctionElementInfo>, nsTArrayFallibleAllocator>'

Same thing: you have to use the fallible version and handle failure.

>  0:16.49 /build/dist/include/nsTArray.h:527:34: error: no matching constructor for initialization of 'mozilla::OwningNonNull<nsINode>'
>  0:16.50     new (static_cast<void*>(aE)) E(mozilla::Forward<A>(aArg));
>  0:16.50                                  ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
>  0:16.50 /build/dist/include/nsTArray.h:1596:18: note: in instantiation of function template specialization 'nsTArrayElementTraits<mozilla::OwningNonNull<nsINode> >::Construct<nsIContent *&>' requested here

OwningNonNull can't be constructed from a pointer, because the 
assumption is that it should never store null and pointers can be null. 
It can be constructed from a reference, though.

>  0:16.50 /source/release/dom/base/nsDocument.cpp:3585:24: note: in instantiation of function template specialization 'nsTArray_Impl<mozilla::OwningNonNull<nsINode>, nsTArrayFallibleAllocator>::AppendElement<nsIContent *&, nsTArrayFallibleAllocator>' requested here
>  0:16.50         aResult.mNodes.AppendElement(node);

So this should be:

   aResult.mNodes.AppendElement(*node);

assuming node is not null, of course.

>  0:16.50 /build/dist/include/mozilla/OwningNonNull.h:23:16: note: candidate constructor not viable: no known conversion from 'nsIContent *' to 'nsINode &' for 1st argument; dereference the argument with *

Which is what this helpful error message said, pretty explicitly.  ;)

-Boris