зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1720804 - Part 1: Move majority of the display list code inside mozilla namespace r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D120041
This commit is contained in:
Родитель
94913a95b1
Коммит
76c9644105
|
@ -27,11 +27,11 @@
|
|||
} \
|
||||
}
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class nsIDocShell;
|
||||
class nsRefreshDriver;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayListBuilder;
|
||||
class ClientWebGLContext;
|
||||
class PresShell;
|
||||
namespace layers {
|
||||
|
@ -143,14 +143,15 @@ class nsICanvasRenderingContextInternal : public nsISupports,
|
|||
|
||||
// Return the CanvasLayer for this context, creating
|
||||
// one for the given layer manager if not available.
|
||||
virtual already_AddRefed<Layer> GetCanvasLayer(nsDisplayListBuilder* builder,
|
||||
Layer* oldLayer,
|
||||
LayerManager* manager) = 0;
|
||||
virtual bool UpdateWebRenderCanvasData(nsDisplayListBuilder* aBuilder,
|
||||
WebRenderCanvasData* aCanvasData) {
|
||||
virtual already_AddRefed<Layer> GetCanvasLayer(
|
||||
mozilla::nsDisplayListBuilder* builder, Layer* oldLayer,
|
||||
LayerManager* manager) = 0;
|
||||
virtual bool UpdateWebRenderCanvasData(
|
||||
mozilla::nsDisplayListBuilder* aBuilder,
|
||||
WebRenderCanvasData* aCanvasData) {
|
||||
return false;
|
||||
}
|
||||
virtual bool InitializeCanvasRenderer(nsDisplayListBuilder* aBuilder,
|
||||
virtual bool InitializeCanvasRenderer(mozilla::nsDisplayListBuilder* aBuilder,
|
||||
CanvasRenderer* aRenderer) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
# include "mozilla/gfx/Rect.h"
|
||||
# include "mozilla/layers/LayersTypes.h"
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class nsICanvasRenderingContextInternal;
|
||||
class nsIInputStream;
|
||||
class nsITimerCallback;
|
||||
|
@ -27,6 +26,7 @@ enum class gfxAlphaType;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class ClientWebGLContext;
|
||||
|
||||
namespace layers {
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
struct RawServoAnimationValue;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayItem;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
class EffectSet;
|
||||
struct AnimationProperty;
|
||||
|
||||
|
|
|
@ -8,8 +8,13 @@
|
|||
#include "mozilla/gfx/Polygon.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayTransform;
|
||||
|
||||
namespace layers {
|
||||
|
||||
class Layer;
|
||||
|
||||
template <typename T>
|
||||
void BSPTree<T>::BuildDrawOrder(BSPTreeNode<T>* aNode,
|
||||
nsTArray<BSPPolygon<T>>& aLayers) const {
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
#include "mozilla/gfx/Polygon.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsDisplayTransform;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
|
||||
class nsDisplayItem;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItem;
|
||||
struct ActiveScrolledRoot;
|
||||
struct DisplayItemClipChain;
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsPaintedDisplayItem;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace wr {
|
||||
class DisplayListBuilder;
|
||||
} // namespace wr
|
||||
|
|
|
@ -11,13 +11,12 @@
|
|||
#include "mozilla/layers/ScrollableLayerGuid.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsPaintedDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace wr {
|
||||
class DisplayListBuilder;
|
||||
}
|
||||
|
|
|
@ -13,10 +13,9 @@
|
|||
#include "mozilla/webrender/WebRenderTypes.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsDisplayTransform;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayTransform;
|
||||
struct ActiveScrolledRoot;
|
||||
|
||||
namespace layers {
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
#include "nsTHashSet.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsIWidget;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
struct ActiveScrolledRoot;
|
||||
|
||||
namespace layers {
|
||||
|
|
|
@ -24,11 +24,10 @@
|
|||
#include "mozilla/Maybe.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayItem;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
struct ActiveScrolledRoot;
|
||||
|
||||
namespace layers {
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
#include "ImageTypes.h"
|
||||
#include "DisplayItemClip.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItemGeometry;
|
||||
|
||||
namespace mozilla {
|
||||
namespace webgpu {
|
||||
class WebGPUChild;
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ class SourceSurface;
|
|||
}
|
||||
|
||||
namespace layers {
|
||||
|
||||
class BasicLayerManager;
|
||||
class CanvasLayer;
|
||||
class ImageClient;
|
||||
|
|
|
@ -28,14 +28,15 @@
|
|||
#include "Units.h"
|
||||
|
||||
class gfxContext;
|
||||
class nsDisplayItem;
|
||||
class nsPaintedDisplayItem;
|
||||
class nsDisplayTransform;
|
||||
|
||||
#undef None
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsPaintedDisplayItem;
|
||||
class nsDisplayTransform;
|
||||
|
||||
struct ActiveScrolledRoot;
|
||||
|
||||
namespace widget {
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsDisplayListBuilder;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class PresShell;
|
||||
|
||||
// For GetDisplayPort
|
||||
|
|
|
@ -59,8 +59,6 @@ class nsAutoCauseReflowNotifier;
|
|||
class nsCanvasFrame;
|
||||
class nsCaret;
|
||||
class nsCSSFrameConstructor;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDocShell;
|
||||
class nsFrameSelection;
|
||||
class nsIDocShell;
|
||||
|
@ -89,6 +87,9 @@ class ZoomConstraintsClient;
|
|||
struct nsCallbackEventRequest;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
class AccessibleCaretEventHub;
|
||||
class EventStates;
|
||||
class GeckoMVMContext;
|
||||
|
@ -1697,7 +1698,6 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
void SetIsActive(bool aIsActive);
|
||||
bool ShouldBeActive() const;
|
||||
|
||||
|
||||
/**
|
||||
* Refresh observer management.
|
||||
*/
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
class nsFrameSelection;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
|
|
|
@ -50,11 +50,7 @@ class nsIWidget;
|
|||
class nsAtom;
|
||||
class nsIScrollableFrame;
|
||||
class nsRegion;
|
||||
class nsDisplayListBuilder;
|
||||
enum class nsDisplayListBuilderMode : uint8_t;
|
||||
enum nsChangeHint : uint32_t;
|
||||
class nsDisplayItem;
|
||||
class nsDisplayList;
|
||||
class nsFontMetrics;
|
||||
class nsFontFaceList;
|
||||
class nsIImageLoadingContent;
|
||||
|
@ -67,6 +63,10 @@ class imgIRequest;
|
|||
struct nsStyleFont;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayItem;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
enum class nsDisplayListBuilderMode : uint8_t;
|
||||
struct AspectRatio;
|
||||
class ComputedStyle;
|
||||
class DisplayPortUtils;
|
||||
|
@ -167,6 +167,11 @@ class nsLayoutUtils {
|
|||
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
||||
typedef mozilla::image::ImgDrawResult ImgDrawResult;
|
||||
|
||||
using nsDisplayItem = mozilla::nsDisplayItem;
|
||||
using nsDisplayList = mozilla::nsDisplayList;
|
||||
using nsDisplayListBuilder = mozilla::nsDisplayListBuilder;
|
||||
using nsDisplayListBuilderMode = mozilla::nsDisplayListBuilderMode;
|
||||
|
||||
public:
|
||||
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
||||
typedef mozilla::layers::ScrollMetadata ScrollMetadata;
|
||||
|
|
|
@ -58,8 +58,6 @@ class gfxUserFontSet;
|
|||
class gfxTextPerfMetrics;
|
||||
class nsCSSFontFeatureValuesRule;
|
||||
class nsCSSFrameConstructor;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsTransitionManager;
|
||||
class nsAnimationManager;
|
||||
class nsRefreshDriver;
|
||||
|
|
|
@ -30,6 +30,12 @@ using namespace mozilla;
|
|||
using namespace mozilla::image;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayButtonBoxShadowOuter;
|
||||
class nsDisplayButtonBorder;
|
||||
class nsDisplayButtonForeground;
|
||||
} // namespace mozilla
|
||||
|
||||
nsButtonFrameRenderer::nsButtonFrameRenderer() : mFrame(nullptr) {
|
||||
MOZ_COUNT_CTOR(nsButtonFrameRenderer);
|
||||
}
|
||||
|
@ -58,6 +64,165 @@ bool nsButtonFrameRenderer::isDisabled() {
|
|||
return mFrame->GetContent()->AsElement()->IsDisabled();
|
||||
}
|
||||
|
||||
nsresult nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayList* aBackground,
|
||||
nsDisplayList* aForeground) {
|
||||
if (!mFrame->StyleEffects()->mBoxShadow.IsEmpty()) {
|
||||
aBackground->AppendNewToTop<nsDisplayButtonBoxShadowOuter>(aBuilder,
|
||||
GetFrame());
|
||||
}
|
||||
|
||||
nsRect buttonRect =
|
||||
mFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(mFrame);
|
||||
|
||||
const AppendedBackgroundType result =
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, mFrame, buttonRect, aBackground);
|
||||
if (result == AppendedBackgroundType::None) {
|
||||
aBuilder->BuildCompositorHitTestInfoIfNeeded(GetFrame(), aBackground);
|
||||
}
|
||||
|
||||
aBackground->AppendNewToTop<nsDisplayButtonBorder>(aBuilder, GetFrame(),
|
||||
this);
|
||||
|
||||
// Only display focus rings if we actually have them. Since at most one
|
||||
// button would normally display a focus ring, most buttons won't have them.
|
||||
const auto* disp = mFrame->StyleDisplay();
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
if (mInnerFocusStyle && mInnerFocusStyle->StyleBorder()->HasBorder() &&
|
||||
mFrame->IsThemed(disp) &&
|
||||
pc->Theme()->ThemeWantsButtonInnerFocusRing(
|
||||
disp->EffectiveAppearance())) {
|
||||
aForeground->AppendNewToTop<nsDisplayButtonForeground>(aBuilder, GetFrame(),
|
||||
this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect,
|
||||
nsRect& aResult) {
|
||||
aResult = aRect;
|
||||
aResult.Deflate(mFrame->GetUsedBorderAndPadding());
|
||||
|
||||
if (mInnerFocusStyle) {
|
||||
nsMargin innerFocusPadding(0, 0, 0, 0);
|
||||
mInnerFocusStyle->StylePadding()->GetPadding(innerFocusPadding);
|
||||
|
||||
nsMargin framePadding = mFrame->GetUsedPadding();
|
||||
|
||||
innerFocusPadding.top = std::min(innerFocusPadding.top, framePadding.top);
|
||||
innerFocusPadding.right =
|
||||
std::min(innerFocusPadding.right, framePadding.right);
|
||||
innerFocusPadding.bottom =
|
||||
std::min(innerFocusPadding.bottom, framePadding.bottom);
|
||||
innerFocusPadding.left =
|
||||
std::min(innerFocusPadding.left, framePadding.left);
|
||||
|
||||
aResult.Inflate(innerFocusPadding);
|
||||
}
|
||||
}
|
||||
|
||||
ImgDrawResult nsButtonFrameRenderer::PaintInnerFocusBorder(
|
||||
nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext, const nsRect& aDirtyRect,
|
||||
const nsRect& aRect) {
|
||||
// we draw the -moz-focus-inner border just inside the button's
|
||||
// normal border and padding, to match Windows themes.
|
||||
|
||||
nsRect rect;
|
||||
|
||||
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SyncDecodeImages
|
||||
: PaintBorderFlags();
|
||||
|
||||
ImgDrawResult result = ImgDrawResult::SUCCESS;
|
||||
|
||||
if (mInnerFocusStyle) {
|
||||
GetButtonInnerFocusRect(aRect, rect);
|
||||
|
||||
result &=
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, mInnerFocusStyle, flags);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Maybe<nsCSSBorderRenderer>
|
||||
nsButtonFrameRenderer::CreateInnerFocusBorderRenderer(
|
||||
nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext,
|
||||
gfxContext* aRenderingContext, const nsRect& aDirtyRect,
|
||||
const nsRect& aRect, bool* aBorderIsEmpty) {
|
||||
if (mInnerFocusStyle) {
|
||||
nsRect rect;
|
||||
GetButtonInnerFocusRect(aRect, rect);
|
||||
|
||||
gfx::DrawTarget* dt =
|
||||
aRenderingContext ? aRenderingContext->GetDrawTarget() : nullptr;
|
||||
return nsCSSRendering::CreateBorderRenderer(
|
||||
aPresContext, dt, mFrame, aDirtyRect, rect, mInnerFocusStyle,
|
||||
aBorderIsEmpty);
|
||||
}
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
ImgDrawResult nsButtonFrameRenderer::PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect) {
|
||||
// get the button rect this is inside the focus and outline rects
|
||||
nsRect buttonRect = aRect;
|
||||
ComputedStyle* context = mFrame->Style();
|
||||
|
||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SyncDecodeImages
|
||||
: PaintBorderFlags();
|
||||
|
||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext, mFrame,
|
||||
buttonRect);
|
||||
|
||||
ImgDrawResult result =
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, context, borderFlags);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this when styles change
|
||||
*/
|
||||
void nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext) {
|
||||
// get all the styles
|
||||
ServoStyleSet* styleSet = aPresContext->StyleSet();
|
||||
|
||||
// get styles assigned to -moz-focus-inner (ie dotted border on Windows)
|
||||
mInnerFocusStyle = styleSet->ProbePseudoElementStyle(
|
||||
*mFrame->GetContent()->AsElement(), PseudoStyleType::mozFocusInner,
|
||||
mFrame->Style());
|
||||
}
|
||||
|
||||
ComputedStyle* nsButtonFrameRenderer::GetComputedStyle(int32_t aIndex) const {
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
return mInnerFocusStyle;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void nsButtonFrameRenderer::SetComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle) {
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
mInnerFocusStyle = aComputedStyle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayButtonBoxShadowOuter : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayButtonBoxShadowOuter(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -108,11 +273,7 @@ bool nsDisplayButtonBoxShadowOuter::CanBuildWebRenderDisplayItems() {
|
|||
|
||||
// We don't support native themed things yet like box shadows around
|
||||
// input buttons.
|
||||
if (nativeTheme) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !nativeTheme;
|
||||
}
|
||||
|
||||
bool nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
|
||||
|
@ -370,159 +531,4 @@ bool nsDisplayButtonForeground::CreateWebRenderCommands(
|
|||
return true;
|
||||
}
|
||||
|
||||
nsresult nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayList* aBackground,
|
||||
nsDisplayList* aForeground) {
|
||||
if (!mFrame->StyleEffects()->mBoxShadow.IsEmpty()) {
|
||||
aBackground->AppendNewToTop<nsDisplayButtonBoxShadowOuter>(aBuilder,
|
||||
GetFrame());
|
||||
}
|
||||
|
||||
nsRect buttonRect =
|
||||
mFrame->GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(mFrame);
|
||||
|
||||
const AppendedBackgroundType result =
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, mFrame, buttonRect, aBackground);
|
||||
if (result == AppendedBackgroundType::None) {
|
||||
aBuilder->BuildCompositorHitTestInfoIfNeeded(GetFrame(), aBackground);
|
||||
}
|
||||
|
||||
aBackground->AppendNewToTop<nsDisplayButtonBorder>(aBuilder, GetFrame(),
|
||||
this);
|
||||
|
||||
// Only display focus rings if we actually have them. Since at most one
|
||||
// button would normally display a focus ring, most buttons won't have them.
|
||||
const auto* disp = mFrame->StyleDisplay();
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
if (mInnerFocusStyle && mInnerFocusStyle->StyleBorder()->HasBorder() &&
|
||||
mFrame->IsThemed(disp) &&
|
||||
pc->Theme()->ThemeWantsButtonInnerFocusRing(
|
||||
disp->EffectiveAppearance())) {
|
||||
aForeground->AppendNewToTop<nsDisplayButtonForeground>(aBuilder, GetFrame(),
|
||||
this);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect,
|
||||
nsRect& aResult) {
|
||||
aResult = aRect;
|
||||
aResult.Deflate(mFrame->GetUsedBorderAndPadding());
|
||||
|
||||
if (mInnerFocusStyle) {
|
||||
nsMargin innerFocusPadding(0, 0, 0, 0);
|
||||
mInnerFocusStyle->StylePadding()->GetPadding(innerFocusPadding);
|
||||
|
||||
nsMargin framePadding = mFrame->GetUsedPadding();
|
||||
|
||||
innerFocusPadding.top = std::min(innerFocusPadding.top, framePadding.top);
|
||||
innerFocusPadding.right =
|
||||
std::min(innerFocusPadding.right, framePadding.right);
|
||||
innerFocusPadding.bottom =
|
||||
std::min(innerFocusPadding.bottom, framePadding.bottom);
|
||||
innerFocusPadding.left =
|
||||
std::min(innerFocusPadding.left, framePadding.left);
|
||||
|
||||
aResult.Inflate(innerFocusPadding);
|
||||
}
|
||||
}
|
||||
|
||||
ImgDrawResult nsButtonFrameRenderer::PaintInnerFocusBorder(
|
||||
nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext, const nsRect& aDirtyRect,
|
||||
const nsRect& aRect) {
|
||||
// we draw the -moz-focus-inner border just inside the button's
|
||||
// normal border and padding, to match Windows themes.
|
||||
|
||||
nsRect rect;
|
||||
|
||||
PaintBorderFlags flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SyncDecodeImages
|
||||
: PaintBorderFlags();
|
||||
|
||||
ImgDrawResult result = ImgDrawResult::SUCCESS;
|
||||
|
||||
if (mInnerFocusStyle) {
|
||||
GetButtonInnerFocusRect(aRect, rect);
|
||||
|
||||
result &=
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, rect, mInnerFocusStyle, flags);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Maybe<nsCSSBorderRenderer>
|
||||
nsButtonFrameRenderer::CreateInnerFocusBorderRenderer(
|
||||
nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext,
|
||||
gfxContext* aRenderingContext, const nsRect& aDirtyRect,
|
||||
const nsRect& aRect, bool* aBorderIsEmpty) {
|
||||
if (mInnerFocusStyle) {
|
||||
nsRect rect;
|
||||
GetButtonInnerFocusRect(aRect, rect);
|
||||
|
||||
gfx::DrawTarget* dt =
|
||||
aRenderingContext ? aRenderingContext->GetDrawTarget() : nullptr;
|
||||
return nsCSSRendering::CreateBorderRenderer(
|
||||
aPresContext, dt, mFrame, aDirtyRect, rect, mInnerFocusStyle,
|
||||
aBorderIsEmpty);
|
||||
}
|
||||
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
ImgDrawResult nsButtonFrameRenderer::PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
gfxContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect) {
|
||||
// get the button rect this is inside the focus and outline rects
|
||||
nsRect buttonRect = aRect;
|
||||
ComputedStyle* context = mFrame->Style();
|
||||
|
||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SyncDecodeImages
|
||||
: PaintBorderFlags();
|
||||
|
||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext, mFrame,
|
||||
buttonRect);
|
||||
|
||||
ImgDrawResult result =
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, context, borderFlags);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this when styles change
|
||||
*/
|
||||
void nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext) {
|
||||
// get all the styles
|
||||
ServoStyleSet* styleSet = aPresContext->StyleSet();
|
||||
|
||||
// get styles assigned to -moz-focus-inner (ie dotted border on Windows)
|
||||
mInnerFocusStyle = styleSet->ProbePseudoElementStyle(
|
||||
*mFrame->GetContent()->AsElement(), PseudoStyleType::mozFocusInner,
|
||||
mFrame->Style());
|
||||
}
|
||||
|
||||
ComputedStyle* nsButtonFrameRenderer::GetComputedStyle(int32_t aIndex) const {
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
return mInnerFocusStyle;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void nsButtonFrameRenderer::SetComputedStyle(int32_t aIndex,
|
||||
ComputedStyle* aComputedStyle) {
|
||||
switch (aIndex) {
|
||||
case NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX:
|
||||
mInnerFocusStyle = aComputedStyle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -12,16 +12,22 @@
|
|||
|
||||
class gfxContext;
|
||||
class nsIFrame;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsPresContext;
|
||||
struct nsRect;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
|
||||
#define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX \
|
||||
NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX
|
||||
|
||||
class nsButtonFrameRenderer {
|
||||
using nsDisplayList = mozilla::nsDisplayList;
|
||||
using nsDisplayListBuilder = mozilla::nsDisplayListBuilder;
|
||||
|
||||
typedef mozilla::image::ImgDrawResult ImgDrawResult;
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
|
||||
|
|
|
@ -1464,6 +1464,8 @@ int32_t nsComboboxControlFrame::UpdateRecentIndex(int32_t aIndex) {
|
|||
return index;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayComboboxFocus : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayComboboxFocus(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -1483,6 +1485,8 @@ void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder,
|
|||
*aCtx->GetDrawTarget(), ToReferenceFrame());
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (aBuilder->IsForEventDelivery()) {
|
||||
|
|
|
@ -95,6 +95,8 @@ nsIFrame* nsFieldSetFrame::GetLegend() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayFieldSetBorder final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayFieldSetBorder(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -218,6 +220,8 @@ bool nsDisplayFieldSetBorder::CreateWebRenderCommands(
|
|||
return true;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
// Paint our background and border in a special way.
|
||||
|
|
|
@ -28,7 +28,64 @@ nsContainerFrame* NS_NewSelectsAreaFrame(PresShell* aShell,
|
|||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsSelectsAreaFrame)
|
||||
|
||||
//---------------------------------------------------------
|
||||
static nsListControlFrame* GetEnclosingListFrame(nsIFrame* aSelectsAreaFrame) {
|
||||
nsIFrame* frame = aSelectsAreaFrame->GetParent();
|
||||
while (frame) {
|
||||
if (frame->IsListControlFrame())
|
||||
return static_cast<nsListControlFrame*>(frame);
|
||||
frame = frame->GetParent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) {
|
||||
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
||||
|
||||
nsListControlFrame* list = GetEnclosingListFrame(this);
|
||||
NS_ASSERTION(list,
|
||||
"Must have an nsListControlFrame! Frame constructor is "
|
||||
"broken");
|
||||
|
||||
bool isInDropdownMode = list->IsInDropDownMode();
|
||||
|
||||
// See similar logic in nsListControlFrame::Reflow and
|
||||
// nsListControlFrame::ReflowAsDropdown. We need to match it here.
|
||||
WritingMode wm = aReflowInput.GetWritingMode();
|
||||
nscoord oldBSize;
|
||||
if (isInDropdownMode) {
|
||||
// Store the block size now in case it changes during
|
||||
// nsBlockFrame::Reflow for some odd reason.
|
||||
if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
|
||||
oldBSize = BSize(wm);
|
||||
} else {
|
||||
oldBSize = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
|
||||
|
||||
// Check whether we need to suppress scrollbar updates. We want to do
|
||||
// that if we're in a possible first pass and our block size of a row
|
||||
// has changed.
|
||||
if (list->MightNeedSecondPass()) {
|
||||
nscoord newBSizeOfARow = list->CalcBSizeOfARow();
|
||||
// We'll need a second pass if our block size of a row changed. For
|
||||
// comboboxes, we'll also need it if our block size changed. If
|
||||
// we're going to do a second pass, suppress scrollbar updates for
|
||||
// this pass.
|
||||
if (newBSizeOfARow != mBSizeOfARow ||
|
||||
(isInDropdownMode &&
|
||||
(oldBSize != aDesiredSize.BSize(wm) || oldBSize != BSize(wm)))) {
|
||||
mBSizeOfARow = newBSizeOfARow;
|
||||
list->SetSuppressScrollbarUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
/**
|
||||
* This wrapper class lets us redirect mouse hits from the child frame of
|
||||
* an option element to the element's own frame.
|
||||
|
@ -94,16 +151,6 @@ class nsOptionEventGrabberWrapper : public nsDisplayItemWrapper {
|
|||
}
|
||||
};
|
||||
|
||||
static nsListControlFrame* GetEnclosingListFrame(nsIFrame* aSelectsAreaFrame) {
|
||||
nsIFrame* frame = aSelectsAreaFrame->GetParent();
|
||||
while (frame) {
|
||||
if (frame->IsListControlFrame())
|
||||
return static_cast<nsListControlFrame*>(frame);
|
||||
frame = frame->GetParent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class nsDisplayListFocus : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayListFocus(nsDisplayListBuilder* aBuilder, nsSelectsAreaFrame* aFrame)
|
||||
|
@ -131,6 +178,8 @@ class nsDisplayListFocus : public nsPaintedDisplayItem {
|
|||
NS_DISPLAY_DECL_NAME("ListFocus", TYPE_LIST_FOCUS)
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsSelectsAreaFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!aBuilder->IsForEventDelivery()) {
|
||||
|
@ -157,50 +206,3 @@ void nsSelectsAreaFrame::BuildDisplayListInternal(
|
|||
aLists.Outlines()->AppendNewToTop<nsDisplayListFocus>(aBuilder, this);
|
||||
}
|
||||
}
|
||||
|
||||
void nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aDesiredSize,
|
||||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) {
|
||||
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
|
||||
|
||||
nsListControlFrame* list = GetEnclosingListFrame(this);
|
||||
NS_ASSERTION(list,
|
||||
"Must have an nsListControlFrame! Frame constructor is "
|
||||
"broken");
|
||||
|
||||
bool isInDropdownMode = list->IsInDropDownMode();
|
||||
|
||||
// See similar logic in nsListControlFrame::Reflow and
|
||||
// nsListControlFrame::ReflowAsDropdown. We need to match it here.
|
||||
WritingMode wm = aReflowInput.GetWritingMode();
|
||||
nscoord oldBSize;
|
||||
if (isInDropdownMode) {
|
||||
// Store the block size now in case it changes during
|
||||
// nsBlockFrame::Reflow for some odd reason.
|
||||
if (!HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
|
||||
oldBSize = BSize(wm);
|
||||
} else {
|
||||
oldBSize = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
|
||||
|
||||
// Check whether we need to suppress scrollbar updates. We want to do
|
||||
// that if we're in a possible first pass and our block size of a row
|
||||
// has changed.
|
||||
if (list->MightNeedSecondPass()) {
|
||||
nscoord newBSizeOfARow = list->CalcBSizeOfARow();
|
||||
// We'll need a second pass if our block size of a row changed. For
|
||||
// comboboxes, we'll also need it if our block size changed. If
|
||||
// we're going to do a second pass, suppress scrollbar updates for
|
||||
// this pass.
|
||||
if (newBSizeOfARow != mBSizeOfARow ||
|
||||
(isInDropdownMode &&
|
||||
(oldBSize != aDesiredSize.BSize(wm) || oldBSize != BSize(wm)))) {
|
||||
mBSizeOfARow = newBSizeOfARow;
|
||||
list->SetSuppressScrollbarUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,11 +159,9 @@ class nsDisplayTextOverflowMarker final : public nsPaintedDisplayItem {
|
|||
mAscent(aAscent) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTextOverflowMarker);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
virtual ~nsDisplayTextOverflowMarker() {
|
||||
MOZ_COUNT_DTOR(nsDisplayTextOverflowMarker);
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTextOverflowMarker)
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override {
|
||||
*aSnap = false;
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "nsContainerFrame.h"
|
||||
|
||||
class nsDisplayWrapList;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayWrapList;
|
||||
class ServoRestyleState;
|
||||
|
||||
/**
|
||||
|
|
|
@ -130,6 +130,7 @@ class nsCanvasFrame final : public nsContainerFrame,
|
|||
nsCOMPtr<Element> mTooltipContent;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
/**
|
||||
* Override nsDisplayBackground methods so that we pass aBGClipRect to
|
||||
* PaintBackground, covering the whole overflow area.
|
||||
|
@ -218,4 +219,6 @@ class nsDisplayCanvasThemedBackground : public nsDisplayThemedBackground {
|
|||
NS_DISPLAY_DECL_NAME("CanvasThemedBackground", TYPE_CANVAS_THEMED_BACKGROUND)
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* nsCanvasFrame_h___ */
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
using namespace mozilla;
|
||||
|
||||
namespace mozilla {
|
||||
namespace layout {
|
||||
namespace detail {
|
||||
const AlignedFrameListBytes gEmptyFrameListBytes = {0};
|
||||
} // namespace detail
|
||||
} // namespace layout
|
||||
} // namespace mozilla
|
||||
|
||||
void* nsFrameList::operator new(size_t sz, mozilla::PresShell* aPresShell) {
|
||||
|
|
|
@ -623,19 +623,19 @@ class MOZ_RAII AutoFrameListPtr final {
|
|||
nsFrameList* mFrameList;
|
||||
};
|
||||
|
||||
namespace layout::detail {
|
||||
namespace detail {
|
||||
union AlignedFrameListBytes {
|
||||
void* ptr;
|
||||
char bytes[sizeof(nsFrameList)];
|
||||
};
|
||||
extern const AlignedFrameListBytes gEmptyFrameListBytes;
|
||||
} // namespace layout::detail
|
||||
} // namespace detail
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/* static */ inline const nsFrameList& nsFrameList::EmptyList() {
|
||||
return *reinterpret_cast<const nsFrameList*>(
|
||||
&mozilla::layout::detail::gEmptyFrameListBytes);
|
||||
&mozilla::detail::gEmptyFrameListBytes);
|
||||
}
|
||||
|
||||
#endif /* nsFrameList_h___ */
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsStyleTransformMatrix.h"
|
||||
#include "mozilla/PresState.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
|
|
@ -25,7 +25,6 @@ class WebRenderCanvasData;
|
|||
} // namespace mozilla
|
||||
|
||||
class nsPresContext;
|
||||
class nsDisplayItem;
|
||||
|
||||
nsIFrame* NS_NewHTMLCanvasFrame(mozilla::PresShell* aPresShell,
|
||||
mozilla::ComputedStyle* aStyle);
|
||||
|
|
|
@ -113,10 +113,6 @@ class nsISelectionController;
|
|||
class nsBoxLayoutState;
|
||||
class nsBoxLayout;
|
||||
class nsILineIterator;
|
||||
class nsDisplayItem;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
class nsDisplayList;
|
||||
class gfxSkipChars;
|
||||
class gfxSkipCharsIterator;
|
||||
class gfxContext;
|
||||
|
@ -136,6 +132,12 @@ namespace mozilla {
|
|||
|
||||
enum class PseudoStyleType : uint8_t;
|
||||
enum class TableSelectionMode : uint32_t;
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
|
||||
class EventStates;
|
||||
class ServoRestyleState;
|
||||
class DisplayItemData;
|
||||
|
@ -619,6 +621,11 @@ class nsIFrame : public nsQueryFrame {
|
|||
using Visibility = mozilla::Visibility;
|
||||
using LengthPercentage = mozilla::LengthPercentage;
|
||||
|
||||
using nsDisplayItem = mozilla::nsDisplayItem;
|
||||
using nsDisplayList = mozilla::nsDisplayList;
|
||||
using nsDisplayListSet = mozilla::nsDisplayListSet;
|
||||
using nsDisplayListBuilder = mozilla::nsDisplayListBuilder;
|
||||
|
||||
typedef mozilla::ComputedStyle ComputedStyle;
|
||||
typedef mozilla::FrameProperties FrameProperties;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
|
|
|
@ -32,11 +32,12 @@ class nsIScrollPositionListener;
|
|||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
class nsIContent;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
struct ContainerLayerParameters;
|
||||
class DisplayItemClip;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace layers {
|
||||
struct ScrollMetadata;
|
||||
class Layer;
|
||||
|
@ -538,7 +539,7 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
|
|||
* aSetBase is only allowed to be false if there has been a call with it
|
||||
* set to true before on the same paint.
|
||||
*/
|
||||
virtual bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||
virtual bool DecideScrollableLayer(mozilla::nsDisplayListBuilder* aBuilder,
|
||||
nsRect* aVisibleRect, nsRect* aDirtyRect,
|
||||
bool aSetBase) = 0;
|
||||
|
||||
|
|
|
@ -26,13 +26,13 @@ class nsFontMetrics;
|
|||
class nsImageMap;
|
||||
class nsIURI;
|
||||
class nsILoadGroup;
|
||||
class nsDisplayImage;
|
||||
class nsPresContext;
|
||||
class nsImageFrame;
|
||||
class nsTransform2D;
|
||||
class nsImageLoadingContent;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayImage;
|
||||
class PresShell;
|
||||
namespace layers {
|
||||
class ImageContainer;
|
||||
|
@ -434,10 +434,11 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
|
|||
// singleton pattern: one LoadIcons instance is used
|
||||
static mozilla::StaticRefPtr<IconLoad> gIconLoad;
|
||||
|
||||
friend class nsDisplayImage;
|
||||
friend class mozilla::nsDisplayImage;
|
||||
friend class nsDisplayGradient;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
/**
|
||||
* Note that nsDisplayImage does not receive events. However, an image element
|
||||
* is replaced content so its background will be z-adjacent to the
|
||||
|
@ -504,4 +505,6 @@ class nsDisplayImage final : public nsDisplayImageContainer {
|
|||
nsCOMPtr<imgIContainer> mPrevImage;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* nsImageFrame_h___ */
|
||||
|
|
|
@ -1331,6 +1331,8 @@ already_AddRefed<mozilla::layers::Layer> nsDisplayRemote::BuildLayer(
|
|||
return layer.forget();
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
void nsDisplayRemote::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
nsFrameLoader* fl = GetFrameLoader();
|
||||
|
@ -1448,3 +1450,5 @@ nsFrameLoader* nsDisplayRemote::GetFrameLoader() const {
|
|||
return mFrame ? static_cast<nsSubDocumentFrame*>(mFrame)->FrameLoader()
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -176,6 +176,8 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
|
|||
bool mCallingShow;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* A nsDisplayRemote will graft a remote frame's shadow layer tree (for a given
|
||||
* nsFrameLoader) into its parent frame's layer tree.
|
||||
|
@ -228,4 +230,6 @@ class nsDisplayRemote final : public nsPaintedDisplayItem {
|
|||
EventRegionsOverride mEventRegionsOverride;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* NSSUBDOCUMENTFRAME_H_ */
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/dom/Text.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsSplittableFrame.h"
|
||||
|
@ -38,6 +39,7 @@ class SVGTextFrame;
|
|||
} // namespace mozilla
|
||||
|
||||
class nsTextFrame : public nsIFrame {
|
||||
using nsDisplayText = mozilla::nsDisplayText;
|
||||
typedef mozilla::LayoutDeviceRect LayoutDeviceRect;
|
||||
typedef mozilla::SelectionTypeMask SelectionTypeMask;
|
||||
typedef mozilla::SelectionType SelectionType;
|
||||
|
@ -779,8 +781,8 @@ class nsTextFrame : public nsIFrame {
|
|||
protected:
|
||||
virtual ~nsTextFrame();
|
||||
|
||||
friend class nsDisplayTextGeometry;
|
||||
friend class nsDisplayText;
|
||||
friend class mozilla::nsDisplayTextGeometry;
|
||||
friend class mozilla::nsDisplayText;
|
||||
|
||||
RefPtr<nsFontMetrics> mFontMetrics;
|
||||
RefPtr<gfxTextRun> mTextRun;
|
||||
|
|
|
@ -396,176 +396,6 @@ void nsVideoFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
|||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics);
|
||||
}
|
||||
|
||||
class nsDisplayVideo : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayVideo(nsDisplayListBuilder* aBuilder, nsVideoFrame* aFrame)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayVideo);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayVideo)
|
||||
#endif
|
||||
|
||||
NS_DISPLAY_DECL_NAME("Video", TYPE_VIDEO)
|
||||
|
||||
virtual bool CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override {
|
||||
nsRect area = Frame()->GetContentRectRelativeToSelf() + ToReferenceFrame();
|
||||
HTMLVideoElement* element =
|
||||
static_cast<HTMLVideoElement*>(Frame()->GetContent());
|
||||
|
||||
Maybe<CSSIntSize> videoSizeInPx = element->GetVideoSize();
|
||||
if (videoSizeInPx.isNothing() || area.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<ImageContainer> container = element->GetImageContainer();
|
||||
if (!container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Retrieve the size of the decoded video frame, before being scaled
|
||||
// by pixel aspect ratio.
|
||||
mozilla::gfx::IntSize frameSize = container->GetCurrentSize();
|
||||
if (frameSize.width == 0 || frameSize.height == 0) {
|
||||
// No image, or zero-sized image. Don't render.
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto aspectRatio = AspectRatio::FromSize(*videoSizeInPx);
|
||||
const IntrinsicSize intrinsicSize(CSSPixel::ToAppUnits(*videoSizeInPx));
|
||||
nsRect dest = nsLayoutUtils::ComputeObjectDestRect(
|
||||
area, intrinsicSize, aspectRatio, Frame()->StylePosition());
|
||||
|
||||
gfxRect destGFXRect = Frame()->PresContext()->AppUnitsToGfxUnits(dest);
|
||||
destGFXRect.Round();
|
||||
if (destGFXRect.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
container->SetRotation(element->RotationDegrees());
|
||||
|
||||
// If the image container is empty, we don't want to fallback. Any other
|
||||
// failure will be due to resource constraints and fallback is unlikely to
|
||||
// help us. Hence we can ignore the return value from PushImage.
|
||||
LayoutDeviceRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width,
|
||||
destGFXRect.height);
|
||||
aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources,
|
||||
aSc, rect, rect);
|
||||
return true;
|
||||
}
|
||||
|
||||
// For opaque videos, we will want to override GetOpaqueRegion here.
|
||||
// This is tracked by bug 1545498.
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override {
|
||||
*aSnap = true;
|
||||
nsIFrame* f = Frame();
|
||||
return f->GetContentRectRelativeToSelf() + ToReferenceFrame();
|
||||
}
|
||||
|
||||
virtual already_AddRefed<Layer> BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) override {
|
||||
return static_cast<nsVideoFrame*>(mFrame)->BuildLayer(
|
||||
aBuilder, aManager, this, aContainerParameters);
|
||||
}
|
||||
|
||||
virtual LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
if (aManager->IsCompositingCheap()) {
|
||||
// Since ImageLayers don't require additional memory of the
|
||||
// video frames we have to have anyway, we can't save much by
|
||||
// making layers inactive. Also, for many accelerated layer
|
||||
// managers calling imageContainer->GetCurrentAsSurface can be
|
||||
// very expensive. So just always be active when compositing is
|
||||
// cheap (i.e. hardware accelerated).
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
HTMLMediaElement* elem =
|
||||
static_cast<HTMLMediaElement*>(mFrame->GetContent());
|
||||
return elem->IsPotentiallyPlaying() ? LayerState::LAYER_ACTIVE_FORCE
|
||||
: LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
|
||||
// Only report FirstContentfulPaint when the video is set
|
||||
bool IsContentful() const override {
|
||||
nsVideoFrame* f = static_cast<nsVideoFrame*>(Frame());
|
||||
HTMLVideoElement* video = HTMLVideoElement::FromNode(f->GetContent());
|
||||
return video->VideoWidth() > 0;
|
||||
}
|
||||
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) override {
|
||||
// This currently uses BasicLayerManager to re-use the code for extracting
|
||||
// the current Image and generating DrawTarget rendering commands for it.
|
||||
// Ideally we'll factor out that code and use it directly soon.
|
||||
RefPtr<BasicLayerManager> layerManager =
|
||||
new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN);
|
||||
|
||||
layerManager->BeginTransactionWithTarget(aCtx);
|
||||
RefPtr<Layer> layer =
|
||||
BuildLayer(aBuilder, layerManager, ContainerLayerParameters());
|
||||
if (!layer) {
|
||||
layerManager->AbortTransaction();
|
||||
return;
|
||||
}
|
||||
|
||||
layerManager->SetRoot(layer);
|
||||
layerManager->EndEmptyTransaction();
|
||||
}
|
||||
};
|
||||
|
||||
void nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!IsVisibleForPainting()) return;
|
||||
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsVideoFrame");
|
||||
|
||||
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
||||
|
||||
const bool shouldDisplayPoster = ShouldDisplayPoster();
|
||||
|
||||
// NOTE: If we're displaying a poster image (instead of video data), we can
|
||||
// trust the nsImageFrame to constrain its drawing to its content rect
|
||||
// (which happens to be the same as our content rect).
|
||||
uint32_t clipFlags;
|
||||
if (shouldDisplayPoster ||
|
||||
!nsStyleUtil::ObjectPropsMightCauseOverflow(StylePosition())) {
|
||||
clipFlags = DisplayListClipState::ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT;
|
||||
} else {
|
||||
clipFlags = 0;
|
||||
}
|
||||
|
||||
DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox clip(
|
||||
aBuilder, this, clipFlags);
|
||||
|
||||
if (HasVideoElement() && !shouldDisplayPoster) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayVideo>(aBuilder, this);
|
||||
}
|
||||
|
||||
// Add child frames to display list. We expect various children,
|
||||
// but only want to draw mPosterImage conditionally. Others we
|
||||
// always add to the display list.
|
||||
for (nsIFrame* child : mFrames) {
|
||||
if (child->GetContent() != mPosterImage || shouldDisplayPoster ||
|
||||
child->IsBoxFrame()) {
|
||||
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
|
||||
aBuilder, child,
|
||||
aBuilder->GetVisibleRect() - child->GetOffsetTo(this),
|
||||
aBuilder->GetDirtyRect() - child->GetOffsetTo(this));
|
||||
|
||||
child->BuildDisplayListForStackingContext(aBuilder, aLists.Content());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
a11y::AccType nsVideoFrame::AccessibleType() { return a11y::eHTMLMediaType; }
|
||||
#endif
|
||||
|
@ -750,3 +580,176 @@ bool nsVideoFrame::HasVideoData() const {
|
|||
void nsVideoFrame::UpdateTextTrack() {
|
||||
static_cast<HTMLMediaElement*>(GetContent())->NotifyCueDisplayStatesChanged();
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayVideo : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayVideo(nsDisplayListBuilder* aBuilder, nsVideoFrame* aFrame)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayVideo);
|
||||
}
|
||||
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayVideo)
|
||||
|
||||
NS_DISPLAY_DECL_NAME("Video", TYPE_VIDEO)
|
||||
|
||||
virtual bool CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override {
|
||||
nsRect area = Frame()->GetContentRectRelativeToSelf() + ToReferenceFrame();
|
||||
HTMLVideoElement* element =
|
||||
static_cast<HTMLVideoElement*>(Frame()->GetContent());
|
||||
|
||||
Maybe<CSSIntSize> videoSizeInPx = element->GetVideoSize();
|
||||
if (videoSizeInPx.isNothing() || area.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RefPtr<ImageContainer> container = element->GetImageContainer();
|
||||
if (!container) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Retrieve the size of the decoded video frame, before being scaled
|
||||
// by pixel aspect ratio.
|
||||
mozilla::gfx::IntSize frameSize = container->GetCurrentSize();
|
||||
if (frameSize.width == 0 || frameSize.height == 0) {
|
||||
// No image, or zero-sized image. Don't render.
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto aspectRatio = AspectRatio::FromSize(*videoSizeInPx);
|
||||
const IntrinsicSize intrinsicSize(CSSPixel::ToAppUnits(*videoSizeInPx));
|
||||
nsRect dest = nsLayoutUtils::ComputeObjectDestRect(
|
||||
area, intrinsicSize, aspectRatio, Frame()->StylePosition());
|
||||
|
||||
gfxRect destGFXRect = Frame()->PresContext()->AppUnitsToGfxUnits(dest);
|
||||
destGFXRect.Round();
|
||||
if (destGFXRect.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
container->SetRotation(element->RotationDegrees());
|
||||
|
||||
// If the image container is empty, we don't want to fallback. Any other
|
||||
// failure will be due to resource constraints and fallback is unlikely to
|
||||
// help us. Hence we can ignore the return value from PushImage.
|
||||
LayoutDeviceRect rect(destGFXRect.x, destGFXRect.y, destGFXRect.width,
|
||||
destGFXRect.height);
|
||||
aManager->CommandBuilder().PushImage(this, container, aBuilder, aResources,
|
||||
aSc, rect, rect);
|
||||
return true;
|
||||
}
|
||||
|
||||
// For opaque videos, we will want to override GetOpaqueRegion here.
|
||||
// This is tracked by bug 1545498.
|
||||
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override {
|
||||
*aSnap = true;
|
||||
nsIFrame* f = Frame();
|
||||
return f->GetContentRectRelativeToSelf() + ToReferenceFrame();
|
||||
}
|
||||
|
||||
virtual already_AddRefed<Layer> BuildLayer(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aContainerParameters) override {
|
||||
return static_cast<nsVideoFrame*>(mFrame)->BuildLayer(
|
||||
aBuilder, aManager, this, aContainerParameters);
|
||||
}
|
||||
|
||||
virtual LayerState GetLayerState(
|
||||
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
|
||||
const ContainerLayerParameters& aParameters) override {
|
||||
if (aManager->IsCompositingCheap()) {
|
||||
// Since ImageLayers don't require additional memory of the
|
||||
// video frames we have to have anyway, we can't save much by
|
||||
// making layers inactive. Also, for many accelerated layer
|
||||
// managers calling imageContainer->GetCurrentAsSurface can be
|
||||
// very expensive. So just always be active when compositing is
|
||||
// cheap (i.e. hardware accelerated).
|
||||
return LayerState::LAYER_ACTIVE;
|
||||
}
|
||||
HTMLMediaElement* elem =
|
||||
static_cast<HTMLMediaElement*>(mFrame->GetContent());
|
||||
return elem->IsPotentiallyPlaying() ? LayerState::LAYER_ACTIVE_FORCE
|
||||
: LayerState::LAYER_INACTIVE;
|
||||
}
|
||||
|
||||
// Only report FirstContentfulPaint when the video is set
|
||||
bool IsContentful() const override {
|
||||
nsVideoFrame* f = static_cast<nsVideoFrame*>(Frame());
|
||||
HTMLVideoElement* video = HTMLVideoElement::FromNode(f->GetContent());
|
||||
return video->VideoWidth() > 0;
|
||||
}
|
||||
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) override {
|
||||
// This currently uses BasicLayerManager to re-use the code for extracting
|
||||
// the current Image and generating DrawTarget rendering commands for it.
|
||||
// Ideally we'll factor out that code and use it directly soon.
|
||||
RefPtr<BasicLayerManager> layerManager =
|
||||
new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN);
|
||||
|
||||
layerManager->BeginTransactionWithTarget(aCtx);
|
||||
RefPtr<Layer> layer =
|
||||
BuildLayer(aBuilder, layerManager, ContainerLayerParameters());
|
||||
if (!layer) {
|
||||
layerManager->AbortTransaction();
|
||||
return;
|
||||
}
|
||||
|
||||
layerManager->SetRoot(layer);
|
||||
layerManager->EndEmptyTransaction();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!IsVisibleForPainting()) return;
|
||||
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsVideoFrame");
|
||||
|
||||
DisplayBorderBackgroundOutline(aBuilder, aLists);
|
||||
|
||||
const bool shouldDisplayPoster = ShouldDisplayPoster();
|
||||
|
||||
// NOTE: If we're displaying a poster image (instead of video data), we can
|
||||
// trust the nsImageFrame to constrain its drawing to its content rect
|
||||
// (which happens to be the same as our content rect).
|
||||
uint32_t clipFlags;
|
||||
if (shouldDisplayPoster ||
|
||||
!nsStyleUtil::ObjectPropsMightCauseOverflow(StylePosition())) {
|
||||
clipFlags = DisplayListClipState::ASSUME_DRAWING_RESTRICTED_TO_CONTENT_RECT;
|
||||
} else {
|
||||
clipFlags = 0;
|
||||
}
|
||||
|
||||
DisplayListClipState::AutoClipContainingBlockDescendantsToContentBox clip(
|
||||
aBuilder, this, clipFlags);
|
||||
|
||||
if (HasVideoElement() && !shouldDisplayPoster) {
|
||||
aLists.Content()->AppendNewToTop<nsDisplayVideo>(aBuilder, this);
|
||||
}
|
||||
|
||||
// Add child frames to display list. We expect various children,
|
||||
// but only want to draw mPosterImage conditionally. Others we
|
||||
// always add to the display list.
|
||||
for (nsIFrame* child : mFrames) {
|
||||
if (child->GetContent() != mPosterImage || shouldDisplayPoster ||
|
||||
child->IsBoxFrame()) {
|
||||
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
|
||||
aBuilder, child,
|
||||
aBuilder->GetVisibleRect() - child->GetOffsetTo(this),
|
||||
aBuilder->GetDirtyRect() - child->GetOffsetTo(this));
|
||||
|
||||
child->BuildDisplayListForStackingContext(aBuilder, aLists.Content());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1679,6 +1679,8 @@ nscoord nsMathMLChar::GetMaxWidth(nsIFrame* aForFrame, DrawTarget* aDrawTarget,
|
|||
return std::max(bm.width, bm.rightBearing) - std::min(0, bm.leftBearing);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayMathMLSelectionRect final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayMathMLSelectionRect(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
|
@ -1791,6 +1793,8 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
|
||||
const nsDisplayListSet& aLists, uint32_t aIndex,
|
||||
const nsRect* aSelectedRect) {
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
class gfxContext;
|
||||
class nsGlyphTable;
|
||||
class nsIFrame;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
class nsPresContext;
|
||||
struct nsBoundingMetrics;
|
||||
struct nsFont;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
class ComputedStyle;
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
// Hints for Stretch() to indicate criteria for stretching
|
||||
enum {
|
||||
|
@ -95,8 +95,8 @@ class nsMathMLChar {
|
|||
// not a virtual destructor: this class is not intended to be subclassed
|
||||
~nsMathMLChar();
|
||||
|
||||
void Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
|
||||
const nsDisplayListSet& aLists, uint32_t aIndex,
|
||||
void Display(mozilla::nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
|
||||
const mozilla::nsDisplayListSet& aLists, uint32_t aIndex,
|
||||
const nsRect* aSelectedRect = nullptr);
|
||||
|
||||
void PaintForeground(nsIFrame* aForFrame, gfxContext& aRenderingContext,
|
||||
|
|
|
@ -68,6 +68,8 @@ nsresult nsMathMLContainerFrame::ReflowError(DrawTarget* aDrawTarget,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayMathMLError : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayMathMLError(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
|
@ -101,6 +103,8 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsPoint(pt.x, pt.y + ascent), *fm, *aCtx);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/* /////////////
|
||||
* nsIMathMLFrame - support methods for stretchy elements
|
||||
* =============================================================================
|
||||
|
|
|
@ -257,6 +257,7 @@ void nsMathMLFrame::ParseNumericValue(const nsString& aString,
|
|||
CalcLength(aPresContext, aComputedStyle, cssValue, aFontSizeInflation);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
class nsDisplayMathMLBoundingMetrics final : public nsDisplayItem {
|
||||
public:
|
||||
|
@ -326,6 +327,8 @@ void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder,
|
|||
drawTarget->FillRect(rect, color);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsMathMLFrame::DisplayBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aRect,
|
||||
const nsDisplayListSet& aLists,
|
||||
|
|
|
@ -16,7 +16,11 @@
|
|||
|
||||
class nsMathMLChar;
|
||||
class nsCSSValue;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
} // namespace mozilla
|
||||
|
||||
// Concrete base class with default methods that derived MathML frames can
|
||||
// override
|
||||
|
@ -264,8 +268,8 @@ class nsMathMLFrame : public nsIMathMLFrame {
|
|||
|
||||
protected:
|
||||
#if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
|
||||
void DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsPoint& aPt,
|
||||
void DisplayBoundingMetrics(mozilla::nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, const nsPoint& aPt,
|
||||
const nsBoundingMetrics& aMetrics,
|
||||
const nsDisplayListSet& aLists);
|
||||
#endif
|
||||
|
@ -274,8 +278,8 @@ class nsMathMLFrame : public nsIMathMLFrame {
|
|||
* Display a solid rectangle in the frame's text color. Used for drawing
|
||||
* fraction separators and root/sqrt overbars.
|
||||
*/
|
||||
void DisplayBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aRect, const nsDisplayListSet& aLists,
|
||||
void DisplayBar(mozilla::nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aRect, const mozilla::nsDisplayListSet& aLists,
|
||||
uint32_t aIndex = 0);
|
||||
|
||||
// information about the presentation policy of the frame
|
||||
|
|
|
@ -701,6 +701,8 @@ void nsMathMLmencloseFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
|||
|
||||
//////////////////
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayNotation final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayNotation(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
|
@ -814,6 +816,8 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsMathMLmencloseFrame::DisplayNotation(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
const nsRect& aRect,
|
||||
|
|
|
@ -602,6 +602,8 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayMathMLSlash : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
|
@ -651,6 +653,8 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
|||
aDrawTarget.Fill(path, color);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsMathMLmfracFrame::DisplaySlash(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aRect, nscoord aThickness,
|
||||
const nsDisplayListSet& aLists) {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "nsTableCellFrame.h"
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayListSet;
|
||||
class PresShell;
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -227,9 +229,9 @@ class nsMathMLmtdFrame final : public nsTableCellFrame {
|
|||
int32_t aModType) override;
|
||||
|
||||
virtual mozilla::StyleVerticalAlignKeyword GetVerticalAlign() const override;
|
||||
virtual nsresult ProcessBorders(nsTableFrame* aFrame,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
virtual nsresult ProcessBorders(
|
||||
nsTableFrame* aFrame, mozilla::nsDisplayListBuilder* aBuilder,
|
||||
const mozilla::nsDisplayListSet& aLists) override;
|
||||
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
||||
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
|
||||
|
|
|
@ -12,11 +12,12 @@
|
|||
class nsIFrame;
|
||||
class nsIContent;
|
||||
class nsCSSPropertyIDSet;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDOMCSSDeclaration;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
/**
|
||||
* This class receives various notifications about style changes and content
|
||||
* changes that affect layerization decisions, and implements the heuristics
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
|
||||
class nsIFrame;
|
||||
class nsIScrollableFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
/**
|
||||
* All clip coordinates are in appunits relative to the reference frame
|
||||
* for the display item we're building.
|
||||
|
|
|
@ -36,17 +36,18 @@
|
|||
#include "nscore.h" // for nsrefcnt
|
||||
|
||||
class gfxContext;
|
||||
class nsIFrame;
|
||||
class nsPresContext;
|
||||
class nsRootPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayItem;
|
||||
class nsDisplayItemGeometry;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsDisplayMasksAndClipPaths;
|
||||
class nsIFrame;
|
||||
class nsPaintedDisplayItem;
|
||||
class nsPresContext;
|
||||
class nsRootPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
struct ActiveScrolledRoot;
|
||||
struct DisplayItemClipChain;
|
||||
class TransformClipNode;
|
||||
|
|
|
@ -12,12 +12,16 @@
|
|||
#include "nsRect.h"
|
||||
|
||||
class nsIFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayListBuilder;
|
||||
struct ActiveScrolledRoot;
|
||||
|
||||
namespace wr {
|
||||
class DisplayListBuilder;
|
||||
} // namespace wr
|
||||
|
||||
/**
|
||||
* A helper class that manages compositor hit testing information.
|
||||
*/
|
||||
|
|
|
@ -45,9 +45,10 @@
|
|||
* matched items can be inserted into the merged list in any order.
|
||||
*/
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::Document;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
void RetainedDisplayListData::AddModifiedFrame(nsIFrame* aFrame) {
|
||||
MOZ_ASSERT(!aFrame->IsFrameModified());
|
||||
Flags(aFrame) |= RetainedDisplayListData::FrameFlags::Modified;
|
||||
|
@ -1479,3 +1480,5 @@ PartialUpdateResult RetainedDisplayListBuilder::AttemptPartialUpdate(
|
|||
mBuilder.LeavePresShell(mBuilder.RootReferenceFrame(), List());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
class nsWindowSizes;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* RetainedDisplayListData contains frame invalidation information. It is stored
|
||||
* in root frames, and used by RetainedDisplayListBuilder.
|
||||
|
@ -258,4 +260,6 @@ struct RetainedDisplayListBuilder {
|
|||
RetainedDisplayListMetrics mMetrics;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // RETAINEDDISPLAYLISTBUILDER_H_
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
#include "mozilla/Span.h"
|
||||
#include "PLDHashTable.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct DisplayItemKey {
|
||||
bool operator==(const DisplayItemKey& aOther) const {
|
||||
return mFrame == aOther.mFrame && mPerFrameKey == aOther.mPerFrameKey;
|
||||
|
@ -178,4 +182,6 @@ struct OldItemInfo {
|
|||
bool AnyContentAncestorModified(nsIFrame* aFrame,
|
||||
nsIFrame* aStopAtFrame = nullptr);
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // RETAINEDDISPLAYLISTHELPERS_H_
|
||||
|
|
|
@ -208,27 +208,27 @@ struct nsCSSRendering {
|
|||
mozilla::ComputedStyle* aStyle);
|
||||
|
||||
static ImgDrawResult CreateWebRenderCommandsForBorder(
|
||||
nsDisplayItem* aItem, nsIFrame* aForFrame, const nsRect& aBorderArea,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::nsDisplayItem* aItem, nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder);
|
||||
mozilla::nsDisplayListBuilder* aDisplayListBuilder);
|
||||
|
||||
static void CreateWebRenderCommandsForNullBorder(
|
||||
nsDisplayItem* aItem, nsIFrame* aForFrame, const nsRect& aBorderArea,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::nsDisplayItem* aItem, nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
const nsStyleBorder& aStyleBorder);
|
||||
|
||||
static ImgDrawResult CreateWebRenderCommandsForBorderWithStyleBorder(
|
||||
nsDisplayItem* aItem, nsIFrame* aForFrame, const nsRect& aBorderArea,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::nsDisplayItem* aItem, nsIFrame* aForFrame,
|
||||
const nsRect& aBorderArea, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
mozilla::nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const nsStyleBorder& aStyleBorder);
|
||||
|
||||
/**
|
||||
|
@ -512,14 +512,16 @@ struct nsCSSRendering {
|
|||
const PaintBGParams& aParams, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager, nsDisplayItem* aItem);
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
mozilla::nsDisplayItem* aItem);
|
||||
|
||||
static ImgDrawResult BuildWebRenderDisplayItemsForStyleImageLayerWithSC(
|
||||
const PaintBGParams& aParams, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager, nsDisplayItem* aItem,
|
||||
mozilla::ComputedStyle* mBackgroundSC, const nsStyleBorder& aBorder);
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
mozilla::nsDisplayItem* aItem, mozilla::ComputedStyle* mBackgroundSC,
|
||||
const nsStyleBorder& aBorder);
|
||||
|
||||
/**
|
||||
* Returns the rectangle covered by the given background layer image, taking
|
||||
|
|
|
@ -20,9 +20,16 @@
|
|||
#include "gfxUtils.h"
|
||||
|
||||
struct nsBorderColors;
|
||||
class nsDisplayBorder;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayItem;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
class nsDisplayBorder;
|
||||
class nsDisplayButtonBorder;
|
||||
class nsDisplayButtonForeground;
|
||||
class nsDisplayOutline;
|
||||
|
||||
enum class StyleBorderStyle : uint8_t;
|
||||
enum class StyleBorderImageRepeat : uint8_t;
|
||||
|
@ -80,10 +87,9 @@ class nsCSSBorderRenderer final {
|
|||
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
|
||||
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
||||
|
||||
friend class nsDisplayBorder;
|
||||
friend class nsDisplayOutline;
|
||||
friend class nsDisplayButtonBorder;
|
||||
friend class nsDisplayButtonForeground;
|
||||
friend class mozilla::nsDisplayOutline;
|
||||
friend class mozilla::nsDisplayButtonBorder;
|
||||
friend class mozilla::nsDisplayButtonForeground;
|
||||
|
||||
public:
|
||||
nsCSSBorderRenderer(nsPresContext* aPresContext, DrawTarget* aDrawTarget,
|
||||
|
@ -97,7 +103,7 @@ class nsCSSBorderRenderer final {
|
|||
void DrawBorders();
|
||||
|
||||
void CreateWebRenderCommands(
|
||||
nsDisplayItem* aItem, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::nsDisplayItem* aItem, mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc);
|
||||
|
||||
|
@ -268,12 +274,12 @@ class nsCSSBorderImageRenderer final {
|
|||
nsIFrame* aForFrame,
|
||||
const nsRect& aDirtyRect);
|
||||
mozilla::image::ImgDrawResult CreateWebRenderCommands(
|
||||
nsDisplayItem* aItem, nsIFrame* aForFrame,
|
||||
mozilla::nsDisplayItem* aItem, nsIFrame* aForFrame,
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const mozilla::layers::StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder);
|
||||
mozilla::nsDisplayListBuilder* aDisplayListBuilder);
|
||||
|
||||
nsCSSBorderImageRenderer(const nsCSSBorderImageRenderer& aRhs);
|
||||
nsCSSBorderImageRenderer& operator=(const nsCSSBorderImageRenderer& aRhs);
|
||||
|
@ -295,7 +301,7 @@ class nsCSSBorderImageRenderer final {
|
|||
mozilla::StyleBorderImageRepeat mRepeatModeVertical;
|
||||
bool mFill;
|
||||
|
||||
friend class nsDisplayBorder;
|
||||
friend class mozilla::nsDisplayBorder;
|
||||
friend struct nsCSSRendering;
|
||||
};
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
#include "mozilla/layers/WebRenderMessages.h"
|
||||
#include "mozilla/layers/WebRenderScrollData.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layout;
|
||||
|
@ -123,6 +122,8 @@ using namespace mozilla::gfx;
|
|||
typedef ScrollableLayerGuid::ViewID ViewID;
|
||||
typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef DEBUG
|
||||
static bool SpammyLayoutWarningsEnabled() {
|
||||
static bool sValue = false;
|
||||
|
@ -9287,6 +9288,9 @@ void nsDisplayText::RenderToContext(gfxContext* aCtx,
|
|||
}
|
||||
}
|
||||
|
||||
// This could go to nsDisplayListInvalidation.h, but
|
||||
// |nsTextFrame::TextDecorations| requires including of nsTextFrame.h which
|
||||
// would produce circular dependencies.
|
||||
class nsDisplayTextGeometry : public nsDisplayItemGenericGeometry {
|
||||
public:
|
||||
nsDisplayTextGeometry(nsDisplayText* aItem, nsDisplayListBuilder* aBuilder)
|
||||
|
@ -10475,8 +10479,6 @@ void nsDisplayListCollection::SerializeWithCorrectZOrder(
|
|||
aOutResultList->AppendToTop(PositionedDescendants());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
uint32_t PaintTelemetry::sPaintLevel = 0;
|
||||
|
||||
PaintTelemetry::AutoRecordPaint::AutoRecordPaint() {
|
||||
|
@ -10507,8 +10509,6 @@ PaintTelemetry::AutoRecordPaint::~AutoRecordPaint() {
|
|||
static_cast<uint32_t>(totalMs));
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
static nsIFrame* GetSelfOrPlaceholderFor(nsIFrame* aFrame) {
|
||||
if (aFrame->HasAnyStateBits(NS_FRAME_IS_PUSHED_FLOAT)) {
|
||||
return aFrame;
|
||||
|
@ -10585,3 +10585,5 @@ nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
|
|||
aBuilder->mDirtyRect =
|
||||
aBuilder->mInInvalidSubtree ? aVisibleRect : aDirtyRect;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -69,15 +69,9 @@
|
|||
|
||||
class gfxContext;
|
||||
class nsIContent;
|
||||
class nsDisplayList;
|
||||
class nsDisplayTableItem;
|
||||
class nsIScrollableFrame;
|
||||
class nsSubDocumentFrame;
|
||||
class nsDisplayCompositorHitTestInfo;
|
||||
class nsDisplayScrollInfoLayer;
|
||||
class nsDisplayTableBackgroundSet;
|
||||
class nsCaret;
|
||||
enum class nsDisplayOwnLayerFlags;
|
||||
struct WrFiltersHolder;
|
||||
|
||||
namespace nsStyleTransformMatrix {
|
||||
|
@ -85,9 +79,14 @@ class TransformReferenceBox;
|
|||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum class nsDisplayOwnLayerFlags;
|
||||
class nsDisplayCompositorHitTestInfo;
|
||||
class nsDisplayScrollInfoLayer;
|
||||
class FrameLayerBuilder;
|
||||
class PresShell;
|
||||
class StickyScrollContainer;
|
||||
|
||||
namespace layers {
|
||||
struct FrameMetrics;
|
||||
class RenderRootStateManager;
|
||||
|
@ -99,9 +98,11 @@ class WebRenderCommand;
|
|||
class WebRenderScrollData;
|
||||
class WebRenderLayerScrollData;
|
||||
} // namespace layers
|
||||
|
||||
namespace wr {
|
||||
class DisplayListBuilder;
|
||||
} // namespace wr
|
||||
|
||||
namespace dom {
|
||||
class Selection;
|
||||
} // namespace dom
|
||||
|
@ -113,8 +114,6 @@ enum class DisplayListArenaObjectId {
|
|||
COUNT
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/*
|
||||
* An nsIFrame can have many different visual parts. For example an image frame
|
||||
* can have a background, border, and outline, the image itself, and a
|
||||
|
@ -249,8 +248,6 @@ struct AnimatedGeometryRoot {
|
|||
}
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* An active scrolled root (ASR) is similar to an animated geometry root (AGR).
|
||||
* The differences are:
|
||||
|
@ -338,7 +335,6 @@ struct ActiveScrolledRoot {
|
|||
uint32_t mDepth;
|
||||
bool mRetained;
|
||||
};
|
||||
} // namespace mozilla
|
||||
|
||||
enum class nsDisplayListBuilderMode : uint8_t {
|
||||
Painting,
|
||||
|
@ -349,7 +345,10 @@ enum class nsDisplayListBuilderMode : uint8_t {
|
|||
GenerateGlyph,
|
||||
};
|
||||
|
||||
class nsDisplayList;
|
||||
class nsDisplayWrapList;
|
||||
class nsDisplayTableBackgroundSet;
|
||||
class nsDisplayTableItem;
|
||||
|
||||
/**
|
||||
* This manages a display list and is passed as a parameter to
|
||||
|
@ -2082,15 +2081,16 @@ class RetainedDisplayList;
|
|||
} \
|
||||
\
|
||||
template <typename T, typename F, typename... Args> \
|
||||
friend T* ::MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder, \
|
||||
F* aFrame, const uint16_t aIndex, \
|
||||
Args&&... aArgs); \
|
||||
friend T* mozilla::MakeDisplayItemWithIndex( \
|
||||
nsDisplayListBuilder* aBuilder, F* aFrame, const uint16_t aIndex, \
|
||||
Args&&... aArgs); \
|
||||
\
|
||||
public:
|
||||
|
||||
#define NS_DISPLAY_ALLOW_CLONING() \
|
||||
template <typename T> \
|
||||
friend T* MakeClone(nsDisplayListBuilder* aBuilder, const T* aItem); \
|
||||
friend T* mozilla::MakeClone(nsDisplayListBuilder* aBuilder, \
|
||||
const T* aItem); \
|
||||
\
|
||||
nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override { \
|
||||
return MakeClone(aBuilder, this); \
|
||||
|
@ -4096,9 +4096,8 @@ class nsDisplayGeneric : public nsPaintedDisplayItem {
|
|||
}
|
||||
|
||||
template <typename T, typename F, typename... Args>
|
||||
friend T* ::MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder,
|
||||
F* aFrame, const uint16_t aIndex,
|
||||
Args&&... aArgs);
|
||||
friend T* MakeDisplayItemWithIndex(nsDisplayListBuilder* aBuilder, F* aFrame,
|
||||
const uint16_t aIndex, Args&&... aArgs);
|
||||
|
||||
PaintCallback mPaint;
|
||||
OldPaintCallback mOldPaint; // XXX: should be removed eventually
|
||||
|
@ -7217,6 +7216,8 @@ class nsDisplayPerspective : public nsPaintedDisplayItem {
|
|||
mutable RetainedDisplayList mList;
|
||||
};
|
||||
|
||||
class nsDisplayTextGeometry;
|
||||
|
||||
/**
|
||||
* This class adds basic support for limiting the rendering (in the inline axis
|
||||
* of the writing mode) to the part inside the specified edges.
|
||||
|
@ -7541,8 +7542,6 @@ class FlattenedDisplayListIterator {
|
|||
AutoTArray<nsDisplayItem*, 16> mStack;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class PaintTelemetry {
|
||||
public:
|
||||
class AutoRecordPaint {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsTableFrame.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
nsDisplayItemGeometry::nsDisplayItemGeometry(nsDisplayItem* aItem,
|
||||
nsDisplayListBuilder* aBuilder) {
|
||||
MOZ_COUNT_CTOR(nsDisplayItemGeometry);
|
||||
|
@ -120,3 +122,5 @@ nsDisplayTableItemGeometry::nsDisplayTableItemGeometry(
|
|||
: nsDisplayItemGenericGeometry(aItem, aBuilder),
|
||||
nsImageGeometryMixin(aItem, aBuilder),
|
||||
mFrameOffsetToViewport(aFrameOffsetToViewport) {}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "gfxRect.h"
|
||||
#include "mozilla/gfx/MatrixFwd.h"
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayBackgroundImage;
|
||||
class nsCharClipDisplayItem;
|
||||
class nsDisplayItem;
|
||||
|
@ -24,11 +25,9 @@ class nsDisplayEffectsBase;
|
|||
class nsDisplayMasksAndClipPaths;
|
||||
class nsDisplayFilters;
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
struct sRGBColor;
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* This stores the geometry of an nsDisplayItem, and the area
|
||||
|
@ -366,4 +365,6 @@ class nsDisplayTransformGeometry : public nsDisplayItemGeometry {
|
|||
int32_t mAppUnitsPerDevPixel;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /*NSDISPLAYLISTINVALIDATION_H_*/
|
||||
|
|
|
@ -13,8 +13,9 @@
|
|||
#include "mozilla/SurfaceFromElementResult.h"
|
||||
|
||||
class gfxDrawable;
|
||||
class nsDisplayItem;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayItem;
|
||||
|
||||
namespace layers {
|
||||
class StackingContextHelper;
|
||||
|
|
|
@ -157,9 +157,8 @@ class DisplaySVGGeometry final : public nsPaintedDisplayItem {
|
|||
MOZ_COUNT_CTOR(DisplaySVGGeometry);
|
||||
MOZ_ASSERT(aFrame, "Must have a frame!");
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
virtual ~DisplaySVGGeometry() { MOZ_COUNT_DTOR(DisplaySVGGeometry); }
|
||||
#endif
|
||||
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(DisplaySVGGeometry)
|
||||
|
||||
NS_DISPLAY_DECL_NAME("DisplaySVGGeometry", TYPE_SVG_GEOMETRY)
|
||||
|
||||
|
@ -210,6 +209,7 @@ class DisplaySVGGeometry final : public nsPaintedDisplayItem {
|
|||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // LAYOUT_SVG_SVGGEOMETRYFRAME_H_
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
class gfxContext;
|
||||
class gfxDrawable;
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
class nsIFrame;
|
||||
struct nsPoint;
|
||||
struct nsRect;
|
||||
|
@ -33,6 +31,8 @@ struct WrFiltersHolder {
|
|||
};
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayList;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace gfx {
|
||||
class DrawTarget;
|
||||
|
|
|
@ -43,36 +43,6 @@ using namespace mozilla;
|
|||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::image;
|
||||
|
||||
class nsDisplayTableCellSelection final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayTableCellSelection(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTableCellSelection);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableCellSelection)
|
||||
|
||||
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
|
||||
static_cast<nsTableCellFrame*>(mFrame)->DecorateForSelection(
|
||||
aCtx->GetDrawTarget(), ToReferenceFrame());
|
||||
}
|
||||
NS_DISPLAY_DECL_NAME("TableCellSelection", TYPE_TABLE_CELL_SELECTION)
|
||||
|
||||
bool CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override {
|
||||
RefPtr<nsFrameSelection> frameSelection =
|
||||
mFrame->PresShell()->FrameSelection();
|
||||
if (frameSelection->IsInTableSelectionMode()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
nsTableCellFrame::nsTableCellFrame(ComputedStyle* aStyle,
|
||||
nsTableFrame* aTableFrame, ClassID aID)
|
||||
: nsContainerFrame(aStyle, aTableFrame->PresContext(), aID),
|
||||
|
@ -368,43 +338,6 @@ nsresult nsTableCellFrame::ProcessBorders(nsTableFrame* aFrame,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsDisplayTableCellBackground : public nsDisplayTableItem {
|
||||
public:
|
||||
nsDisplayTableCellBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsTableCellFrame* aFrame)
|
||||
: nsDisplayTableItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTableCellBackground);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableCellBackground)
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames) override {
|
||||
aOutFrames->AppendElement(mFrame);
|
||||
}
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const override;
|
||||
NS_DISPLAY_DECL_NAME("TableCellBackground", TYPE_TABLE_CELL_BACKGROUND)
|
||||
};
|
||||
|
||||
void nsDisplayTableCellBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
ImgDrawResult result =
|
||||
static_cast<nsTableCellFrame*>(mFrame)->PaintBackground(
|
||||
*aCtx, GetPaintRect(), ToReferenceFrame(),
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
|
||||
nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
nsRect nsDisplayTableCellBackground::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const {
|
||||
// revert from nsDisplayTableItem's implementation ... cell backgrounds
|
||||
// don't overflow the cell
|
||||
return nsDisplayItem::GetBounds(aBuilder, aSnap);
|
||||
}
|
||||
|
||||
void nsTableCellFrame::InvalidateFrame(uint32_t aDisplayItemKey,
|
||||
bool aRebuildDisplayItems) {
|
||||
nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
|
||||
|
@ -449,102 +382,6 @@ bool nsTableCellFrame::ShouldPaintBackground(nsDisplayListBuilder* aBuilder) {
|
|||
return ShouldPaintBordersAndBackgrounds();
|
||||
}
|
||||
|
||||
void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
|
||||
if (ShouldPaintBordersAndBackgrounds()) {
|
||||
// display outset box-shadows if we need to.
|
||||
bool hasBoxShadow = !StyleEffects()->mBoxShadow.IsEmpty();
|
||||
if (hasBoxShadow) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayBoxShadowOuter>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
|
||||
|
||||
// display background if we need to.
|
||||
AppendedBackgroundType result = AppendedBackgroundType::None;
|
||||
if (aBuilder->IsForEventDelivery() ||
|
||||
!StyleBackground()->IsTransparent(this) ||
|
||||
StyleDisplay()->HasAppearance()) {
|
||||
result = nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, this, bgRect, aLists.BorderBackground());
|
||||
}
|
||||
|
||||
if (result == AppendedBackgroundType::None) {
|
||||
aBuilder->BuildCompositorHitTestInfoIfNeeded(this,
|
||||
aLists.BorderBackground());
|
||||
}
|
||||
|
||||
// display inset box-shadows if we need to.
|
||||
if (hasBoxShadow) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayBoxShadowInner>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
// display borders if we need to
|
||||
ProcessBorders(GetTableFrame(), aBuilder, aLists);
|
||||
|
||||
// and display the selection border if we need to
|
||||
if (IsSelected()) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayTableCellSelection>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
// This can be null if display list building initiated in the middle
|
||||
// of the table, which can happen with background-clip:text and
|
||||
// -moz-element.
|
||||
nsDisplayTableBackgroundSet* backgrounds =
|
||||
aBuilder->GetTableBackgroundSet();
|
||||
if (backgrounds) {
|
||||
// Compute bgRect relative to reference frame, but using the
|
||||
// normal (without position:relative offsets) positions for the
|
||||
// cell, row and row group.
|
||||
bgRect = GetRectRelativeToSelf() + GetNormalPosition();
|
||||
|
||||
nsTableRowFrame* row = GetTableRowFrame();
|
||||
bgRect += row->GetNormalPosition();
|
||||
|
||||
nsTableRowGroupFrame* rowGroup = row->GetTableRowGroupFrame();
|
||||
bgRect += rowGroup->GetNormalPosition();
|
||||
|
||||
bgRect += backgrounds->TableToReferenceFrame();
|
||||
|
||||
// Create backgrounds items as needed for the column and column
|
||||
// group that this cell occupies.
|
||||
nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex());
|
||||
nsTableColGroupFrame* colGroup = col->GetTableColGroupFrame();
|
||||
|
||||
Maybe<nsDisplayListBuilder::AutoBuildingDisplayList> buildingForColGroup;
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, colGroup, bgRect, backgrounds->ColGroupBackgrounds(), false,
|
||||
nullptr, colGroup->GetRect() + backgrounds->TableToReferenceFrame(),
|
||||
this, &buildingForColGroup);
|
||||
|
||||
Maybe<nsDisplayListBuilder::AutoBuildingDisplayList> buildingForCol;
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, col, bgRect, backgrounds->ColBackgrounds(), false, nullptr,
|
||||
col->GetRect() + colGroup->GetPosition() +
|
||||
backgrounds->TableToReferenceFrame(),
|
||||
this, &buildingForCol);
|
||||
}
|
||||
}
|
||||
|
||||
// the 'empty-cells' property has no effect on 'outline'
|
||||
DisplayOutline(aBuilder, aLists);
|
||||
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
NS_ASSERTION(kid && !kid->GetNextSibling(),
|
||||
"Table cells should have just one child");
|
||||
// The child's background will go in our BorderBackground() list.
|
||||
// This isn't a problem since it won't have a real background except for
|
||||
// event handling. We do not call BuildDisplayListForNonBlockChildren
|
||||
// because that/ would put the child's background in the Content() list
|
||||
// which isn't right (e.g., would end up on top of our child floats for
|
||||
// event handling).
|
||||
BuildDisplayListForChild(aBuilder, kid, aLists);
|
||||
}
|
||||
|
||||
LogicalSides nsTableCellFrame::GetLogicalSkipSides() const {
|
||||
LogicalSides skip(mWritingMode);
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
|
@ -1165,3 +1002,129 @@ ImgDrawResult nsBCTableCellFrame::PaintBackground(gfxContext& aRenderingContext,
|
|||
return nsCSSRendering::PaintStyleImageLayerWithSC(params, aRenderingContext,
|
||||
Style(), myBorder);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayTableCellSelection final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayTableCellSelection(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsPaintedDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTableCellSelection);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableCellSelection)
|
||||
|
||||
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
|
||||
static_cast<nsTableCellFrame*>(mFrame)->DecorateForSelection(
|
||||
aCtx->GetDrawTarget(), ToReferenceFrame());
|
||||
}
|
||||
NS_DISPLAY_DECL_NAME("TableCellSelection", TYPE_TABLE_CELL_SELECTION)
|
||||
|
||||
bool CreateWebRenderCommands(
|
||||
mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override {
|
||||
RefPtr<nsFrameSelection> frameSelection =
|
||||
mFrame->PresShell()->FrameSelection();
|
||||
return !frameSelection->IsInTableSelectionMode();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
|
||||
if (ShouldPaintBordersAndBackgrounds()) {
|
||||
// display outset box-shadows if we need to.
|
||||
bool hasBoxShadow = !StyleEffects()->mBoxShadow.IsEmpty();
|
||||
if (hasBoxShadow) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayBoxShadowOuter>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this);
|
||||
|
||||
// display background if we need to.
|
||||
AppendedBackgroundType result = AppendedBackgroundType::None;
|
||||
if (aBuilder->IsForEventDelivery() ||
|
||||
!StyleBackground()->IsTransparent(this) ||
|
||||
StyleDisplay()->HasAppearance()) {
|
||||
result = nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, this, bgRect, aLists.BorderBackground());
|
||||
}
|
||||
|
||||
if (result == AppendedBackgroundType::None) {
|
||||
aBuilder->BuildCompositorHitTestInfoIfNeeded(this,
|
||||
aLists.BorderBackground());
|
||||
}
|
||||
|
||||
// display inset box-shadows if we need to.
|
||||
if (hasBoxShadow) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayBoxShadowInner>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
// display borders if we need to
|
||||
ProcessBorders(GetTableFrame(), aBuilder, aLists);
|
||||
|
||||
// and display the selection border if we need to
|
||||
if (IsSelected()) {
|
||||
aLists.BorderBackground()->AppendNewToTop<nsDisplayTableCellSelection>(
|
||||
aBuilder, this);
|
||||
}
|
||||
|
||||
// This can be null if display list building initiated in the middle
|
||||
// of the table, which can happen with background-clip:text and
|
||||
// -moz-element.
|
||||
nsDisplayTableBackgroundSet* backgrounds =
|
||||
aBuilder->GetTableBackgroundSet();
|
||||
if (backgrounds) {
|
||||
// Compute bgRect relative to reference frame, but using the
|
||||
// normal (without position:relative offsets) positions for the
|
||||
// cell, row and row group.
|
||||
bgRect = GetRectRelativeToSelf() + GetNormalPosition();
|
||||
|
||||
nsTableRowFrame* row = GetTableRowFrame();
|
||||
bgRect += row->GetNormalPosition();
|
||||
|
||||
nsTableRowGroupFrame* rowGroup = row->GetTableRowGroupFrame();
|
||||
bgRect += rowGroup->GetNormalPosition();
|
||||
|
||||
bgRect += backgrounds->TableToReferenceFrame();
|
||||
|
||||
// Create backgrounds items as needed for the column and column
|
||||
// group that this cell occupies.
|
||||
nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex());
|
||||
nsTableColGroupFrame* colGroup = col->GetTableColGroupFrame();
|
||||
|
||||
Maybe<nsDisplayListBuilder::AutoBuildingDisplayList> buildingForColGroup;
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, colGroup, bgRect, backgrounds->ColGroupBackgrounds(), false,
|
||||
nullptr, colGroup->GetRect() + backgrounds->TableToReferenceFrame(),
|
||||
this, &buildingForColGroup);
|
||||
|
||||
Maybe<nsDisplayListBuilder::AutoBuildingDisplayList> buildingForCol;
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, col, bgRect, backgrounds->ColBackgrounds(), false, nullptr,
|
||||
col->GetRect() + colGroup->GetPosition() +
|
||||
backgrounds->TableToReferenceFrame(),
|
||||
this, &buildingForCol);
|
||||
}
|
||||
}
|
||||
|
||||
// the 'empty-cells' property has no effect on 'outline'
|
||||
DisplayOutline(aBuilder, aLists);
|
||||
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
NS_ASSERTION(kid && !kid->GetNextSibling(),
|
||||
"Table cells should have just one child");
|
||||
// The child's background will go in our BorderBackground() list.
|
||||
// This isn't a problem since it won't have a real background except for
|
||||
// event handling. We do not call BuildDisplayListForNonBlockChildren
|
||||
// because that/ would put the child's background in the Content() list
|
||||
// which isn't right (e.g., would end up on top of our child floats for
|
||||
// event handling).
|
||||
BuildDisplayListForChild(aBuilder, kid, aLists);
|
||||
}
|
||||
|
|
|
@ -1128,118 +1128,12 @@ void nsTableFrame::GetChildLists(nsTArray<ChildList>* aLists) const {
|
|||
mColGroups.AppendIfNonempty(aLists, kColGroupList);
|
||||
}
|
||||
|
||||
nsRect nsDisplayTableItem::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const {
|
||||
*aSnap = false;
|
||||
return mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||
}
|
||||
|
||||
void nsDisplayTableItem::UpdateForFrameBackground(nsIFrame* aFrame) {
|
||||
ComputedStyle* bgSC;
|
||||
if (!nsCSSRendering::FindBackground(aFrame, &bgSC)) return;
|
||||
if (!bgSC->StyleBackground()->HasFixedBackground(aFrame)) return;
|
||||
|
||||
mPartHasFixedBackground = true;
|
||||
}
|
||||
|
||||
nsDisplayItemGeometry* nsDisplayTableItem::AllocateGeometry(
|
||||
nsDisplayListBuilder* aBuilder) {
|
||||
return new nsDisplayTableItemGeometry(
|
||||
this, aBuilder, mFrame->GetOffsetTo(mFrame->PresShell()->GetRootFrame()));
|
||||
}
|
||||
|
||||
void nsDisplayTableItem::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const {
|
||||
auto geometry = static_cast<const nsDisplayTableItemGeometry*>(aGeometry);
|
||||
|
||||
bool invalidateForAttachmentFixed = false;
|
||||
if (mDrawsBackground && mPartHasFixedBackground) {
|
||||
nsPoint frameOffsetToViewport =
|
||||
mFrame->GetOffsetTo(mFrame->PresShell()->GetRootFrame());
|
||||
invalidateForAttachmentFixed =
|
||||
frameOffsetToViewport != geometry->mFrameOffsetToViewport;
|
||||
}
|
||||
|
||||
if (invalidateForAttachmentFixed ||
|
||||
(aBuilder->ShouldSyncDecodeImages() &&
|
||||
geometry->ShouldInvalidateToSyncDecodeImages())) {
|
||||
bool snap;
|
||||
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||
}
|
||||
|
||||
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||
}
|
||||
|
||||
nsDisplayTableBackgroundSet::nsDisplayTableBackgroundSet(
|
||||
nsDisplayListBuilder* aBuilder, nsIFrame* aTable)
|
||||
: mBuilder(aBuilder) {
|
||||
mPrevTableBackgroundSet = mBuilder->SetTableBackgroundSet(this);
|
||||
mozilla::DebugOnly<const nsIFrame*> reference =
|
||||
mBuilder->FindReferenceFrameFor(aTable, &mToReferenceFrame);
|
||||
MOZ_ASSERT(nsLayoutUtils::FindNearestCommonAncestorFrame(reference, aTable));
|
||||
mDirtyRect = mBuilder->GetDirtyRect();
|
||||
}
|
||||
|
||||
// A display item that draws all collapsed borders for a table.
|
||||
// At some point, we may want to find a nicer partitioning for dividing
|
||||
// border-collapse segments into their own display items.
|
||||
class nsDisplayTableBorderCollapse final : public nsDisplayTableItem {
|
||||
public:
|
||||
nsDisplayTableBorderCollapse(nsDisplayListBuilder* aBuilder,
|
||||
nsTableFrame* aFrame)
|
||||
: nsDisplayTableItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTableBorderCollapse);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableBorderCollapse)
|
||||
|
||||
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
bool CreateWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override;
|
||||
NS_DISPLAY_DECL_NAME("TableBorderCollapse", TYPE_TABLE_BORDER_COLLAPSE)
|
||||
};
|
||||
|
||||
void nsDisplayTableBorderCollapse::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
nsPoint pt = ToReferenceFrame();
|
||||
DrawTarget* drawTarget = aCtx->GetDrawTarget();
|
||||
|
||||
gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(
|
||||
pt, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
// XXX we should probably get rid of this translation at some stage
|
||||
// But that would mean modifying PaintBCBorders, ugh
|
||||
AutoRestoreTransform autoRestoreTransform(drawTarget);
|
||||
drawTarget->SetTransform(
|
||||
drawTarget->GetTransform().PreTranslate(ToPoint(devPixelOffset)));
|
||||
|
||||
static_cast<nsTableFrame*>(mFrame)->PaintBCBorders(*drawTarget,
|
||||
GetPaintRect() - pt);
|
||||
}
|
||||
|
||||
bool nsDisplayTableBorderCollapse::CreateWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
static_cast<nsTableFrame*>(mFrame)->CreateWebRenderCommandsForBCBorders(
|
||||
aBuilder, aSc, GetPaintRect(), ToReferenceFrame());
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool FrameHasBorder(nsIFrame* f) {
|
||||
if (!f->StyleVisibility()->IsVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (f->StyleBorder()->HasBorder()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return f->StyleBorder()->HasBorder();
|
||||
}
|
||||
|
||||
void nsTableFrame::CalcHasBCBorders() {
|
||||
|
@ -1299,6 +1193,10 @@ void nsTableFrame::CalcHasBCBorders() {
|
|||
SetHasBCBorders(false);
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayTableBorderCollapse;
|
||||
}
|
||||
|
||||
// table paint code is concerned primarily with borders and bg color
|
||||
// SEC: TODO: adjust the rect for captions
|
||||
void nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -7562,3 +7460,109 @@ void nsTableFrame::UpdateStyleOfOwnedAnonBoxesForTableWrapper(
|
|||
MOZ_ASSERT(!aWrapperFrame->HasAnyStateBits(NS_FRAME_OWNS_ANON_BOXES),
|
||||
"Wrapper frame doesn't have any anon boxes of its own!");
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
nsRect nsDisplayTableItem::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
bool* aSnap) const {
|
||||
*aSnap = false;
|
||||
return mFrame->InkOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||
}
|
||||
|
||||
void nsDisplayTableItem::UpdateForFrameBackground(nsIFrame* aFrame) {
|
||||
ComputedStyle* bgSC;
|
||||
if (!nsCSSRendering::FindBackground(aFrame, &bgSC)) return;
|
||||
if (!bgSC->StyleBackground()->HasFixedBackground(aFrame)) return;
|
||||
|
||||
mPartHasFixedBackground = true;
|
||||
}
|
||||
|
||||
nsDisplayItemGeometry* nsDisplayTableItem::AllocateGeometry(
|
||||
nsDisplayListBuilder* aBuilder) {
|
||||
return new nsDisplayTableItemGeometry(
|
||||
this, aBuilder, mFrame->GetOffsetTo(mFrame->PresShell()->GetRootFrame()));
|
||||
}
|
||||
|
||||
void nsDisplayTableItem::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion) const {
|
||||
auto geometry = static_cast<const nsDisplayTableItemGeometry*>(aGeometry);
|
||||
|
||||
bool invalidateForAttachmentFixed = false;
|
||||
if (mDrawsBackground && mPartHasFixedBackground) {
|
||||
nsPoint frameOffsetToViewport =
|
||||
mFrame->GetOffsetTo(mFrame->PresShell()->GetRootFrame());
|
||||
invalidateForAttachmentFixed =
|
||||
frameOffsetToViewport != geometry->mFrameOffsetToViewport;
|
||||
}
|
||||
|
||||
if (invalidateForAttachmentFixed ||
|
||||
(aBuilder->ShouldSyncDecodeImages() &&
|
||||
geometry->ShouldInvalidateToSyncDecodeImages())) {
|
||||
bool snap;
|
||||
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
|
||||
}
|
||||
|
||||
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||
}
|
||||
|
||||
nsDisplayTableBackgroundSet::nsDisplayTableBackgroundSet(
|
||||
nsDisplayListBuilder* aBuilder, nsIFrame* aTable)
|
||||
: mBuilder(aBuilder) {
|
||||
mPrevTableBackgroundSet = mBuilder->SetTableBackgroundSet(this);
|
||||
mozilla::DebugOnly<const nsIFrame*> reference =
|
||||
mBuilder->FindReferenceFrameFor(aTable, &mToReferenceFrame);
|
||||
MOZ_ASSERT(nsLayoutUtils::FindNearestCommonAncestorFrame(reference, aTable));
|
||||
mDirtyRect = mBuilder->GetDirtyRect();
|
||||
}
|
||||
|
||||
// A display item that draws all collapsed borders for a table.
|
||||
// At some point, we may want to find a nicer partitioning for dividing
|
||||
// border-collapse segments into their own display items.
|
||||
class nsDisplayTableBorderCollapse final : public nsDisplayTableItem {
|
||||
public:
|
||||
nsDisplayTableBorderCollapse(nsDisplayListBuilder* aBuilder,
|
||||
nsTableFrame* aFrame)
|
||||
: nsDisplayTableItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTableBorderCollapse);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayTableBorderCollapse)
|
||||
|
||||
void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
|
||||
bool CreateWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) override;
|
||||
NS_DISPLAY_DECL_NAME("TableBorderCollapse", TYPE_TABLE_BORDER_COLLAPSE)
|
||||
};
|
||||
|
||||
void nsDisplayTableBorderCollapse::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
nsPoint pt = ToReferenceFrame();
|
||||
DrawTarget* drawTarget = aCtx->GetDrawTarget();
|
||||
|
||||
gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(
|
||||
pt, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
// XXX we should probably get rid of this translation at some stage
|
||||
// But that would mean modifying PaintBCBorders, ugh
|
||||
AutoRestoreTransform autoRestoreTransform(drawTarget);
|
||||
drawTarget->SetTransform(
|
||||
drawTarget->GetTransform().PreTranslate(ToPoint(devPixelOffset)));
|
||||
|
||||
static_cast<nsTableFrame*>(mFrame)->PaintBCBorders(*drawTarget,
|
||||
GetPaintRect() - pt);
|
||||
}
|
||||
|
||||
bool nsDisplayTableBorderCollapse::CreateWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources,
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
static_cast<nsTableFrame*>(mFrame)->CreateWebRenderCommandsForBCBorders(
|
||||
aBuilder, aSc, GetPaintRect(), ToReferenceFrame());
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "TableArea.h"
|
||||
|
||||
struct BCPaintBorderAction;
|
||||
struct BCPropertyData;
|
||||
class nsTableCellFrame;
|
||||
class nsTableCellMap;
|
||||
class nsTableColFrame;
|
||||
|
@ -23,17 +24,17 @@ class nsTableRowGroupFrame;
|
|||
class nsTableRowFrame;
|
||||
class nsTableColGroupFrame;
|
||||
class nsITableLayoutStrategy;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class LogicalMargin;
|
||||
class PresShell;
|
||||
class WritingMode;
|
||||
struct TableReflowInput;
|
||||
|
||||
namespace layers {
|
||||
class StackingContextHelper;
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
struct BCPropertyData;
|
||||
|
||||
class nsDisplayTableItem : public nsPaintedDisplayItem {
|
||||
public:
|
||||
|
@ -111,6 +112,8 @@ class nsDisplayTableBackgroundSet {
|
|||
nsRect mDirtyRect;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
/* ========================================================================== */
|
||||
|
||||
enum nsTableColType {
|
||||
|
|
|
@ -956,7 +956,7 @@ void nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// Wrap the list to make it its own layer
|
||||
aLists.Content()->AppendNewToTopWithIndex<nsDisplayOwnLayer>(
|
||||
aBuilder, this, /* aIndex = */ nsDisplayOwnLayer::OwnLayerForBoxFrame,
|
||||
&masterList, ownLayerASR, nsDisplayOwnLayerFlags::None,
|
||||
&masterList, ownLayerASR, mozilla::nsDisplayOwnLayerFlags::None,
|
||||
mozilla::layers::ScrollbarData{}, true, true);
|
||||
}
|
||||
}
|
||||
|
@ -1005,6 +1005,8 @@ nsresult nsBoxFrame::LayoutChildAt(nsBoxLayoutState& aState, nsIFrame* aBox,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* This wrapper class lets us redirect mouse hits from descendant frames
|
||||
* of a menu to the menu itself, if they didn't specify 'allowevents'.
|
||||
|
@ -1087,6 +1089,8 @@ void nsDisplayXULEventRedirector::HitTest(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
class nsXULEventRedirectorWrapper final : public nsDisplayItemWrapper {
|
||||
public:
|
||||
explicit nsXULEventRedirectorWrapper(nsIFrame* aTargetFrame)
|
||||
|
|
|
@ -16,9 +16,8 @@
|
|||
class imgRequestProxy;
|
||||
class nsImageBoxFrame;
|
||||
|
||||
class nsDisplayXULImage;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayXULImage;
|
||||
class PresShell;
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -43,7 +42,7 @@ class nsImageBoxFrame final : public nsLeafBoxFrame {
|
|||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
typedef mozilla::layers::LayerManager LayerManager;
|
||||
|
||||
friend class nsDisplayXULImage;
|
||||
friend class mozilla::nsDisplayXULImage;
|
||||
NS_DECL_FRAMEARENA_HELPERS(nsImageBoxFrame)
|
||||
NS_DECL_QUERYFRAME
|
||||
|
||||
|
@ -155,6 +154,7 @@ class nsImageBoxFrame final : public nsLeafBoxFrame {
|
|||
bool mSuppressStyleCheck;
|
||||
}; // class nsImageBoxFrame
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayXULImage final : public nsDisplayImageContainer {
|
||||
public:
|
||||
nsDisplayXULImage(nsDisplayListBuilder* aBuilder, nsImageBoxFrame* aFrame)
|
||||
|
@ -195,4 +195,6 @@ class nsDisplayXULImage final : public nsDisplayImageContainer {
|
|||
NS_DISPLAY_DECL_NAME("XULImage", TYPE_XUL_IMAGE)
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* nsImageBoxFrame_h___ */
|
||||
|
|
|
@ -227,6 +227,8 @@ nsresult nsSliderFrame::AttributeChanged(int32_t aNameSpaceID,
|
|||
return rv;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Draw any tick marks that show the position of find in page results.
|
||||
class nsDisplaySliderMarks final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
|
@ -355,6 +357,8 @@ void nsDisplaySliderMarks::Paint(nsDisplayListBuilder* aBuilder,
|
|||
PaintMarks(aBuilder, nullptr, aCtx);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (aBuilder->IsForEventDelivery() && isDraggingThumb()) {
|
||||
|
|
|
@ -19,6 +19,7 @@ class nsITimer;
|
|||
class nsSliderFrame;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplaySliderMarks;
|
||||
class PresShell;
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -47,7 +48,7 @@ class nsSliderFrame final : public nsBoxFrame {
|
|||
NS_DECL_QUERYFRAME
|
||||
|
||||
friend class nsSliderMediator;
|
||||
friend class nsDisplaySliderMarks;
|
||||
friend class mozilla::nsDisplaySliderMarks;
|
||||
|
||||
explicit nsSliderFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
|
||||
virtual ~nsSliderFrame();
|
||||
|
|
|
@ -224,6 +224,8 @@ void nsTextBoxFrame::UpdateAttributes(nsAtom* aAttribute, bool& aResize,
|
|||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayXULTextBox final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayXULTextBox(nsDisplayListBuilder* aBuilder, nsTextBoxFrame* aFrame)
|
||||
|
@ -322,6 +324,8 @@ nsRect nsDisplayXULTextBox::GetComponentAlphaBounds(
|
|||
ToReferenceFrame();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsTextBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
if (!IsVisibleForPainting()) return;
|
||||
|
|
|
@ -14,6 +14,7 @@ class nsAsyncAccesskeyUpdate;
|
|||
class nsFontMetrics;
|
||||
|
||||
namespace mozilla {
|
||||
class nsDisplayXULTextBox;
|
||||
class PresShell;
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -63,7 +64,7 @@ class nsTextBoxFrame final : public nsLeafBoxFrame {
|
|||
|
||||
protected:
|
||||
friend class nsAsyncAccesskeyUpdate;
|
||||
friend class nsDisplayXULTextBox;
|
||||
friend class mozilla::nsDisplayXULTextBox;
|
||||
// Should be called only by nsAsyncAccesskeyUpdate.
|
||||
// Returns true if accesskey was updated.
|
||||
bool UpdateAccesskey(WeakFrame& aWeakThis);
|
||||
|
|
|
@ -2480,6 +2480,8 @@ nsresult nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayTreeBody final : public nsPaintedDisplayItem {
|
||||
public:
|
||||
nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
|
@ -2541,6 +2543,8 @@ class nsDisplayTreeBody final : public nsPaintedDisplayItem {
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
static bool IsInSourceList(nsIFrame* aFrame) {
|
||||
for (nsIFrame* frame = aFrame; frame;
|
||||
|
|
|
@ -49,67 +49,6 @@ void nsTreeColFrame::DestroyFrom(nsIFrame* aDestructRoot,
|
|||
nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
|
||||
}
|
||||
|
||||
class nsDisplayXULTreeColSplitterTarget final : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayXULTreeColSplitterTarget(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame)
|
||||
: nsDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayXULTreeColSplitterTarget);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayXULTreeColSplitterTarget)
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames) override;
|
||||
NS_DISPLAY_DECL_NAME("XULTreeColSplitterTarget",
|
||||
TYPE_XUL_TREE_COL_SPLITTER_TARGET)
|
||||
};
|
||||
|
||||
void nsDisplayXULTreeColSplitterTarget::HitTest(
|
||||
nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames) {
|
||||
nsRect rect = aRect - ToReferenceFrame();
|
||||
// If we are in either in the first 4 pixels or the last 4 pixels, we're going
|
||||
// to do something really strange. Check for an adjacent splitter.
|
||||
bool left = false;
|
||||
bool right = false;
|
||||
if (mFrame->GetSize().width - nsPresContext::CSSPixelsToAppUnits(4) <=
|
||||
rect.XMost()) {
|
||||
right = true;
|
||||
} else if (nsPresContext::CSSPixelsToAppUnits(4) > rect.x) {
|
||||
left = true;
|
||||
}
|
||||
|
||||
// Swap left and right for RTL trees in order to find the correct splitter
|
||||
if (mFrame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
std::swap(left, right);
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
nsIFrame* child = nsBoxFrame::SlowOrdinalGroupAwareSibling(mFrame, right);
|
||||
// We are a header. Look for the correct splitter.
|
||||
if (child && child->GetContent()->IsXULElement(nsGkAtoms::splitter)) {
|
||||
aOutFrames->AppendElement(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsTreeColFrame::BuildDisplayListForChildren(
|
||||
nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
|
||||
if (!aBuilder->IsForEventDelivery()) {
|
||||
nsBoxFrame::BuildDisplayListForChildren(aBuilder, aLists);
|
||||
return;
|
||||
}
|
||||
|
||||
nsDisplayListCollection set(aBuilder);
|
||||
nsBoxFrame::BuildDisplayListForChildren(aBuilder, set);
|
||||
|
||||
WrapListsInRedirector(aBuilder, set, aLists);
|
||||
|
||||
aLists.Content()->AppendNewToTop<nsDisplayXULTreeColSplitterTarget>(aBuilder,
|
||||
this);
|
||||
}
|
||||
|
||||
nsresult nsTreeColFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
nsAtom* aAttribute,
|
||||
int32_t aModType) {
|
||||
|
@ -163,3 +102,68 @@ void nsTreeColFrame::InvalidateColumns(bool aCanWalkFrameTree) {
|
|||
|
||||
columns->InvalidateColumns();
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class nsDisplayXULTreeColSplitterTarget final : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayXULTreeColSplitterTarget(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame)
|
||||
: nsDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayXULTreeColSplitterTarget);
|
||||
}
|
||||
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayXULTreeColSplitterTarget)
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames) override;
|
||||
NS_DISPLAY_DECL_NAME("XULTreeColSplitterTarget",
|
||||
TYPE_XUL_TREE_COL_SPLITTER_TARGET)
|
||||
};
|
||||
|
||||
void nsDisplayXULTreeColSplitterTarget::HitTest(
|
||||
nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState,
|
||||
nsTArray<nsIFrame*>* aOutFrames) {
|
||||
nsRect rect = aRect - ToReferenceFrame();
|
||||
// If we are in either in the first 4 pixels or the last 4 pixels, we're going
|
||||
// to do something really strange. Check for an adjacent splitter.
|
||||
bool left = false;
|
||||
bool right = false;
|
||||
if (mFrame->GetSize().width - nsPresContext::CSSPixelsToAppUnits(4) <=
|
||||
rect.XMost()) {
|
||||
right = true;
|
||||
} else if (nsPresContext::CSSPixelsToAppUnits(4) > rect.x) {
|
||||
left = true;
|
||||
}
|
||||
|
||||
// Swap left and right for RTL trees in order to find the correct splitter
|
||||
if (mFrame->StyleVisibility()->mDirection == StyleDirection::Rtl) {
|
||||
std::swap(left, right);
|
||||
}
|
||||
|
||||
if (left || right) {
|
||||
nsIFrame* child = nsBoxFrame::SlowOrdinalGroupAwareSibling(mFrame, right);
|
||||
// We are a header. Look for the correct splitter.
|
||||
if (child && child->GetContent()->IsXULElement(nsGkAtoms::splitter)) {
|
||||
aOutFrames->AppendElement(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void nsTreeColFrame::BuildDisplayListForChildren(
|
||||
nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
|
||||
if (!aBuilder->IsForEventDelivery()) {
|
||||
nsBoxFrame::BuildDisplayListForChildren(aBuilder, aLists);
|
||||
return;
|
||||
}
|
||||
|
||||
nsDisplayListCollection set(aBuilder);
|
||||
nsBoxFrame::BuildDisplayListForChildren(aBuilder, set);
|
||||
|
||||
WrapListsInRedirector(aBuilder, set, aLists);
|
||||
|
||||
aLists.Content()->AppendNewToTop<nsDisplayXULTreeColSplitterTarget>(aBuilder,
|
||||
this);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче