Bug 526394. Part 29: Create new nsLayoutUtils methods and remove useless code from nsListControlFrame::CaptureMouseEvents. r=mats
This commit is contained in:
Родитель
651e9aee01
Коммит
6f1c81015c
|
@ -89,6 +89,7 @@
|
|||
#include "imgIContainer.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsListControlFrame.h"
|
||||
|
||||
#ifdef MOZ_SVG
|
||||
#include "nsSVGUtils.h"
|
||||
|
@ -3233,6 +3234,38 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
|||
return eTransparencyOpaque;
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsLayoutUtils::IsPopup(nsIFrame* aFrame)
|
||||
{
|
||||
nsIAtom* frameType = aFrame->GetType();
|
||||
|
||||
// We're a popup if we're the list control frame dropdown for a combobox.
|
||||
if (frameType == nsGkAtoms::listControlFrame) {
|
||||
nsListControlFrame* listControlFrame = static_cast<nsListControlFrame*>(aFrame);
|
||||
|
||||
if (listControlFrame) {
|
||||
return listControlFrame->IsInDropDownMode();
|
||||
}
|
||||
}
|
||||
|
||||
// ... or if we're a XUL menupopup frame.
|
||||
return (frameType == nsGkAtoms::menuPopupFrame);
|
||||
}
|
||||
|
||||
/* static */ nsIFrame*
|
||||
nsLayoutUtils::GetDisplayRootFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame* f = aFrame;
|
||||
for (;;) {
|
||||
if (IsPopup(f))
|
||||
return f;
|
||||
nsIFrame* parent = GetCrossDocParentFrame(f);
|
||||
if (!parent)
|
||||
return f;
|
||||
f = parent;
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsNonzeroCoord(const nsStyleCoord& aCoord)
|
||||
{
|
||||
|
|
|
@ -1019,6 +1019,18 @@ public:
|
|||
static nsTransparencyMode GetFrameTransparency(nsIFrame* aBackgroundFrame,
|
||||
nsIFrame* aCSSRootFrame);
|
||||
|
||||
/**
|
||||
* A frame is a popup if it has its own floating window. Menus, panels
|
||||
* and combobox dropdowns are popups.
|
||||
*/
|
||||
static PRBool IsPopup(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Find the nearest "display root". This is the nearest enclosing
|
||||
* popup frame or the root prescontext's root frame.
|
||||
*/
|
||||
static nsIFrame* GetDisplayRootFrame(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Get textrun construction flags determined by a given style; in particular
|
||||
* some combination of:
|
||||
|
|
|
@ -1021,12 +1021,6 @@ nsListControlFrame::CaptureMouseEvents(PRBool aGrabMouseEvents)
|
|||
if (aGrabMouseEvents && IsInDropDownMode() && nsComboboxControlFrame::ToolkitHasNativePopup())
|
||||
return;
|
||||
|
||||
nsIView* view = GetScrolledFrame()->GetView();
|
||||
|
||||
NS_ASSERTION(view, "no view???");
|
||||
if (NS_UNLIKELY(!view))
|
||||
return;
|
||||
|
||||
if (aGrabMouseEvents) {
|
||||
nsIPresShell::SetCapturingContent(mContent, CAPTURE_IGNOREALLOWED);
|
||||
} else {
|
||||
|
|
|
@ -1422,7 +1422,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
|||
nsPlaceholderFrame* placeholder = static_cast<nsPlaceholderFrame*>(aChild);
|
||||
aChild = placeholder->GetOutOfFlowFrame();
|
||||
NS_ASSERTION(aChild, "No out of flow frame?");
|
||||
if (!aChild || aChild->GetType() == nsGkAtoms::menuPopupFrame)
|
||||
if (!aChild || nsLayoutUtils::IsPopup(aChild))
|
||||
return NS_OK;
|
||||
// update for the new child
|
||||
disp = aChild->GetStyleDisplay();
|
||||
|
|
Загрузка…
Ссылка в новой задаче