Layout has been using imgIContainer::IsOpaque to determine if the image will draw opaquely to all pixels it covers, and doing culling based on this.
However imgIContainer::IsOpaque doesn't guarantee anything. It only describes if the image, when in a decoded state, has all opaque pixels. So if the image doesn't have fully decoded frames around (because they got discarded) it may not draw opaquely to all of its pixels.
So we create a new function that first checks if there is a fully decoded frame.
Compilers would complain about using user-defined type as return type
of extern "C" functions. A struct is considered a user-defined type if
there is any non-trivial constructor.
Having a type without non-trivial constructor for borrowed type would
be very inconvenient. Actually the currently borrowed type doesn't seem
to provide any additional safety / benefit over a plain pointer.
MozReview-Commit-ID: ncxmCEWCkv
--HG--
extra : rebase_source : 43a95bbcb05759f27837629daec6ce915a68b062
extra : source : 2a544c24bfb6a3412e59acbee89a5a393c31d5b6
It will be called in the next flush, so no need to do it eagerly.
MozReview-Commit-ID: 1B8pzn0dqBO
--HG--
extra : rebase_source : 79a4203d13a2b9d48cd9c9d6fa5c5e08974d4765
extra : source : 162b17483adb18d3d05d866853fb8f841dee846d
I'm not convinced that we can actually get regular content
<_moz_generated_content_before> elements in here, since it's only if
CompareTreePosition returned 0 that we look at the element name,
but might be best to make this test stronger in any case.
MozReview-Commit-ID: 8CgxcU9AbDA
--HG--
extra : rebase_source : 4a47ed62895d83f720ec7ccfde253e2c1945b34f
This patch makes GetBounds(), GetScreenBounds() and GetClientBounds() more
obviously infallible, like existing functions such as GetNaturalBounds() and
GetClientSize(). This results in clearer behaviour in nsCocoaWindow.mm if
Objective C exceptions occur. Along the way, the patch removes some useless
failure checks for these functions.
The patch also removes the NS_IMETHOD from GetRestoredBounds and makes that
function MOZ_MUST_USE.
The standard placement new function is declared to not throw, which
means that, per spec, a null check on its result is required. There are
a number of places throughout layout/ where we know that we are passing
non-null pointers to placement new (and receiving them as a return
value), and we are therefore doing useless work performing these null
checks.
Therefore, we should be using an operator new overload that doesn't
require the null check. MFBT has just such an overload, so use that.
nsDisplayListBuilder::Allocate is infallible. Therefore,
nsDisplayListItem::operator new, which calls Allocate to obtain memory,
does not need to declare itself as throwing. And so on for functions
that call nsDisplayListBuilder::Allocate.
operator new overloads that declare that they don't throw exceptions
require a null check on their return value, per the C++ spec. We know
that Servo isn't going to call these functions with null pointers, so
remove the CPP_THROW_NEW annotation and save ourselves some work.
Structs in our style system use an arena-style allocation system,
managed by the presshell to which they belong. All of the relevant
overloads that forward allocation requests to the presshell declare
themselves as CPP_THROW_NEW, which indicates that they do not throw
exceptions. The C++ specification states that operator new overloads
that declare themselves to not throw exceptions require a null check on
their return value. However, the relevant presshell allocation method,
AllocateByObjectID, is infallible and will never return a null pointer.
The callers of all of these methods are therefore doing useless
(compiler-generated) null checks. Let's get rid of those useless checks
by removing the CPP_THROW_NEW annotations. This change declares these
methods will return non-null pointers and throw exceptions in case of
errors--but as we don't use exceptions, and AllocateByObjectID will
abort on OOM, everything works out OK.
This allows to copy the `content` property value from one nsStyleContent to
another, in order to implement content: inherit.
MozReview-Commit-ID: 75mQpGRKKba
Eventually, we might want to use the same mechanism that Gecko uses directly,
and stop styling text nodes from Servo.
This would have the benefit of removing the "stash the change on the parent"
thing.
MozReview-Commit-ID: IOxNR05jkh