summaryrefslogtreecommitdiffstats
path: root/layout/xul
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /layout/xul
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/xul')
-rw-r--r--layout/xul/tree/crashtests/crashtests.list2
-rw-r--r--layout/xul/tree/nsTreeBodyFrame.cpp316
-rw-r--r--layout/xul/tree/nsTreeBodyFrame.h8
3 files changed, 135 insertions, 191 deletions
diff --git a/layout/xul/tree/crashtests/crashtests.list b/layout/xul/tree/crashtests/crashtests.list
index 0b79916cd2..1644c61bf2 100644
--- a/layout/xul/tree/crashtests/crashtests.list
+++ b/layout/xul/tree/crashtests/crashtests.list
@@ -13,5 +13,5 @@ load 399715-1.xhtml
load chrome://reftest/content/crashtests/layout/xul/tree/crashtests/414170-1.xhtml
load 479931-1.xhtml
load 585815.html
-skip-if(wayland) pref(widget.windows.window_occlusion_tracking.enabled,false) load 601427.html # Bug 1819154, wayland: Bug 1857258
+load 601427.html
load chrome://reftest/content/crashtests/layout/xul/tree/crashtests/730441-3.xhtml
diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp
index f585009600..a7eba30f8b 100644
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -47,13 +47,11 @@
#include "nsContainerFrame.h"
#include "nsView.h"
#include "nsViewManager.h"
-#include "nsVariant.h"
#include "nsWidgetsCID.h"
#include "nsIFrameInlines.h"
#include "nsTreeContentView.h"
#include "nsTreeUtils.h"
#include "nsStyleConsts.h"
-#include "nsITheme.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "mozilla/dom/NodeInfo.h"
@@ -1711,115 +1709,133 @@ void nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex,
mScratchArray.Clear();
// focus
- if (mFocused)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::focus);
- else
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::blur);
+ if (mFocused) {
+ mScratchArray.AppendElement(nsGkAtoms::focus);
+ } else {
+ mScratchArray.AppendElement(nsGkAtoms::blur);
+ }
// sort
bool sorted = false;
mView->IsSorted(&sorted);
- if (sorted) mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::sorted);
+ if (sorted) {
+ mScratchArray.AppendElement(nsGkAtoms::sorted);
+ }
// drag session
- if (mSlots && mSlots->mIsDragging)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dragSession);
+ if (mSlots && mSlots->mIsDragging) {
+ mScratchArray.AppendElement(nsGkAtoms::dragSession);
+ }
if (aRowIndex != -1) {
- if (aRowIndex == mMouseOverRow)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::hover);
+ if (aRowIndex == mMouseOverRow) {
+ mScratchArray.AppendElement(nsGkAtoms::hover);
+ }
nsCOMPtr<nsITreeSelection> selection = GetSelection();
if (selection) {
// selected
bool isSelected;
selection->IsSelected(aRowIndex, &isSelected);
- if (isSelected)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::selected);
+ if (isSelected) {
+ mScratchArray.AppendElement(nsGkAtoms::selected);
+ }
// current
int32_t currentIndex;
selection->GetCurrentIndex(&currentIndex);
- if (aRowIndex == currentIndex)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::current);
+ if (aRowIndex == currentIndex) {
+ mScratchArray.AppendElement(nsGkAtoms::current);
+ }
}
// container or leaf
bool isContainer = false;
mView->IsContainer(aRowIndex, &isContainer);
if (isContainer) {
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::container);
+ mScratchArray.AppendElement(nsGkAtoms::container);
// open or closed
bool isOpen = false;
mView->IsContainerOpen(aRowIndex, &isOpen);
- if (isOpen)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::open);
- else
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::closed);
+ if (isOpen) {
+ mScratchArray.AppendElement(nsGkAtoms::open);
+ } else {
+ mScratchArray.AppendElement(nsGkAtoms::closed);
+ }
} else {
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::leaf);
+ mScratchArray.AppendElement(nsGkAtoms::leaf);
}
// drop orientation
if (mSlots && mSlots->mDropAllowed && mSlots->mDropRow == aRowIndex) {
- if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropBefore);
- else if (mSlots->mDropOrient == nsITreeView::DROP_ON)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropOn);
- else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropAfter);
+ if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE) {
+ mScratchArray.AppendElement(nsGkAtoms::dropBefore);
+ } else if (mSlots->mDropOrient == nsITreeView::DROP_ON) {
+ mScratchArray.AppendElement(nsGkAtoms::dropOn);
+ } else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER) {
+ mScratchArray.AppendElement(nsGkAtoms::dropAfter);
+ }
}
// odd or even
- if (aRowIndex % 2)
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::odd);
- else
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::even);
+ if (aRowIndex % 2) {
+ mScratchArray.AppendElement(nsGkAtoms::odd);
+ } else {
+ mScratchArray.AppendElement(nsGkAtoms::even);
+ }
XULTreeElement* tree = GetBaseElement();
if (tree && tree->HasAttr(nsGkAtoms::editing)) {
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::editing);
+ mScratchArray.AppendElement(nsGkAtoms::editing);
}
// multiple columns
- if (mColumns->GetColumnAt(1))
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::multicol);
+ if (mColumns->GetColumnAt(1)) {
+ mScratchArray.AppendElement(nsGkAtoms::multicol);
+ }
}
if (aCol) {
mScratchArray.AppendElement(aCol->GetAtom());
- if (aCol->IsPrimary())
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::primary);
+ if (aCol->IsPrimary()) {
+ mScratchArray.AppendElement(nsGkAtoms::primary);
+ }
if (aCol->GetType() == TreeColumn_Binding::TYPE_CHECKBOX) {
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checkbox);
+ mScratchArray.AppendElement(nsGkAtoms::checkbox);
if (aRowIndex != -1) {
nsAutoString value;
mView->GetCellValue(aRowIndex, aCol, value);
- if (value.EqualsLiteral("true"))
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checked);
+ if (value.EqualsLiteral("true")) {
+ mScratchArray.AppendElement(nsGkAtoms::checked);
+ }
}
}
+ if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::ordinal,
+ u"1"_ns, eIgnoreCase)) {
+ mScratchArray.AppendElement(nsGkAtoms::firstColumn);
+ }
+
// Read special properties from attributes on the column content node
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertbefore,
- nsGkAtoms::_true, eCaseMatters))
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertbefore);
+ nsGkAtoms::_true, eCaseMatters)) {
+ mScratchArray.AppendElement(nsGkAtoms::insertbefore);
+ }
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertafter,
- nsGkAtoms::_true, eCaseMatters))
- mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertafter);
+ nsGkAtoms::_true, eCaseMatters)) {
+ mScratchArray.AppendElement(nsGkAtoms::insertafter);
+ }
}
}
-nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
- nsTreeColumn* aColumn,
- nsRect& aImageRect,
- nsRect& aTwistyRect,
- nsPresContext* aPresContext,
- ComputedStyle* aTwistyContext) {
+void nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
+ nsRect& aImageRect, nsRect& aTwistyRect,
+ nsPresContext* aPresContext,
+ ComputedStyle* aTwistyContext) {
// The twisty rect extends all the way to the end of the cell. This is
// incorrect. We need to determine the twisty rect's true width. This is
// done by examining the ComputedStyle for a width first. If it has one, we
@@ -1828,40 +1844,14 @@ nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
// a -moz-appearance involved, adjust the rect by the minimum widget size
// provided by the theme implementation.
aImageRect = GetImageSize(aRowIndex, aColumn, true, aTwistyContext);
- if (aImageRect.height > aTwistyRect.height)
+ if (aImageRect.height > aTwistyRect.height) {
aImageRect.height = aTwistyRect.height;
- if (aImageRect.width > aTwistyRect.width)
+ }
+ if (aImageRect.width > aTwistyRect.width) {
aImageRect.width = aTwistyRect.width;
- else
+ } else {
aTwistyRect.width = aImageRect.width;
-
- bool useTheme = false;
- nsITheme* theme = nullptr;
- StyleAppearance appearance =
- aTwistyContext->StyleDisplay()->EffectiveAppearance();
- if (appearance != StyleAppearance::None) {
- theme = aPresContext->Theme();
- if (theme->ThemeSupportsWidget(aPresContext, nullptr, appearance))
- useTheme = true;
- }
-
- if (useTheme) {
- LayoutDeviceIntSize minTwistySizePx =
- theme->GetMinimumWidgetSize(aPresContext, this, appearance);
-
- // GMWS() returns size in pixels, we need to convert it back to app units
- nsSize minTwistySize;
- minTwistySize.width =
- aPresContext->DevPixelsToAppUnits(minTwistySizePx.width);
- minTwistySize.height =
- aPresContext->DevPixelsToAppUnits(minTwistySizePx.height);
-
- if (aTwistyRect.width < minTwistySize.width) {
- aTwistyRect.width = minTwistySize.width;
- }
}
-
- return useTheme ? theme : nullptr;
}
nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
@@ -2693,21 +2683,8 @@ ImgDrawResult nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint our borders and background for our row rect.
- nsITheme* theme = nullptr;
- auto appearance = rowContext->StyleDisplay()->EffectiveAppearance();
- if (appearance != StyleAppearance::None) {
- theme = aPresContext->Theme();
- }
-
- if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, appearance)) {
- nsRect dirty;
- dirty.IntersectRect(rowRect, aDirtyRect);
- theme->DrawWidgetBackground(&aRenderingContext, this, appearance, rowRect,
- dirty);
- } else {
- result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
- rowRect, aDirtyRect);
- }
+ result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
+ rowRect, aDirtyRect);
// Adjust the rect for its border and padding.
nsRect originalRowRect = rowRect;
@@ -2820,54 +2797,32 @@ ImgDrawResult nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
// Resolve style for the separator.
ComputedStyle* separatorContext =
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeSeparator());
- bool useTheme = false;
- nsITheme* theme = nullptr;
- StyleAppearance appearance =
- separatorContext->StyleDisplay()->EffectiveAppearance();
- if (appearance != StyleAppearance::None) {
- theme = aPresContext->Theme();
- if (theme->ThemeSupportsWidget(aPresContext, nullptr, appearance))
- useTheme = true;
- }
- ImgDrawResult result = ImgDrawResult::SUCCESS;
+ const nsStylePosition* stylePosition = separatorContext->StylePosition();
- // use -moz-appearance if provided.
- if (useTheme) {
- nsRect dirty;
- dirty.IntersectRect(aSeparatorRect, aDirtyRect);
- theme->DrawWidgetBackground(&aRenderingContext, this, appearance,
- aSeparatorRect, dirty);
+ // Obtain the height for the separator or use the default value.
+ nscoord height;
+ if (stylePosition->mHeight.ConvertsToLength()) {
+ height = stylePosition->mHeight.ToLength();
} else {
- const nsStylePosition* stylePosition = separatorContext->StylePosition();
-
- // Obtain the height for the separator or use the default value.
- nscoord height;
- if (stylePosition->mHeight.ConvertsToLength()) {
- height = stylePosition->mHeight.ToLength();
- } else {
- // Use default height 2px.
- height = nsPresContext::CSSPixelsToAppUnits(2);
- }
-
- // Obtain the margins for the separator and then deflate our rect by that
- // amount. The separator is assumed to be contained within the deflated
- // rect.
- nsRect separatorRect(aSeparatorRect.x, aSeparatorRect.y,
- aSeparatorRect.width, height);
- nsMargin separatorMargin;
- separatorContext->StyleMargin()->GetMargin(separatorMargin);
- separatorRect.Deflate(separatorMargin);
+ // Use default height 2px.
+ height = nsPresContext::CSSPixelsToAppUnits(2);
+ }
- // Center the separator.
- separatorRect.y += (aSeparatorRect.height - height) / 2;
+ // Obtain the margins for the separator and then deflate our rect by that
+ // amount. The separator is assumed to be contained within the deflated
+ // rect.
+ nsRect separatorRect(aSeparatorRect.x, aSeparatorRect.y, aSeparatorRect.width,
+ height);
+ nsMargin separatorMargin;
+ separatorContext->StyleMargin()->GetMargin(separatorMargin);
+ separatorRect.Deflate(separatorMargin);
- result &=
- PaintBackgroundLayer(separatorContext, aPresContext, aRenderingContext,
- separatorRect, aDirtyRect);
- }
+ // Center the separator.
+ separatorRect.y += (aSeparatorRect.height - height) / 2;
- return result;
+ return PaintBackgroundLayer(separatorContext, aPresContext, aRenderingContext,
+ separatorRect, aDirtyRect);
}
ImgDrawResult nsTreeBodyFrame::PaintCell(
@@ -3084,68 +3039,57 @@ ImgDrawResult nsTreeBodyFrame::PaintTwisty(
twistyRect.Deflate(twistyMargin);
nsRect imageSize;
- nsITheme* theme = GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect,
- aPresContext, twistyContext);
+ GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, aPresContext,
+ twistyContext);
// Subtract out the remaining width. This is done even when we don't actually
// paint a twisty in this cell, so that cells in different rows still line up.
nsRect copyRect(twistyRect);
copyRect.Inflate(twistyMargin);
aRemainingWidth -= copyRect.width;
- if (!isRTL) aCurrX += copyRect.width;
+ if (!isRTL) {
+ aCurrX += copyRect.width;
+ }
- ImgDrawResult result = ImgDrawResult::SUCCESS;
+ auto result = ImgDrawResult::SUCCESS;
+ if (!shouldPaint) {
+ return result;
+ }
+ // Paint our borders and background for our image rect.
+ result &= PaintBackgroundLayer(twistyContext, aPresContext, aRenderingContext,
+ twistyRect, aDirtyRect);
- if (shouldPaint) {
- // Paint our borders and background for our image rect.
- result &= PaintBackgroundLayer(twistyContext, aPresContext,
- aRenderingContext, twistyRect, aDirtyRect);
-
- if (theme) {
- if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
- // yeah, I know it says we're drawing a background, but a twisty is really
- // a fg object since it doesn't have anything that gecko would want to
- // draw over it. Besides, we have to prevent imagelib from drawing it.
- nsRect dirty;
- dirty.IntersectRect(twistyRect, aDirtyRect);
- theme->DrawWidgetBackground(
- &aRenderingContext, this,
- twistyContext->StyleDisplay()->EffectiveAppearance(), twistyRect,
- dirty);
- } else {
- // Time to paint the twisty.
- // Adjust the rect for its border and padding.
- nsMargin bp(0, 0, 0, 0);
- GetBorderPadding(twistyContext, bp);
- twistyRect.Deflate(bp);
- if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
- imageSize.Deflate(bp);
-
- // Get the image for drawing.
- nsCOMPtr<imgIContainer> image;
- GetImage(aRowIndex, aColumn, true, twistyContext, getter_AddRefs(image));
- if (image) {
- nsPoint anchorPoint = twistyRect.TopLeft();
-
- // Center the image. XXX Obey vertical-align style prop?
- if (imageSize.height < twistyRect.height) {
- anchorPoint.y += (twistyRect.height - imageSize.height) / 2;
- }
+ // Time to paint the twisty.
+ // Adjust the rect for its border and padding.
+ nsMargin bp;
+ GetBorderPadding(twistyContext, bp);
+ twistyRect.Deflate(bp);
+ if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
+ imageSize.Deflate(bp);
- // Apply context paint if applicable
- SVGImageContext svgContext;
- SVGImageContext::MaybeStoreContextPaint(svgContext, *aPresContext,
- *twistyContext, image);
+ // Get the image for drawing.
+ nsCOMPtr<imgIContainer> image;
+ GetImage(aRowIndex, aColumn, true, twistyContext, getter_AddRefs(image));
+ if (!image) {
+ return result;
+ }
+ nsPoint anchorPoint = twistyRect.TopLeft();
- // Paint the image.
- result &= nsLayoutUtils::DrawSingleUnscaledImage(
- aRenderingContext, aPresContext, image, SamplingFilter::POINT,
- anchorPoint, &aDirtyRect, svgContext, imgIContainer::FLAG_NONE,
- &imageSize);
- }
- }
+ // Center the image. XXX Obey vertical-align style prop?
+ if (imageSize.height < twistyRect.height) {
+ anchorPoint.y += (twistyRect.height - imageSize.height) / 2;
}
+ // Apply context paint if applicable
+ SVGImageContext svgContext;
+ SVGImageContext::MaybeStoreContextPaint(svgContext, *aPresContext,
+ *twistyContext, image);
+
+ // Paint the image.
+ result &= nsLayoutUtils::DrawSingleUnscaledImage(
+ aRenderingContext, aPresContext, image, SamplingFilter::POINT,
+ anchorPoint, &aDirtyRect, svgContext, imgIContainer::FLAG_NONE,
+ &imageSize);
return result;
}
diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h
index dd38644ad9..d7a9498ced 100644
--- a/layout/xul/tree/nsTreeBodyFrame.h
+++ b/layout/xul/tree/nsTreeBodyFrame.h
@@ -295,10 +295,10 @@ class nsTreeBodyFrame final : public mozilla::SimpleXULLeafFrame,
nsCSSAnonBoxPseudoStaticAtom** aChildElt);
// Retrieve the area for the twisty for a cell.
- nsITheme* GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
- nsRect& aImageRect, nsRect& aTwistyRect,
- nsPresContext* aPresContext,
- ComputedStyle* aTwistyContext);
+ void GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
+ nsRect& aImageRect, nsRect& aTwistyRect,
+ nsPresContext* aPresContext,
+ ComputedStyle* aTwistyContext);
// Fetch an image from the image cache.
nsresult GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContext,