gecko/layout/base/DisplayListClipState.cpp
Robert O'Callahan 2a890de2cb Bug 841192. Part 4: Create DisplayListClipState. r=mattwoodrow
--HG--
extra : rebase_source : 90eb025d01cec4d3e52473ebc27ae411f42c0439
2013-03-04 22:56:00 +13:00

36 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* 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 "DisplayListClipState.h"
#include "nsDisplayList.h"
namespace mozilla {
const DisplayItemClip*
DisplayListClipState::GetCurrentCombinedClip(nsDisplayListBuilder* aBuilder)
{
if (mCurrentCombinedClip) {
return mCurrentCombinedClip;
}
if (!mClipContentDescendants && !mClipContainingBlockDescendants) {
return nullptr;
}
void* mem = aBuilder->Allocate(sizeof(DisplayItemClip));
if (mClipContentDescendants) {
mCurrentCombinedClip =
new (mem) DisplayItemClip(*mClipContentDescendants);
if (mClipContainingBlockDescendants) {
mCurrentCombinedClip->IntersectWith(*mClipContainingBlockDescendants);
}
} else {
mCurrentCombinedClip =
new (mem) DisplayItemClip(*mClipContainingBlockDescendants);
}
return mCurrentCombinedClip;
}
}