mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 333659. Relanding new nsLayoutUtils APIs --- shouldn't affect current code. r=dbaron
This commit is contained in:
parent
e6589f0930
commit
f526665413
@ -58,6 +58,7 @@
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsRegion.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsBlockFrame.h"
|
||||
|
||||
#ifdef MOZ_SVG_FOREIGNOBJECT
|
||||
#include "nsSVGForeignObjectFrame.h"
|
||||
@ -998,6 +999,37 @@ nsLayoutUtils::GetFontMetricsForFrame(nsIFrame* aFrame,
|
||||
*aFontMetrics);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsLayoutUtils::FindChildContainingDescendant(nsIFrame* aParent, nsIFrame* aDescendantFrame)
|
||||
{
|
||||
nsIFrame* result = aDescendantFrame;
|
||||
|
||||
while (result) {
|
||||
nsIFrame* parent = result->GetParent();
|
||||
if (parent == aParent) {
|
||||
break;
|
||||
}
|
||||
|
||||
// The frame is not an immediate child of aParent so walk up another level
|
||||
result = parent;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
nsBlockFrame*
|
||||
nsLayoutUtils::FindNearestBlockAncestor(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* nextAncestor;
|
||||
for (nextAncestor = aFrame->GetParent(); nextAncestor;
|
||||
nextAncestor = nextAncestor->GetParent()) {
|
||||
nsBlockFrame* block;
|
||||
if (NS_SUCCEEDED(nextAncestor->QueryInterface(kBlockFrameCID, (void**)&block)))
|
||||
return block;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsLayoutUtils::GetParentOrPlaceholderFor(nsFrameManager* aFrameManager,
|
||||
nsIFrame* aFrame)
|
||||
|
@ -56,6 +56,8 @@ class nsIFontMetrics;
|
||||
#include "nsStyleSet.h"
|
||||
#include "nsIView.h"
|
||||
|
||||
class nsBlockFrame;
|
||||
|
||||
/**
|
||||
* nsLayoutUtils is a namespace class used for various helper
|
||||
* functions that are useful in multiple places in layout. The goal
|
||||
@ -432,6 +434,18 @@ public:
|
||||
static nsresult GetFontMetricsForFrame(nsIFrame* aFrame,
|
||||
nsIFontMetrics** aFontMetrics);
|
||||
|
||||
/**
|
||||
* Find the immediate child of aParent whose frame subtree contains
|
||||
* aDescendantFrame. Returns null if aDescendantFrame is not a descendant
|
||||
* of aParent.
|
||||
*/
|
||||
static nsIFrame* FindChildContainingDescendant(nsIFrame* aParent, nsIFrame* aDescendantFrame);
|
||||
|
||||
/**
|
||||
* Find the nearest ancestor that's a block
|
||||
*/
|
||||
static nsBlockFrame* FindNearestBlockAncestor(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* If aFrame is an out of flow frame, return its placeholder, otherwise
|
||||
* return its parent.
|
||||
|
Loading…
Reference in New Issue
Block a user