2017-10-27 17:33:53 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
#ifndef NS_CSS_RENDERING_BORDERS_H
|
|
|
|
#define NS_CSS_RENDERING_BORDERS_H
|
|
|
|
|
2014-10-17 11:53:16 +00:00
|
|
|
#include "gfxRect.h"
|
2014-11-03 10:03:14 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-17 12:39:55 +00:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2015-08-06 02:42:09 +00:00
|
|
|
#include "mozilla/gfx/BezierUtils.h"
|
2014-11-01 10:45:10 +00:00
|
|
|
#include "mozilla/gfx/PathHelpers.h"
|
2015-10-18 05:24:48 +00:00
|
|
|
#include "mozilla/RefPtr.h"
|
2008-07-23 17:25:23 +00:00
|
|
|
#include "nsColor.h"
|
2014-10-17 11:53:16 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2017-03-13 03:46:04 +00:00
|
|
|
#include "nsIFrame.h"
|
2017-03-13 03:46:04 +00:00
|
|
|
#include "nsImageRenderer.h"
|
2017-03-09 08:58:38 +00:00
|
|
|
#include "gfxUtils.h"
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2014-10-17 11:53:16 +00:00
|
|
|
struct nsBorderColors;
|
2013-10-01 21:01:49 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
2021-07-19 11:28:20 +00:00
|
|
|
class nsDisplayItem;
|
|
|
|
class nsDisplayList;
|
|
|
|
class nsDisplayListBuilder;
|
|
|
|
|
|
|
|
class nsDisplayBorder;
|
|
|
|
class nsDisplayButtonBorder;
|
|
|
|
class nsDisplayButtonForeground;
|
|
|
|
class nsDisplayOutline;
|
2019-12-09 14:53:50 +00:00
|
|
|
|
|
|
|
enum class StyleBorderStyle : uint8_t;
|
|
|
|
enum class StyleBorderImageRepeat : uint8_t;
|
|
|
|
|
2013-10-01 21:01:49 +00:00
|
|
|
namespace gfx {
|
|
|
|
class GradientStops;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace gfx
|
2017-03-09 08:58:38 +00:00
|
|
|
namespace layers {
|
2017-05-03 12:48:08 +00:00
|
|
|
class StackingContextHelper;
|
2017-03-09 08:58:38 +00:00
|
|
|
} // namespace layers
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
// define this to enable a bunch of debug dump info
|
|
|
|
#undef DEBUG_NEW_BORDERS
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Helper class that handles border rendering.
|
|
|
|
*
|
2014-11-04 09:53:05 +00:00
|
|
|
* aDrawTarget -- the DrawTarget to which the border should be rendered
|
2008-07-23 17:25:23 +00:00
|
|
|
* outsideRect -- the rectangle on the outer edge of the border
|
2010-04-27 16:15:01 +00:00
|
|
|
*
|
2008-07-23 17:25:23 +00:00
|
|
|
* For any parameter where an array of side values is passed in,
|
|
|
|
* they are in top, right, bottom, left order.
|
|
|
|
*
|
|
|
|
* borderStyles -- one border style enum per side
|
|
|
|
* borderWidths -- one border width per side
|
2018-09-04 20:46:21 +00:00
|
|
|
* borderRadii -- a RectCornerRadii struct describing the w/h for each rounded
|
|
|
|
* corner. If the corner doesn't have a border radius, 0,0 should be given for
|
|
|
|
* it. borderColors -- one nscolor per side
|
2008-07-23 17:25:23 +00:00
|
|
|
*
|
|
|
|
* skipSides -- a bit mask specifying which sides, if any, to skip
|
|
|
|
* backgroundColor -- the background color of the element.
|
|
|
|
* Used in calculating colors for 2-tone borders, such as inset and outset
|
|
|
|
* gapRect - a rectangle that should be clipped out to leave a gap in a border,
|
2012-07-30 14:20:58 +00:00
|
|
|
* or nullptr if none.
|
2008-07-23 17:25:23 +00:00
|
|
|
*/
|
|
|
|
|
2008-07-23 17:25:51 +00:00
|
|
|
typedef enum {
|
|
|
|
BorderColorStyleNone,
|
|
|
|
BorderColorStyleSolid,
|
|
|
|
BorderColorStyleLight,
|
|
|
|
BorderColorStyleDark
|
|
|
|
} BorderColorStyle;
|
|
|
|
|
2016-06-10 04:10:03 +00:00
|
|
|
class nsPresContext;
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsCSSBorderRenderer final {
|
2015-08-06 02:42:09 +00:00
|
|
|
typedef mozilla::gfx::Bezier Bezier;
|
2014-11-02 15:41:08 +00:00
|
|
|
typedef mozilla::gfx::ColorPattern ColorPattern;
|
2014-11-03 10:03:11 +00:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
2014-10-31 11:16:27 +00:00
|
|
|
typedef mozilla::gfx::Float Float;
|
2014-11-03 10:03:11 +00:00
|
|
|
typedef mozilla::gfx::Path Path;
|
2015-08-06 02:42:09 +00:00
|
|
|
typedef mozilla::gfx::Point Point;
|
2014-11-02 15:41:08 +00:00
|
|
|
typedef mozilla::gfx::Rect Rect;
|
2014-10-31 11:16:27 +00:00
|
|
|
typedef mozilla::gfx::RectCornerRadii RectCornerRadii;
|
2015-08-06 02:42:09 +00:00
|
|
|
typedef mozilla::gfx::StrokeOptions StrokeOptions;
|
2014-10-31 11:16:27 +00:00
|
|
|
|
2021-07-19 11:28:20 +00:00
|
|
|
friend class mozilla::nsDisplayOutline;
|
|
|
|
friend class mozilla::nsDisplayButtonBorder;
|
|
|
|
friend class mozilla::nsDisplayButtonForeground;
|
2016-11-24 05:11:30 +00:00
|
|
|
|
2014-11-03 10:03:14 +00:00
|
|
|
public:
|
2021-02-15 08:49:20 +00:00
|
|
|
nsCSSBorderRenderer(nsPresContext* aPresContext, DrawTarget* aDrawTarget,
|
|
|
|
const Rect& aDirtyRect, Rect& aOuterRect,
|
2018-11-07 19:56:17 +00:00
|
|
|
const mozilla::StyleBorderStyle* aBorderStyles,
|
2014-11-01 10:45:10 +00:00
|
|
|
const Float* aBorderWidths, RectCornerRadii& aBorderRadii,
|
2008-07-23 17:25:23 +00:00
|
|
|
const nscolor* aBorderColors, bool aBackfaceIsVisible,
|
2017-10-11 08:27:31 +00:00
|
|
|
const mozilla::Maybe<Rect>& aClipRect);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2014-11-03 10:03:14 +00:00
|
|
|
// draw the entire border
|
|
|
|
void DrawBorders();
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
void CreateWebRenderCommands(
|
2021-07-19 11:28:20 +00:00
|
|
|
mozilla::nsDisplayItem* aItem, mozilla::wr::DisplayListBuilder& aBuilder,
|
2018-09-04 20:46:21 +00:00
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc);
|
2017-03-09 08:58:38 +00:00
|
|
|
|
2014-11-03 10:03:14 +00:00
|
|
|
// utility function used for background painting as well as borders
|
|
|
|
static void ComputeInnerRadii(const RectCornerRadii& aRadii,
|
|
|
|
const Float* aBorderSizes,
|
|
|
|
RectCornerRadii* aInnerRadiiRet);
|
|
|
|
|
|
|
|
// Given aRadii as the border radii for a rectangle, compute the
|
|
|
|
// appropriate radii for another rectangle *outside* that rectangle
|
|
|
|
// by increasing the radii, except keeping sharp corners sharp.
|
|
|
|
// Used for spread box-shadows
|
|
|
|
static void ComputeOuterRadii(const RectCornerRadii& aRadii,
|
|
|
|
const Float* aBorderSizes,
|
|
|
|
RectCornerRadii* aOuterRadiiRet);
|
|
|
|
|
2016-11-24 05:11:30 +00:00
|
|
|
static bool AllCornersZeroSize(const RectCornerRadii& corners);
|
|
|
|
|
2014-11-03 10:03:14 +00:00
|
|
|
private:
|
2014-11-01 10:45:10 +00:00
|
|
|
RectCornerRadii mBorderCornerDimensions;
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2016-06-10 04:10:03 +00:00
|
|
|
nsPresContext* mPresContext;
|
2015-07-31 18:09:29 +00:00
|
|
|
|
2016-06-10 04:10:03 +00:00
|
|
|
// destination DrawTarget and dirty rect
|
2014-11-03 10:03:11 +00:00
|
|
|
DrawTarget* mDrawTarget;
|
2017-02-23 09:34:14 +00:00
|
|
|
Rect mDirtyRect;
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
// the rectangle of the outside and the inside of the border
|
2014-11-03 10:03:09 +00:00
|
|
|
Rect mOuterRect;
|
|
|
|
Rect mInnerRect;
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
// the style and size of the border
|
2018-11-07 19:56:17 +00:00
|
|
|
mozilla::StyleBorderStyle mBorderStyles[4];
|
2016-11-24 05:11:30 +00:00
|
|
|
Float mBorderWidths[4];
|
2014-11-01 10:45:10 +00:00
|
|
|
RectCornerRadii mBorderRadii;
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2017-08-07 11:16:48 +00:00
|
|
|
// the colors for 'border-top-color' et. al.
|
2016-11-24 05:11:30 +00:00
|
|
|
nscolor mBorderColors[4];
|
2017-08-07 11:16:48 +00:00
|
|
|
|
2008-07-23 17:25:23 +00:00
|
|
|
// calculated values
|
2017-08-08 08:41:13 +00:00
|
|
|
bool mAllBordersSameStyle;
|
2017-08-08 09:02:35 +00:00
|
|
|
bool mAllBordersSameWidth;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mOneUnitBorder;
|
|
|
|
bool mNoBorderRadius;
|
|
|
|
bool mAvoidStroke;
|
2017-09-21 06:41:38 +00:00
|
|
|
bool mBackfaceIsVisible;
|
2017-10-11 08:27:31 +00:00
|
|
|
mozilla::Maybe<Rect> mLocalClip;
|
2008-07-23 17:25:51 +00:00
|
|
|
|
2008-07-23 17:25:23 +00:00
|
|
|
// For all the sides in the bitmask, would they be rendered
|
|
|
|
// in an identical color and style?
|
2019-11-16 20:59:34 +00:00
|
|
|
bool AreBorderSideFinalStylesSame(mozilla::SideBits aSides);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2008-07-23 17:25:51 +00:00
|
|
|
// For the given style, is the given corner a solid color?
|
2018-11-07 19:56:17 +00:00
|
|
|
bool IsSolidCornerStyle(mozilla::StyleBorderStyle aStyle,
|
|
|
|
mozilla::Corner aCorner);
|
2008-07-23 17:25:51 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// For the given corner, is the given corner mergeable into one dot?
|
2017-01-04 09:18:49 +00:00
|
|
|
bool IsCornerMergeable(mozilla::Corner aCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
2008-07-23 17:25:51 +00:00
|
|
|
// For the given solid corner, what color style should be used?
|
2018-11-07 19:56:17 +00:00
|
|
|
BorderColorStyle BorderColorStyleForSolidCorner(
|
|
|
|
mozilla::StyleBorderStyle aStyle, mozilla::Corner aCorner);
|
2008-07-23 17:25:51 +00:00
|
|
|
|
2008-07-23 17:25:23 +00:00
|
|
|
//
|
|
|
|
// Path generation functions
|
|
|
|
//
|
|
|
|
|
2014-11-03 10:03:11 +00:00
|
|
|
// Get the Rect for drawing the given corner
|
2017-01-04 09:18:49 +00:00
|
|
|
Rect GetCornerRect(mozilla::Corner aCorner);
|
2018-09-04 20:46:21 +00:00
|
|
|
// add the path for drawing the given side without any adjacent corners to the
|
|
|
|
// context
|
2016-11-18 08:28:38 +00:00
|
|
|
Rect GetSideClipWithoutCornersRect(mozilla::Side aSide);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
// Create a clip path for the wedge that this side of
|
|
|
|
// the border should take up. This is only called
|
|
|
|
// when we're drawing separate border sides, so we know
|
|
|
|
// that ADD compositing is taking place.
|
|
|
|
//
|
|
|
|
// This code needs to make sure that the individual pieces
|
|
|
|
// don't ever (mathematically) overlap; the pixel overlap
|
|
|
|
// is taken care of by the ADD compositing.
|
2016-11-18 08:28:38 +00:00
|
|
|
already_AddRefed<Path> GetSideClipSubPath(mozilla::Side aSide);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// Return start or end point for dashed/dotted side
|
2016-11-18 08:28:38 +00:00
|
|
|
Point GetStraightBorderPoint(mozilla::Side aSide, mozilla::Corner aCorner,
|
2017-02-24 22:02:46 +00:00
|
|
|
bool* aIsUnfilled, Float aDotOffset = 0.0f);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// Return bezier control points for the outer and the inner curve for given
|
|
|
|
// corner
|
|
|
|
void GetOuterAndInnerBezier(Bezier* aOuterBezier, Bezier* aInnerBezier,
|
2017-01-04 09:18:49 +00:00
|
|
|
mozilla::Corner aCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
2008-07-23 17:25:23 +00:00
|
|
|
// Given a set of sides to fill and a color, do so in the fastest way.
|
|
|
|
//
|
|
|
|
// Stroke tends to be faster for smaller borders because it doesn't go
|
|
|
|
// through the tessellator, which has initialization overhead. If
|
|
|
|
// we're rendering all sides, we can use stroke at any thickness; we
|
|
|
|
// also do TL/BR pairs at 1px thickness using stroke.
|
|
|
|
//
|
|
|
|
// If we can't stroke, then if it's a TL/BR pair, we use the specific
|
|
|
|
// TL/BR paths. Otherwise, we do the full path and fill.
|
|
|
|
//
|
|
|
|
// Calling code is expected to only set up a clip as necessary; no
|
|
|
|
// clip is needed if we can render the entire border in 1 or 2 passes.
|
2014-11-02 15:41:08 +00:00
|
|
|
void FillSolidBorder(const Rect& aOuterRect, const Rect& aInnerRect,
|
2014-11-01 10:45:10 +00:00
|
|
|
const RectCornerRadii& aBorderRadii,
|
2019-11-16 20:59:34 +00:00
|
|
|
const Float* aBorderSizes, mozilla::SideBits aSides,
|
2014-11-02 15:41:08 +00:00
|
|
|
const ColorPattern& aColor);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// core rendering
|
|
|
|
//
|
|
|
|
|
|
|
|
// draw the border for the given sides, using the style of the first side
|
|
|
|
// present in the bitmask
|
2019-11-16 20:59:34 +00:00
|
|
|
void DrawBorderSides(mozilla::SideBits aSides);
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// Setup the stroke options for the given dashed/dotted side
|
|
|
|
void SetupDashedOptions(StrokeOptions* aStrokeOptions, Float aDash[2],
|
2018-09-04 20:46:21 +00:00
|
|
|
mozilla::Side aSide, Float aBorderLength,
|
|
|
|
bool isCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
|
|
|
// Draw the given dashed/dotte side
|
2016-11-18 08:28:38 +00:00
|
|
|
void DrawDashedOrDottedSide(mozilla::Side aSide);
|
2014-09-10 01:08:00 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// Draw the given dotted side, each dot separately
|
2016-11-18 08:28:38 +00:00
|
|
|
void DrawDottedSideSlow(mozilla::Side aSide);
|
2010-12-02 13:17:58 +00:00
|
|
|
|
2015-08-06 02:42:09 +00:00
|
|
|
// Draw the given dashed/dotted corner
|
2018-09-04 20:46:21 +00:00
|
|
|
void DrawDashedOrDottedCorner(mozilla::Side aSide, mozilla::Corner aCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
|
|
|
// Draw the given dotted corner, each segment separately
|
2018-09-04 20:46:21 +00:00
|
|
|
void DrawDottedCornerSlow(mozilla::Side aSide, mozilla::Corner aCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
|
|
|
// Draw the given dashed corner, each dot separately
|
2018-09-04 20:46:21 +00:00
|
|
|
void DrawDashedCornerSlow(mozilla::Side aSide, mozilla::Corner aCorner);
|
2015-08-06 02:42:09 +00:00
|
|
|
|
2016-06-10 04:10:03 +00:00
|
|
|
// Draw the given dashed/dotted corner with solid style
|
2018-09-04 20:46:21 +00:00
|
|
|
void DrawFallbackSolidCorner(mozilla::Side aSide, mozilla::Corner aCorner);
|
2016-06-10 04:10:03 +00:00
|
|
|
|
2010-12-02 13:17:58 +00:00
|
|
|
// Analyze if all border sides have the same width.
|
|
|
|
bool AllBordersSameWidth();
|
|
|
|
|
|
|
|
// Analyze if all borders are 'solid' this also considers hidden or 'none'
|
|
|
|
// borders because they can be considered 'solid' borders of 0 width and
|
|
|
|
// with no color effect.
|
2018-01-15 02:35:20 +00:00
|
|
|
bool AllBordersSolid();
|
2010-12-02 13:17:58 +00:00
|
|
|
|
|
|
|
// Draw a solid color border that is uniformly the same width.
|
|
|
|
void DrawSingleWidthSolidBorder();
|
|
|
|
|
2018-01-15 02:35:20 +00:00
|
|
|
// Draw any border which is solid on all sides.
|
|
|
|
void DrawSolidBorder();
|
2008-07-23 17:25:23 +00:00
|
|
|
};
|
|
|
|
|
2017-03-13 03:46:04 +00:00
|
|
|
class nsCSSBorderImageRenderer final {
|
|
|
|
typedef mozilla::nsImageRenderer nsImageRenderer;
|
2018-09-04 20:46:21 +00:00
|
|
|
|
2017-03-13 03:46:04 +00:00
|
|
|
public:
|
2018-09-04 20:46:21 +00:00
|
|
|
static mozilla::Maybe<nsCSSBorderImageRenderer> CreateBorderImageRenderer(
|
|
|
|
nsPresContext* aPresContext, nsIFrame* aForFrame,
|
|
|
|
const nsRect& aBorderArea, const nsStyleBorder& aStyleBorder,
|
|
|
|
const nsRect& aDirtyRect, nsIFrame::Sides aSkipSides, uint32_t aFlags,
|
|
|
|
mozilla::image::ImgDrawResult* aDrawResult);
|
|
|
|
|
|
|
|
mozilla::image::ImgDrawResult DrawBorderImage(nsPresContext* aPresContext,
|
|
|
|
gfxContext& aRenderingContext,
|
|
|
|
nsIFrame* aForFrame,
|
|
|
|
const nsRect& aDirtyRect);
|
2018-09-13 23:48:27 +00:00
|
|
|
mozilla::image::ImgDrawResult CreateWebRenderCommands(
|
2021-07-19 11:28:20 +00:00
|
|
|
mozilla::nsDisplayItem* aItem, nsIFrame* aForFrame,
|
2018-09-04 20:46:21 +00:00
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder,
|
|
|
|
mozilla::wr::IpcResourceUpdateQueue& aResources,
|
|
|
|
const mozilla::layers::StackingContextHelper& aSc,
|
2019-01-07 21:33:10 +00:00
|
|
|
mozilla::layers::RenderRootStateManager* aManager,
|
2021-07-19 11:28:20 +00:00
|
|
|
mozilla::nsDisplayListBuilder* aDisplayListBuilder);
|
2017-03-13 03:46:04 +00:00
|
|
|
|
|
|
|
nsCSSBorderImageRenderer(const nsCSSBorderImageRenderer& aRhs);
|
|
|
|
nsCSSBorderImageRenderer& operator=(const nsCSSBorderImageRenderer& aRhs);
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsCSSBorderImageRenderer(nsIFrame* aForFrame, const nsRect& aBorderArea,
|
|
|
|
const nsStyleBorder& aStyleBorder,
|
|
|
|
nsIFrame::Sides aSkipSides,
|
|
|
|
const nsImageRenderer& aImageRenderer);
|
|
|
|
|
|
|
|
nsImageRenderer mImageRenderer;
|
|
|
|
nsSize mImageSize;
|
|
|
|
nsMargin mSlice;
|
|
|
|
nsMargin mWidths;
|
|
|
|
nsMargin mImageOutset;
|
|
|
|
nsRect mArea;
|
|
|
|
nsRect mClip;
|
2017-12-21 05:16:40 +00:00
|
|
|
mozilla::StyleBorderImageRepeat mRepeatModeHorizontal;
|
|
|
|
mozilla::StyleBorderImageRepeat mRepeatModeVertical;
|
2019-02-14 18:03:04 +00:00
|
|
|
bool mFill;
|
2017-03-13 03:46:04 +00:00
|
|
|
|
2021-07-19 11:28:20 +00:00
|
|
|
friend class mozilla::nsDisplayBorder;
|
2017-10-13 20:19:00 +00:00
|
|
|
friend struct nsCSSRendering;
|
2017-03-13 03:46:04 +00:00
|
|
|
};
|
|
|
|
|
2013-11-15 02:43:56 +00:00
|
|
|
namespace mozilla {
|
2008-07-23 17:25:23 +00:00
|
|
|
#ifdef DEBUG_NEW_BORDERS
|
|
|
|
# include <stdarg.h>
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const mozilla::gfx::Point& p) {
|
|
|
|
fprintf(stderr, "[%f,%f]", p.x, p.y);
|
2008-07-23 17:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const mozilla::gfx::Size& s) {
|
|
|
|
fprintf(stderr, "[%f %f]", s.width, s.height);
|
2008-07-23 17:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const mozilla::gfx::Rect& r) {
|
|
|
|
fprintf(stderr, "[%f %f %f %f]", r.X(), r.Y(), r.Width(), r.Height());
|
2008-07-23 17:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const mozilla::gfx::Float f) {
|
|
|
|
fprintf(stderr, "%f", f);
|
2008-07-23 17:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const char* s) { fprintf(stderr, "%s", s); }
|
2008-07-23 17:25:23 +00:00
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsStringNewline(const char* s = nullptr) {
|
|
|
|
if (s) fprintf(stderr, "%s", s);
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
fflush(stderr);
|
2008-07-23 17:25:23 +00:00
|
|
|
}
|
|
|
|
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline MOZ_FORMAT_PRINTF(1, 2) void PrintAsFormatString(const char* fmt,
|
|
|
|
...) {
|
2008-07-23 17:25:23 +00:00
|
|
|
va_list vl;
|
|
|
|
va_start(vl, fmt);
|
2018-09-04 20:46:21 +00:00
|
|
|
vfprintf(stderr, fmt, vl);
|
2008-07-23 17:25:23 +00:00
|
|
|
va_end(vl);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
2018-09-04 20:46:21 +00:00
|
|
|
static inline void PrintAsString(const mozilla::gfx::Point& p) {}
|
|
|
|
static inline void PrintAsString(const mozilla::gfx::Size& s) {}
|
|
|
|
static inline void PrintAsString(const mozilla::gfx::Rect& r) {}
|
|
|
|
static inline void PrintAsString(const mozilla::gfx::Float f) {}
|
|
|
|
static inline void PrintAsString(const char* s) {}
|
|
|
|
static inline void PrintAsStringNewline(const char* s = nullptr) {}
|
|
|
|
static inline MOZ_FORMAT_PRINTF(1, 2) void PrintAsFormatString(const char* fmt,
|
|
|
|
...) {}
|
2008-07-23 17:25:23 +00:00
|
|
|
#endif
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2013-11-15 02:43:56 +00:00
|
|
|
|
2008-07-23 17:25:23 +00:00
|
|
|
#endif /* NS_CSS_RENDERING_BORDERS_H */
|