mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 22:05:40 +00:00
Bug 1352234 - Make nsImageRenderer.cpp and nsCSSRenderingGradients.h compile independent of build unification. r=rhunt
A few includes and namespace annotations are missing. And nsImageRenderer.cpp is calling two functions that are static functions in nsCSSRendering.cpp. MozReview-Commit-ID: BLVPwpKB7On --HG-- extra : rebase_source : d6111d093de47b88b5beba6478de4b6ed75b2a52
This commit is contained in:
parent
d4487752ce
commit
079ae63547
@ -2906,11 +2906,8 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
|
||||
return positionArea;
|
||||
}
|
||||
|
||||
// Implementation of the formula for computation of background-repeat round
|
||||
// See http://dev.w3.org/csswg/css3-background/#the-background-size
|
||||
// This function returns the adjusted size of the background image.
|
||||
static nscoord
|
||||
ComputeRoundedSize(nscoord aCurrentSize, nscoord aPositioningSize)
|
||||
/* static */ nscoord
|
||||
nsCSSRendering::ComputeRoundedSize(nscoord aCurrentSize, nscoord aPositioningSize)
|
||||
{
|
||||
float repeatCount = NS_roundf(float(aPositioningSize) / float(aCurrentSize));
|
||||
if (repeatCount < 1.0f) {
|
||||
@ -2971,7 +2968,9 @@ ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
// Calculate the rounded size only if the background-size computation
|
||||
// returned a correct size for the image.
|
||||
if (imageSize.width && aXRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND) {
|
||||
imageSize.width = ComputeRoundedSize(imageSize.width, aBgPositioningArea.width);
|
||||
imageSize.width =
|
||||
nsCSSRendering::ComputeRoundedSize(imageSize.width,
|
||||
aBgPositioningArea.width);
|
||||
if (!isRepeatRoundInBothDimensions &&
|
||||
aLayerSize.mHeightType == nsStyleImageLayers::Size::DimensionType::eAuto) {
|
||||
// Restore intrinsic rato
|
||||
@ -2985,7 +2984,9 @@ ComputeDrawnSizeForBackground(const CSSSizeOrRatio& aIntrinsicSize,
|
||||
// Calculate the rounded size only if the background-size computation
|
||||
// returned a correct size for the image.
|
||||
if (imageSize.height && aYRepeat == NS_STYLE_IMAGELAYER_REPEAT_ROUND) {
|
||||
imageSize.height = ComputeRoundedSize(imageSize.height, aBgPositioningArea.height);
|
||||
imageSize.height =
|
||||
nsCSSRendering::ComputeRoundedSize(imageSize.height,
|
||||
aBgPositioningArea.height);
|
||||
if (!isRepeatRoundInBothDimensions &&
|
||||
aLayerSize.mWidthType == nsStyleImageLayers::Size::DimensionType::eAuto) {
|
||||
// Restore intrinsic rato
|
||||
@ -3020,16 +3021,10 @@ ComputeSpacedRepeatSize(nscoord aImageDimension,
|
||||
}
|
||||
}
|
||||
|
||||
/* ComputeBorderSpacedRepeatSize
|
||||
* aImageDimension: the image width/height
|
||||
* aAvailableSpace: the background positioning area width/height
|
||||
* aSpace: the space between each image
|
||||
* Returns the image size plus gap size of app units for use as spacing
|
||||
*/
|
||||
static nscoord
|
||||
ComputeBorderSpacedRepeatSize(nscoord aImageDimension,
|
||||
nscoord aAvailableSpace,
|
||||
nscoord& aSpace)
|
||||
/* static */ nscoord
|
||||
nsCSSRendering::ComputeBorderSpacedRepeatSize(nscoord aImageDimension,
|
||||
nscoord aAvailableSpace,
|
||||
nscoord& aSpace)
|
||||
{
|
||||
int32_t count = aAvailableSpace / aImageDimension;
|
||||
aSpace = (aAvailableSpace - aImageDimension * count) / (count + 1);
|
||||
|
@ -337,6 +337,23 @@ struct nsCSSRendering {
|
||||
nsIFrame** aAttachedToFrame,
|
||||
bool* aOutTransformedFixed);
|
||||
|
||||
// Implementation of the formula for computation of background-repeat round
|
||||
// See http://dev.w3.org/csswg/css3-background/#the-background-size
|
||||
// This function returns the adjusted size of the background image.
|
||||
static nscoord
|
||||
ComputeRoundedSize(nscoord aCurrentSize, nscoord aPositioningSize);
|
||||
|
||||
/* ComputeBorderSpacedRepeatSize
|
||||
* aImageDimension: the image width/height
|
||||
* aAvailableSpace: the background positioning area width/height
|
||||
* aSpace: the space between each image
|
||||
* Returns the image size plus gap size of app units for use as spacing
|
||||
*/
|
||||
static nscoord
|
||||
ComputeBorderSpacedRepeatSize(nscoord aImageDimension,
|
||||
nscoord aAvailableSpace,
|
||||
nscoord& aSpace);
|
||||
|
||||
static nsBackgroundLayerState
|
||||
PrepareImageLayer(nsPresContext* aPresContext,
|
||||
nsIFrame* aForFrame,
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "nsStyleStruct.h"
|
||||
#include "Units.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -25,11 +26,11 @@ class DisplayListBuilder;
|
||||
// a color.
|
||||
struct ColorStop {
|
||||
ColorStop(): mPosition(0), mIsMidpoint(false) {}
|
||||
ColorStop(double aPosition, bool aIsMidPoint, const Color& aColor) :
|
||||
ColorStop(double aPosition, bool aIsMidPoint, const gfx::Color& aColor) :
|
||||
mPosition(aPosition), mIsMidpoint(aIsMidPoint), mColor(aColor) {}
|
||||
double mPosition; // along the gradient line; 0=start, 1=end
|
||||
bool mIsMidpoint;
|
||||
Color mColor;
|
||||
gfx::Color mColor;
|
||||
};
|
||||
|
||||
class nsCSSGradientRenderer final {
|
||||
|
@ -6,10 +6,25 @@
|
||||
|
||||
/* utility functions for drawing borders and backgrounds */
|
||||
|
||||
#include "nsImageRenderer.h"
|
||||
#include "nsCSSRenderingGradients.h"
|
||||
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
|
||||
#include "gfxDrawable.h"
|
||||
#include "ImageOps.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsImageRenderer.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::image;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
nsSize
|
||||
CSSSizeOrRatio::ComputeConcreteSize() const
|
||||
{
|
||||
@ -719,14 +734,16 @@ ComputeTile(nsRect& aFill,
|
||||
break;
|
||||
case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
|
||||
tile.x = aFill.x;
|
||||
tile.width = ComputeRoundedSize(aUnitSize.width, aFill.width);
|
||||
tile.width = nsCSSRendering::ComputeRoundedSize(aUnitSize.width,
|
||||
aFill.width);
|
||||
aRepeatSize.width = tile.width;
|
||||
break;
|
||||
case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
|
||||
{
|
||||
nscoord space;
|
||||
aRepeatSize.width =
|
||||
ComputeBorderSpacedRepeatSize(aUnitSize.width, aFill.width, space);
|
||||
nsCSSRendering::ComputeBorderSpacedRepeatSize(aUnitSize.width,
|
||||
aFill.width, space);
|
||||
tile.x = aFill.x + space;
|
||||
tile.width = aUnitSize.width;
|
||||
aFill.x = tile.x;
|
||||
@ -750,14 +767,16 @@ ComputeTile(nsRect& aFill,
|
||||
break;
|
||||
case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
|
||||
tile.y = aFill.y;
|
||||
tile.height = ComputeRoundedSize(aUnitSize.height, aFill.height);
|
||||
tile.height = nsCSSRendering::ComputeRoundedSize(aUnitSize.height,
|
||||
aFill.height);
|
||||
aRepeatSize.height = tile.height;
|
||||
break;
|
||||
case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
|
||||
{
|
||||
nscoord space;
|
||||
aRepeatSize.height =
|
||||
ComputeBorderSpacedRepeatSize(aUnitSize.height, aFill.height, space);
|
||||
nsCSSRendering::ComputeBorderSpacedRepeatSize(aUnitSize.height,
|
||||
aFill.height, space);
|
||||
tile.y = aFill.y + space;
|
||||
tile.height = aUnitSize.height;
|
||||
aFill.y = tile.y;
|
||||
|
Loading…
x
Reference in New Issue
Block a user