| Index: Source/core/paint/BoxBorderPainter.h
|
| diff --git a/Source/core/paint/BoxBorderPainter.h b/Source/core/paint/BoxBorderPainter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..21af6d97084823ce95e62b7536e22b07b813a790
|
| --- /dev/null
|
| +++ b/Source/core/paint/BoxBorderPainter.h
|
| @@ -0,0 +1,80 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BoxBorderPainter_h
|
| +#define BoxBorderPainter_h
|
| +
|
| +#include "core/layout/LayoutBoxModelObject.h"
|
| +#include "core/style/BorderEdge.h"
|
| +
|
| +namespace blink {
|
| +
|
| +enum BorderEdgeFlag {
|
| + TopBorderEdge = 1 << BSTop,
|
| + RightBorderEdge = 1 << BSRight,
|
| + BottomBorderEdge = 1 << BSBottom,
|
| + LeftBorderEdge = 1 << BSLeft,
|
| + AllBorderEdges = TopBorderEdge | BottomBorderEdge | LeftBorderEdge | RightBorderEdge
|
| +};
|
| +
|
| +struct BoxBorderInfo {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + BoxBorderInfo(const ComputedStyle&, BackgroundBleedAvoidance,
|
| + bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
|
| +
|
| + const ComputedStyle& style;
|
| + const BackgroundBleedAvoidance bleedAvoidance;
|
| + const bool includeLogicalLeftEdge;
|
| + const bool includeLogicalRightEdge;
|
| +
|
| + BorderEdge edges[4];
|
| +
|
| + unsigned visibleEdgeCount;
|
| + unsigned firstVisibleEdge;
|
| + BorderEdgeFlags visibleEdgeSet;
|
| +
|
| + bool isUniformStyle;
|
| + bool isUniformWidth;
|
| + bool isUniformColor;
|
| + bool hasAlpha;
|
| +};
|
| +
|
| +class BoxBorderPainter {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + BoxBorderPainter(const BoxBorderInfo&, const FloatRoundedRect& outer,
|
| + const FloatRoundedRect& inner);
|
| +
|
| + void paint(GraphicsContext*) const;
|
| +
|
| +private:
|
| + struct OpacityGroup {
|
| + Vector<BoxSide, 4> sides;
|
| + BorderEdgeFlags edgeFlags;
|
| + unsigned alpha;
|
| + };
|
| +
|
| + enum MitreType { NoMitre, AntiAliasedMitre, NonAntiAliasedMitre };
|
| +
|
| + MitreType computeMitre(BoxSide, BoxSide adjacentSide, BorderEdgeFlags paintedSides) const;
|
| + bool colorNeedsAntiAliasAtCorner(BoxSide, BoxSide adjacentSide, Color) const;
|
| + void paintSide(GraphicsContext*, BoxSide, unsigned alpha, BorderEdgeFlags paintedSides) const;
|
| +
|
| + BorderEdgeFlags paintGroup(GraphicsContext*, unsigned index, float opacity) const;
|
| + void clipBorderSidePolygon(GraphicsContext*, BoxSide, MitreType mitre1, MitreType mitre2) const;
|
| +
|
| + const BoxBorderInfo& m_borderInfo;
|
| + const FloatRoundedRect& m_outer;
|
| + const FloatRoundedRect& m_inner;
|
| +
|
| + Path m_roundedPath;
|
| + Vector<OpacityGroup, 4> m_opacityGroups;
|
| + Vector<size_t, 4> m_opacityGroupIndices;
|
| + bool m_hasRadii[4]; // TopLeft, TopRight, BottomRight, BottomLeft
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif
|
|
|