зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1817071 - Remove -moz-image-region support from layout. r=layout-reviewers,tnikkel
There are no users of non-auto values, so we can just simplify some code and remove the property. Differential Revision: https://phabricator.services.mozilla.com/D170010
This commit is contained in:
Родитель
1bdd81f84a
Коммит
5f6910e75e
|
@ -310,7 +310,6 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
|||
"font-stretch",
|
||||
"font-variation-settings",
|
||||
"font-weight",
|
||||
"-moz-image-region",
|
||||
"mask-position-x",
|
||||
"mask-position-y",
|
||||
"mask-size",
|
||||
|
|
|
@ -782,22 +782,6 @@ exports.CSS_PROPERTIES = {
|
|||
"unset"
|
||||
]
|
||||
},
|
||||
"-moz-image-region": {
|
||||
"isInherited": true,
|
||||
"subproperties": [
|
||||
"-moz-image-region"
|
||||
],
|
||||
"supports": [],
|
||||
"values": [
|
||||
"auto",
|
||||
"inherit",
|
||||
"initial",
|
||||
"rect",
|
||||
"revert",
|
||||
"revert-layer",
|
||||
"unset"
|
||||
]
|
||||
},
|
||||
"-moz-margin-end": {
|
||||
"isInherited": false,
|
||||
"subproperties": [
|
||||
|
@ -3142,7 +3126,6 @@ exports.CSS_PROPERTIES = {
|
|||
"list-style-type",
|
||||
"list-style-image",
|
||||
"quotes",
|
||||
"-moz-image-region",
|
||||
"margin-top",
|
||||
"margin-right",
|
||||
"margin-bottom",
|
||||
|
|
|
@ -6424,8 +6424,7 @@ ImgDrawResult nsLayoutUtils::DrawSingleImage(
|
|||
gfxContext& aContext, nsPresContext* aPresContext, imgIContainer* aImage,
|
||||
SamplingFilter aSamplingFilter, const nsRect& aDest, const nsRect& aDirty,
|
||||
const SVGImageContext& aSVGContext, uint32_t aImageFlags,
|
||||
const nsPoint* aAnchorPoint, const nsRect* aSourceArea) {
|
||||
nscoord appUnitsPerCSSPixel = AppUnitsPerCSSPixel();
|
||||
const nsPoint* aAnchorPoint) {
|
||||
// NOTE(emilio): We can hardcode resolution to 1 here, since we're interested
|
||||
// in the actual image pixels, for snapping purposes, not on the adjusted
|
||||
// size.
|
||||
|
@ -6437,35 +6436,18 @@ ImgDrawResult nsLayoutUtils::DrawSingleImage(
|
|||
return ImgDrawResult::SUCCESS; // no point in drawing a zero size image
|
||||
}
|
||||
|
||||
nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize));
|
||||
nsRect source;
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
if (aSourceArea) {
|
||||
source = *aSourceArea;
|
||||
nsIntRect subRect(source.x, source.y, source.width, source.height);
|
||||
subRect.ScaleInverseRoundOut(appUnitsPerCSSPixel);
|
||||
image = ImageOps::Clip(aImage, subRect);
|
||||
|
||||
nsRect imageRect;
|
||||
imageRect.SizeTo(imageSize);
|
||||
nsRect clippedSource = imageRect.Intersect(source);
|
||||
|
||||
source -= clippedSource.TopLeft();
|
||||
imageSize = clippedSource.Size();
|
||||
} else {
|
||||
source.SizeTo(imageSize);
|
||||
image = aImage;
|
||||
}
|
||||
|
||||
nsRect dest = GetWholeImageDestination(imageSize, source, aDest);
|
||||
const nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize));
|
||||
const nsRect source(nsPoint(), imageSize);
|
||||
const nsRect dest = GetWholeImageDestination(imageSize, source, aDest);
|
||||
|
||||
// Ensure that only a single image tile is drawn. If aSourceArea extends
|
||||
// outside the image bounds, we want to honor the aSourceArea-to-aDest
|
||||
// transform but we don't want to actually tile the image.
|
||||
nsRect fill;
|
||||
fill.IntersectRect(aDest, dest);
|
||||
return DrawImageInternal(aContext, aPresContext, image, aSamplingFilter, dest,
|
||||
fill, aAnchorPoint ? *aAnchorPoint : fill.TopLeft(),
|
||||
return DrawImageInternal(aContext, aPresContext, aImage, aSamplingFilter,
|
||||
dest, fill,
|
||||
aAnchorPoint ? *aAnchorPoint : fill.TopLeft(),
|
||||
aDirty, aSVGContext, aImageFlags);
|
||||
}
|
||||
|
||||
|
|
|
@ -1951,17 +1951,12 @@ class nsLayoutUtils {
|
|||
* variety.
|
||||
* @param aAnchor If non-null, a point which we will ensure
|
||||
* is pixel-aligned in the output.
|
||||
* @param aSourceArea If non-null, this area is extracted from
|
||||
* the image and drawn in aDest. It's
|
||||
* in appunits. For best results it should
|
||||
* be aligned with image pixels.
|
||||
*/
|
||||
static ImgDrawResult DrawSingleImage(
|
||||
gfxContext& aContext, nsPresContext* aPresContext, imgIContainer* aImage,
|
||||
SamplingFilter aSamplingFilter, const nsRect& aDest, const nsRect& aDirty,
|
||||
const mozilla::SVGImageContext& aSVGContext, uint32_t aImageFlags,
|
||||
const nsPoint* aAnchorPoint = nullptr,
|
||||
const nsRect* aSourceArea = nullptr);
|
||||
const nsPoint* aAnchorPoint = nullptr);
|
||||
|
||||
/**
|
||||
* Given an imgIContainer, this method attempts to obtain an intrinsic
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<vbox style="height:204px; border:2px solid blue;" flex="0">
|
||||
<vbox style="border:2px solid blue;" flex="0">
|
||||
<image style="list-style-image: url(mozilla-banner.gif);"/>
|
||||
</vbox>
|
||||
<vbox/>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<image style="border:2px solid blue; list-style-image: url(mozilla-banner.gif); -moz-image-region: rect(0 600px 200px 0);"/>
|
||||
<image style="border:2px solid blue; list-style-image: url(mozilla-banner.gif);"/>
|
||||
</window>
|
||||
|
|
|
@ -1203,7 +1203,7 @@ fuzzy(0-1,0-34360) == 461512-1.html 461512-1-ref.html
|
|||
== 462844-3.html 462844-ref.html
|
||||
== 462844-4.html 462844-ref.html
|
||||
== 463204-1.html 463204-1-ref.html
|
||||
fuzzy-if(!useDrawSnapshot,16-16,3345-4100) == chrome://reftest/content/bugs/463217-1.xhtml chrome://reftest/content/bugs/463217-1-ref.xhtml
|
||||
== chrome://reftest/content/bugs/463217-1.xhtml chrome://reftest/content/bugs/463217-1-ref.xhtml
|
||||
== 463952-1.html 463952-1-ref.html
|
||||
== 464811-1.html 464811-1-ref.html
|
||||
== 465574-1.html 465574-1-ref.html # bug 421436
|
||||
|
|
Двоичные данные
layout/reftests/image-region/image-region-ref.png
Двоичные данные
layout/reftests/image-region/image-region-ref.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 174 B |
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<?xml-stylesheet href="image-region.css" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="main"
|
||||
class="reftest-image-region">
|
||||
<hbox id="ref">
|
||||
<image id="image1" />
|
||||
<hbox style="-moz-box-flex: 1000" />
|
||||
</hbox>
|
||||
</window>
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
hbox#test > image {
|
||||
list-style-image: url("image-region.png");
|
||||
}
|
||||
|
||||
hbox#test > #image1 {
|
||||
-moz-image-region: rect(1px, 19px, 9px, 1px);
|
||||
}
|
||||
|
||||
hbox#ref > image {
|
||||
list-style-image: none;
|
||||
}
|
||||
|
||||
hbox#ref > #image1 {
|
||||
list-style-image: url("image-region-ref.png");
|
||||
}
|
Двоичные данные
layout/reftests/image-region/image-region.png
Двоичные данные
layout/reftests/image-region/image-region.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 189 B |
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/licenses/publicdomain/
|
||||
-->
|
||||
<?xml-stylesheet href="image-region.css" type="text/css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="main"
|
||||
class="reftest-image-region">
|
||||
<hbox id="test">
|
||||
<image id="image1" />
|
||||
<hbox style="-moz-box-flex: 1000" />
|
||||
</hbox>
|
||||
</window>
|
|
@ -1 +0,0 @@
|
|||
== chrome://reftest/content/image-region/image-region.xhtml chrome://reftest/content/image-region/image-region-ref.xhtml
|
|
@ -243,9 +243,6 @@ include image-element/reftest.list
|
|||
# image-rect/
|
||||
include image-rect/reftest.list
|
||||
|
||||
# image-region/
|
||||
include image-region/reftest.list
|
||||
|
||||
# indic shaping with harfbuzz
|
||||
include indic-shaping/reftest.list
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ function run()
|
|||
body { display: none } /* so we control the order of the ComputeListData calls */
|
||||
|
||||
#s1, #s2, #s3 {
|
||||
-moz-image-region: auto;
|
||||
list-style-image: none;
|
||||
list-style-position: outside;
|
||||
list-style-type: disc;
|
||||
|
|
|
@ -601,8 +601,7 @@ nsChangeHint nsStyleOutline::CalcDifference(
|
|||
nsStyleList::nsStyleList(const Document& aDocument)
|
||||
: mListStylePosition(StyleListStylePosition::Outside),
|
||||
mQuotes(StyleQuotes::Auto()),
|
||||
mListStyleImage(StyleImage::None()),
|
||||
mImageRegion(StyleClipRectOrAuto::Auto()) {
|
||||
mListStyleImage(StyleImage::None()) {
|
||||
MOZ_COUNT_CTOR(nsStyleList);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -615,8 +614,7 @@ nsStyleList::nsStyleList(const nsStyleList& aSource)
|
|||
: mListStylePosition(aSource.mListStylePosition),
|
||||
mCounterStyle(aSource.mCounterStyle),
|
||||
mQuotes(aSource.mQuotes),
|
||||
mListStyleImage(aSource.mListStyleImage),
|
||||
mImageRegion(aSource.mImageRegion) {
|
||||
mListStyleImage(aSource.mListStyleImage) {
|
||||
MOZ_COUNT_CTOR(nsStyleList);
|
||||
}
|
||||
|
||||
|
@ -656,14 +654,6 @@ nsChangeHint nsStyleList::CalcDifference(
|
|||
if (mListStyleImage != aNewData.mListStyleImage) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
if (mImageRegion != aNewData.mImageRegion) {
|
||||
nsRect region = GetImageRegion();
|
||||
nsRect newRegion = aNewData.GetImageRegion();
|
||||
if (region.width != newRegion.width || region.height != newRegion.height) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
return hint;
|
||||
}
|
||||
|
||||
|
|
|
@ -708,13 +708,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList {
|
|||
nsChangeHint CalcDifference(const nsStyleList& aNewData,
|
||||
const nsStyleDisplay& aOldDisplay) const;
|
||||
|
||||
nsRect GetImageRegion() const {
|
||||
if (!mImageRegion.IsRect()) {
|
||||
return nsRect();
|
||||
}
|
||||
return mImageRegion.AsRect().ToLayoutRect(0);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIURI> GetListStyleImageURI() const;
|
||||
|
||||
mozilla::StyleListStylePosition mListStylePosition;
|
||||
|
@ -722,9 +715,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList {
|
|||
mozilla::CounterStylePtr mCounterStyle;
|
||||
mozilla::StyleQuotes mQuotes;
|
||||
mozilla::StyleImage mListStyleImage;
|
||||
|
||||
// the rect to use within an image.
|
||||
mozilla::StyleClipRectOrAuto mImageRegion;
|
||||
};
|
||||
|
||||
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePage {
|
||||
|
|
|
@ -2872,14 +2872,6 @@ var gCSSProperties = {
|
|||
other_values: ["1"],
|
||||
invalid_values: [],
|
||||
},
|
||||
"-moz-image-region": {
|
||||
domProp: "MozImageRegion",
|
||||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: ["auto"],
|
||||
other_values: ["rect(3px 20px 15px 4px)", "rect(17px, 21px, 33px, 2px)"],
|
||||
invalid_values: ["rect(17px, 21px, 33, 2px)"],
|
||||
},
|
||||
"margin-inline": {
|
||||
domProp: "marginInline",
|
||||
inherited: false,
|
||||
|
|
|
@ -86,7 +86,6 @@ var supported_properties = {
|
|||
test_length_unclamped, test_percent_unclamped ],
|
||||
"cy": [ test_length_transition, test_percent_transition,
|
||||
test_length_unclamped, test_percent_unclamped ],
|
||||
"-moz-image-region": [ test_rect_transition ],
|
||||
"background-color": [ test_color_transition,
|
||||
test_currentcolor_transition ],
|
||||
"background-position": [ test_background_position_transition,
|
||||
|
|
|
@ -69,7 +69,6 @@ using namespace mozilla::image;
|
|||
using namespace mozilla::layers;
|
||||
|
||||
using mozilla::dom::Document;
|
||||
using mozilla::dom::Element;
|
||||
using mozilla::dom::ReferrerInfo;
|
||||
|
||||
class nsImageBoxFrameEvent : public Runnable {
|
||||
|
@ -347,14 +346,12 @@ ImgDrawResult nsImageBoxFrame::PaintImage(gfxContext& aRenderingContext,
|
|||
return ImgDrawResult::TEMPORARY_ERROR;
|
||||
}
|
||||
|
||||
bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0);
|
||||
|
||||
SVGImageContext svgContext;
|
||||
SVGImageContext::MaybeStoreContextPaint(svgContext, this, imgCon);
|
||||
return nsLayoutUtils::DrawSingleImage(
|
||||
aRenderingContext, PresContext(), imgCon,
|
||||
nsLayoutUtils::GetSamplingFilterForFrame(this), dest, dirty, svgContext,
|
||||
aFlags, anchorPoint.ptrOr(nullptr), hasSubRect ? &mSubRect : nullptr);
|
||||
aFlags, anchorPoint.ptrOr(nullptr));
|
||||
}
|
||||
|
||||
ImgDrawResult nsImageBoxFrame::CreateWebRenderCommands(
|
||||
|
@ -500,13 +497,7 @@ bool nsDisplayXULImage::CreateWebRenderCommands(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool nsImageBoxFrame::CanOptimizeToImageLayer() {
|
||||
bool hasSubRect = !mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0);
|
||||
if (hasSubRect) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool nsImageBoxFrame::CanOptimizeToImageLayer() { return true; }
|
||||
|
||||
const mozilla::StyleImage* nsImageBoxFrame::GetImageFromStyle(
|
||||
const ComputedStyle& aStyle) const {
|
||||
|
@ -545,9 +536,6 @@ void nsImageBoxFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
|||
nsLeafBoxFrame::DidSetComputedStyle(aOldStyle);
|
||||
|
||||
// Fetch our subrect.
|
||||
const nsStyleList* myList = StyleList();
|
||||
mSubRect = myList->GetImageRegion(); // before |mSuppressStyleCheck| test!
|
||||
|
||||
if (mUseSrcAttr || mSuppressStyleCheck) {
|
||||
return; // No more work required, since the image isn't specified by style.
|
||||
}
|
||||
|
@ -575,19 +563,14 @@ void nsImageBoxFrame::GetImageSize() {
|
|||
* Ok return our dimensions
|
||||
*/
|
||||
nsSize nsImageBoxFrame::GetXULPrefSize(nsBoxLayoutState& aState) {
|
||||
nsSize size(0, 0);
|
||||
nsSize size;
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
if (XULNeedsRecalc(mImageSize)) {
|
||||
GetImageSize();
|
||||
}
|
||||
|
||||
if (!mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0)) {
|
||||
size = mSubRect.Size();
|
||||
} else {
|
||||
size = mImageSize;
|
||||
}
|
||||
|
||||
nsSize intrinsicSize = size;
|
||||
size = mImageSize;
|
||||
const nsSize intrinsicSize = size;
|
||||
|
||||
nsMargin borderPadding(0, 0, 0, 0);
|
||||
GetXULBorderAndPadding(borderPadding);
|
||||
|
|
|
@ -127,8 +127,6 @@ class nsImageBoxFrame final : public nsLeafBoxFrame {
|
|||
void OnImageIsAnimated(imgIRequest* aRequest);
|
||||
void OnFrameUpdate(imgIRequest* aRequest);
|
||||
|
||||
nsRect mSubRect; ///< If set, indicates that only the portion of the image
|
||||
///< specified by the rect should be used.
|
||||
nsSize mIntrinsicSize;
|
||||
nsSize mImageSize;
|
||||
|
||||
|
|
|
@ -96,20 +96,4 @@ div div { background: blue; display: inline; float: left; }
|
|||
src="image4x3.png" style="box-sizing: border-box; width: 112px; height: 88px; padding: 8px;"/>
|
||||
</html:div>
|
||||
|
||||
<html:div><html:div
|
||||
style="width: 20px; height: 15px;"/><html:div
|
||||
style="width: 80px; height: 60px;"/><html:div
|
||||
style="width: 40px; height: 30px;"/><html:div
|
||||
style="width: 10px; height: 8px;"/><html:div
|
||||
style="width: 10px; height: 8px;"/>
|
||||
</html:div>
|
||||
|
||||
<html:div><html:div style="width: 20px; height: 15px;"/></html:div>
|
||||
|
||||
<html:div><html:div style="width: 20px; height: 15px;"/></html:div>
|
||||
|
||||
<html:div><html:div style="box-sizing: border-box; width: 24px; height: 22px; border: 8px solid green;"/></html:div>
|
||||
|
||||
<html:div><html:div style="box-sizing: border-box; width: 24px; height: 22px; border: 8px solid green;"/></html:div>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -91,29 +91,4 @@
|
|||
<image src="image4x3.png" style="min-width: 90px; min-height: 76px; padding: 8px;"/>
|
||||
<image src="image4x3.png" style="min-width: 112px; min-height: 76px; padding: 8px;"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="start">
|
||||
<image style="width: auto; height: auto; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px);"/>
|
||||
<image style="width: 80px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px);"/>
|
||||
<image style="height: 30px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px);"/>
|
||||
<image style="width: 10px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 21px, 5px);"/>
|
||||
<image style="height: 8px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 21px, 5px);"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="end">
|
||||
<image style="max-width: 20px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px);"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="end">
|
||||
<image style="max-height: 15px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px);"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="end">
|
||||
<image style="width: 24px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px); border: 8px solid green;"/>
|
||||
</hbox>
|
||||
|
||||
<hbox align="end">
|
||||
<image style="max-height: 22px; list-style-image: url(image4x3.png); -moz-image-region: rect(5px, 25px, 20px, 5px); border: 8px solid green;"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1797,18 +1797,14 @@ nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
|
|||
nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
|
||||
bool aUseContext,
|
||||
ComputedStyle* aComputedStyle,
|
||||
bool& aAllowImageRegions,
|
||||
imgIContainer** aResult) {
|
||||
*aResult = nullptr;
|
||||
|
||||
nsAutoString imageSrc;
|
||||
mView->GetImageSrc(aRowIndex, aCol, imageSrc);
|
||||
RefPtr<imgRequestProxy> styleRequest;
|
||||
if (!aUseContext && !imageSrc.IsEmpty()) {
|
||||
aAllowImageRegions = false;
|
||||
} else {
|
||||
if (aUseContext || imageSrc.IsEmpty()) {
|
||||
// Obtain the URL from the ComputedStyle.
|
||||
aAllowImageRegions = true;
|
||||
styleRequest =
|
||||
aComputedStyle->StyleList()->mListStyleImage.GetImageRequest();
|
||||
if (!styleRequest) return NS_OK;
|
||||
|
@ -1927,24 +1923,13 @@ nsRect nsTreeBodyFrame::GetImageSize(int32_t aRowIndex, nsTreeColumn* aCol,
|
|||
|
||||
// We have to load image even though we already have a size.
|
||||
// Don't change this, otherwise things start to go awry.
|
||||
bool useImageRegion = true;
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aCol, aUseContext, aComputedStyle, useImageRegion,
|
||||
getter_AddRefs(image));
|
||||
GetImage(aRowIndex, aCol, aUseContext, aComputedStyle, getter_AddRefs(image));
|
||||
|
||||
const nsStylePosition* myPosition = aComputedStyle->StylePosition();
|
||||
const nsStyleList* myList = aComputedStyle->StyleList();
|
||||
nsRect imageRegion = myList->GetImageRegion();
|
||||
if (useImageRegion) {
|
||||
r.x += imageRegion.x;
|
||||
r.y += imageRegion.y;
|
||||
}
|
||||
|
||||
if (myPosition->mWidth.ConvertsToLength()) {
|
||||
int32_t val = myPosition->mWidth.ToLength();
|
||||
r.width += val;
|
||||
} else if (useImageRegion && imageRegion.width > 0) {
|
||||
r.width += imageRegion.width;
|
||||
} else {
|
||||
needWidth = true;
|
||||
}
|
||||
|
@ -1952,10 +1937,9 @@ nsRect nsTreeBodyFrame::GetImageSize(int32_t aRowIndex, nsTreeColumn* aCol,
|
|||
if (myPosition->mHeight.ConvertsToLength()) {
|
||||
int32_t val = myPosition->mHeight.ToLength();
|
||||
r.height += val;
|
||||
} else if (useImageRegion && imageRegion.height > 0)
|
||||
r.height += imageRegion.height;
|
||||
else
|
||||
} else {
|
||||
needHeight = true;
|
||||
}
|
||||
|
||||
if (image) {
|
||||
if (needWidth || needHeight) {
|
||||
|
@ -1991,7 +1975,6 @@ nsRect nsTreeBodyFrame::GetImageSize(int32_t aRowIndex, nsTreeColumn* aCol,
|
|||
// If only the destination height has been specified in CSS, the width is
|
||||
// calculated to maintain the aspect ratio of the image.
|
||||
nsSize nsTreeBodyFrame::GetImageDestSize(ComputedStyle* aComputedStyle,
|
||||
bool useImageRegion,
|
||||
imgIContainer* image) {
|
||||
nsSize size(0, 0);
|
||||
|
||||
|
@ -2022,24 +2005,10 @@ nsSize nsTreeBodyFrame::GetImageDestSize(ComputedStyle* aComputedStyle,
|
|||
if (needWidth || needHeight) {
|
||||
// We need to get the size of the image/region.
|
||||
nsSize imageSize(0, 0);
|
||||
|
||||
const nsStyleList* myList = aComputedStyle->StyleList();
|
||||
nsRect imageRegion = myList->GetImageRegion();
|
||||
if (useImageRegion && imageRegion.width > 0) {
|
||||
// CSS has specified an image region.
|
||||
// Use the width of the image region.
|
||||
imageSize.width = imageRegion.width;
|
||||
} else if (image) {
|
||||
if (image) {
|
||||
nscoord width;
|
||||
image->GetWidth(&width);
|
||||
imageSize.width = nsPresContext::CSSPixelsToAppUnits(width);
|
||||
}
|
||||
|
||||
if (useImageRegion && imageRegion.height > 0) {
|
||||
// CSS has specified an image region.
|
||||
// Use the height of the image region.
|
||||
imageSize.height = imageRegion.height;
|
||||
} else if (image) {
|
||||
nscoord height;
|
||||
image->GetHeight(&height);
|
||||
imageSize.height = nsPresContext::CSSPixelsToAppUnits(height);
|
||||
|
@ -2079,14 +2048,7 @@ nsSize nsTreeBodyFrame::GetImageDestSize(ComputedStyle* aComputedStyle,
|
|||
// The width and height do not reflect the destination size specified
|
||||
// in CSS.
|
||||
nsRect nsTreeBodyFrame::GetImageSourceRect(ComputedStyle* aComputedStyle,
|
||||
bool useImageRegion,
|
||||
imgIContainer* image) {
|
||||
const nsStyleList* myList = aComputedStyle->StyleList();
|
||||
// CSS has specified an image region.
|
||||
if (useImageRegion && myList->mImageRegion.IsRect()) {
|
||||
return myList->GetImageRegion();
|
||||
}
|
||||
|
||||
if (!image) {
|
||||
return nsRect();
|
||||
}
|
||||
|
@ -3158,9 +3120,7 @@ ImgDrawResult nsTreeBodyFrame::PaintTwisty(
|
|||
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
bool useImageRegion = true;
|
||||
GetImage(aRowIndex, aColumn, true, twistyContext, useImageRegion,
|
||||
getter_AddRefs(image));
|
||||
GetImage(aRowIndex, aColumn, true, twistyContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint anchorPoint = twistyRect.TopLeft();
|
||||
|
||||
|
@ -3210,13 +3170,11 @@ ImgDrawResult nsTreeBodyFrame::PaintImage(
|
|||
imageRect.Deflate(imageMargin);
|
||||
|
||||
// Get the image.
|
||||
bool useImageRegion = true;
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
GetImage(aRowIndex, aColumn, false, imageContext, useImageRegion,
|
||||
getter_AddRefs(image));
|
||||
GetImage(aRowIndex, aColumn, false, imageContext, getter_AddRefs(image));
|
||||
|
||||
// Get the image destination size.
|
||||
nsSize imageDestSize = GetImageDestSize(imageContext, useImageRegion, image);
|
||||
nsSize imageDestSize = GetImageDestSize(imageContext, image);
|
||||
if (!imageDestSize.width || !imageDestSize.height) {
|
||||
return ImgDrawResult::SUCCESS;
|
||||
}
|
||||
|
@ -3300,8 +3258,7 @@ ImgDrawResult nsTreeBodyFrame::PaintImage(
|
|||
// Get the image source rectangle - the rectangle containing the part of
|
||||
// the image that we are going to display. sourceRect will be passed as
|
||||
// the aSrcRect argument in the DrawImage method.
|
||||
nsRect sourceRect =
|
||||
GetImageSourceRect(imageContext, useImageRegion, image);
|
||||
nsRect sourceRect = GetImageSourceRect(imageContext, image);
|
||||
|
||||
// Let's say that the image is 100 pixels tall and that the CSS has
|
||||
// specified that the destination height should be 50 pixels tall. Let's
|
||||
|
@ -3530,9 +3487,7 @@ ImgDrawResult nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
|
|||
|
||||
// Get the image for drawing.
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
bool useImageRegion = true;
|
||||
GetImage(aRowIndex, aColumn, true, checkboxContext, useImageRegion,
|
||||
getter_AddRefs(image));
|
||||
GetImage(aRowIndex, aColumn, true, checkboxContext, getter_AddRefs(image));
|
||||
if (image) {
|
||||
nsPoint pt = checkboxRect.TopLeft();
|
||||
|
||||
|
|
|
@ -307,8 +307,7 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame,
|
|||
|
||||
// Fetch an image from the image cache.
|
||||
nsresult GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContext,
|
||||
ComputedStyle* aComputedStyle, bool& aAllowImageRegions,
|
||||
imgIContainer** aResult);
|
||||
ComputedStyle* aComputedStyle, imgIContainer** aResult);
|
||||
|
||||
// Returns the size of a given image. This size *includes* border and
|
||||
// padding. It does not include margins.
|
||||
|
@ -317,12 +316,10 @@ class nsTreeBodyFrame final : public nsLeafBoxFrame,
|
|||
|
||||
// Returns the destination size of the image, not including borders and
|
||||
// padding.
|
||||
nsSize GetImageDestSize(ComputedStyle* aComputedStyle, bool useImageRegion,
|
||||
imgIContainer* image);
|
||||
nsSize GetImageDestSize(ComputedStyle*, imgIContainer*);
|
||||
|
||||
// Returns the source rectangle of the image to be displayed.
|
||||
nsRect GetImageSourceRect(ComputedStyle* aComputedStyle, bool useImageRegion,
|
||||
imgIContainer* image);
|
||||
nsRect GetImageSourceRect(ComputedStyle*, imgIContainer*);
|
||||
|
||||
// Returns the height of rows in the tree.
|
||||
int32_t GetRowHeight();
|
||||
|
|
|
@ -73,14 +73,3 @@ ${helpers.predefined_type(
|
|||
spec="https://drafts.csswg.org/css-content/#propdef-quotes",
|
||||
servo_restyle_damage="rebuild_and_reflow",
|
||||
)}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"-moz-image-region",
|
||||
"ClipRectOrAuto",
|
||||
"computed::ClipRectOrAuto::auto()",
|
||||
engines="gecko",
|
||||
gecko_ffi_name="mImageRegion",
|
||||
animation_value_type="ComputedValue",
|
||||
boxed=True,
|
||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-image-region)",
|
||||
)}
|
||||
|
|
Загрузка…
Ссылка в новой задаче