mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 815671 part 7. Fixes to layout code to not copy arrays implicitly. r=roc
This commit is contained in:
parent
909f6d9ba2
commit
9a2a0bca08
@ -1296,26 +1296,23 @@ nsFlexContainerFrame::ResolveFlexibleLengths(
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
const nsTArray<SortableFrame>
|
||||
BuildSortedChildArray(const nsFrameList& aChildren)
|
||||
void
|
||||
BuildSortedChildArray(const nsFrameList& aChildren,
|
||||
nsTArray<SortableFrame>& aSortedChildren)
|
||||
{
|
||||
// NOTE: To benefit from Return Value Optimization, we must only return
|
||||
// this value:
|
||||
nsTArray<SortableFrame> sortedChildArray(aChildren.GetLength());
|
||||
aSortedChildren.SetCapacity(aChildren.GetLength());
|
||||
|
||||
// Throw all our children in the array...
|
||||
uint32_t indexInFrameList = 0;
|
||||
for (nsFrameList::Enumerator e(aChildren); !e.AtEnd(); e.Next()) {
|
||||
int32_t orderValue = e.get()->GetStylePosition()->mOrder;
|
||||
sortedChildArray.AppendElement(SortableFrame(e.get(), orderValue,
|
||||
indexInFrameList));
|
||||
aSortedChildren.AppendElement(SortableFrame(e.get(), orderValue,
|
||||
indexInFrameList));
|
||||
indexInFrameList++;
|
||||
}
|
||||
|
||||
// ... and sort (by 'order' property)
|
||||
sortedChildArray.Sort();
|
||||
|
||||
return sortedChildArray;
|
||||
aSortedChildren.Sort();
|
||||
}
|
||||
|
||||
MainAxisPositionTracker::
|
||||
@ -1787,7 +1784,8 @@ nsFlexContainerFrame::GenerateFlexItems(
|
||||
MOZ_ASSERT(aFlexItems.IsEmpty(), "Expecting outparam to start out empty");
|
||||
|
||||
// Sort by 'order' property:
|
||||
const nsTArray<SortableFrame> sortedChildren = BuildSortedChildArray(mFrames);
|
||||
nsTArray<SortableFrame> sortedChildren;
|
||||
BuildSortedChildArray(mFrames, sortedChildren);
|
||||
|
||||
// Build list of unresolved flex items:
|
||||
|
||||
|
@ -881,7 +881,7 @@ RenderFrameParent::TriggerRepaint()
|
||||
ShadowLayersParent*
|
||||
RenderFrameParent::GetShadowLayers() const
|
||||
{
|
||||
const nsTArray<PLayersParent*>& shadowParents = ManagedPLayersParent();
|
||||
const InfallibleTArray<PLayersParent*>& shadowParents = ManagedPLayersParent();
|
||||
NS_ABORT_IF_FALSE(shadowParents.Length() <= 1,
|
||||
"can only support at most 1 ShadowLayersParent");
|
||||
return (shadowParents.Length() == 1) ?
|
||||
|
@ -354,7 +354,7 @@ class nsCSSKeyframeRule MOZ_FINAL : public mozilla::css::Rule,
|
||||
{
|
||||
public:
|
||||
// WARNING: Steals the contents of aKeys *and* aDeclaration
|
||||
nsCSSKeyframeRule(nsTArray<float> aKeys,
|
||||
nsCSSKeyframeRule(InfallibleTArray<float>& aKeys,
|
||||
nsAutoPtr<mozilla::css::Declaration> aDeclaration)
|
||||
: mDeclaration(aDeclaration)
|
||||
{
|
||||
@ -392,7 +392,7 @@ public:
|
||||
void DoGetKeyText(nsAString &aKeyText) const;
|
||||
|
||||
private:
|
||||
nsAutoTArray<float, 1> mKeys;
|
||||
nsTArray<float> mKeys;
|
||||
nsAutoPtr<mozilla::css::Declaration> mDeclaration;
|
||||
// lazily created when needed:
|
||||
nsRefPtr<nsCSSKeyframeStyleDeclaration> mDOMDeclaration;
|
||||
|
Loading…
Reference in New Issue
Block a user