| Index: Source/core/rendering/RenderBoxModelObject.cpp
|
| diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
|
| index 73ecfa184ae293b19fa69210a4dd17232a5b2713..3e4c3e8c397f494a47ac5fad99423a7380fba2e7 100644
|
| --- a/Source/core/rendering/RenderBoxModelObject.cpp
|
| +++ b/Source/core/rendering/RenderBoxModelObject.cpp
|
| @@ -42,6 +42,7 @@
|
| #include "core/rendering/RenderView.h"
|
| #include "core/rendering/compositing/CompositedLayerMapping.h"
|
| #include "core/rendering/compositing/RenderLayerCompositor.h"
|
| +#include "core/rendering/style/BorderEdge.h"
|
| #include "core/rendering/style/ShadowList.h"
|
| #include "platform/LengthFunctions.h"
|
| #include "platform/geometry/TransformState.h"
|
| @@ -1231,77 +1232,6 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
|
| return true;
|
| }
|
|
|
| -class BorderEdge {
|
| -public:
|
| - BorderEdge(int edgeWidth, const Color& edgeColor, EBorderStyle edgeStyle, bool edgeIsTransparent, bool edgeIsPresent = true)
|
| - : width(edgeWidth)
|
| - , color(edgeColor)
|
| - , style(edgeStyle)
|
| - , isTransparent(edgeIsTransparent)
|
| - , isPresent(edgeIsPresent)
|
| - {
|
| - if (style == DOUBLE && edgeWidth < 3)
|
| - style = SOLID;
|
| - }
|
| -
|
| - BorderEdge()
|
| - : width(0)
|
| - , style(BHIDDEN)
|
| - , isTransparent(false)
|
| - , isPresent(false)
|
| - {
|
| - }
|
| -
|
| - bool hasVisibleColorAndStyle() const { return style > BHIDDEN && !isTransparent; }
|
| - bool shouldRender() const { return isPresent && width && hasVisibleColorAndStyle(); }
|
| - bool presentButInvisible() const { return usedWidth() && !hasVisibleColorAndStyle(); }
|
| - bool obscuresBackgroundEdge(float scale) const
|
| - {
|
| - if (!isPresent || isTransparent || (width * scale) < 2 || color.hasAlpha() || style == BHIDDEN)
|
| - return false;
|
| -
|
| - if (style == DOTTED || style == DASHED)
|
| - return false;
|
| -
|
| - if (style == DOUBLE)
|
| - return width >= 5 * scale; // The outer band needs to be >= 2px wide at unit scale.
|
| -
|
| - return true;
|
| - }
|
| - bool obscuresBackground() const
|
| - {
|
| - if (!isPresent || isTransparent || color.hasAlpha() || style == BHIDDEN)
|
| - return false;
|
| -
|
| - if (style == DOTTED || style == DASHED || style == DOUBLE)
|
| - return false;
|
| -
|
| - return true;
|
| - }
|
| -
|
| - int usedWidth() const { return isPresent ? width : 0; }
|
| -
|
| - void getDoubleBorderStripeWidths(int& outerWidth, int& innerWidth) const
|
| - {
|
| - int fullWidth = usedWidth();
|
| - outerWidth = fullWidth / 3;
|
| - innerWidth = fullWidth * 2 / 3;
|
| -
|
| - // We need certain integer rounding results
|
| - if (fullWidth % 3 == 2)
|
| - outerWidth += 1;
|
| -
|
| - if (fullWidth % 3 == 1)
|
| - innerWidth += 1;
|
| - }
|
| -
|
| - int width;
|
| - Color color;
|
| - EBorderStyle style;
|
| - bool isTransparent;
|
| - bool isPresent;
|
| -};
|
| -
|
| static bool allCornersClippedOut(const RoundedRect& border, const LayoutRect& clipRect)
|
| {
|
| LayoutRect boundingRect = border.rect();
|
| @@ -1364,11 +1294,6 @@ static inline bool includesAdjacentEdges(BorderEdgeFlags flags)
|
| || (flags & (LeftBorderEdge | TopBorderEdge)) == (LeftBorderEdge | TopBorderEdge);
|
| }
|
|
|
| -inline bool edgesShareColor(const BorderEdge& firstEdge, const BorderEdge& secondEdge)
|
| -{
|
| - return firstEdge.color == secondEdge.color;
|
| -}
|
| -
|
| inline bool styleRequiresClipPolygon(EBorderStyle style)
|
| {
|
| return style == DOTTED || style == DASHED; // These are drawn with a stroke, so we have to clip to get corner miters.
|
| @@ -1409,7 +1334,7 @@ static inline bool colorsMatchAtCorner(BoxSide side, BoxSide adjacentSide, const
|
| if (edges[side].shouldRender() != edges[adjacentSide].shouldRender())
|
| return false;
|
|
|
| - if (!edgesShareColor(edges[side], edges[adjacentSide]))
|
| + if (!edges[side].sharesColorWith(edges[adjacentSide]))
|
| return false;
|
|
|
| return !borderStyleHasUnmatchedColorsAtCorner(edges[side].style, side, adjacentSide);
|
| @@ -1424,7 +1349,7 @@ static inline bool colorNeedsAntiAliasAtCorner(BoxSide side, BoxSide adjacentSid
|
| if (edges[side].shouldRender() != edges[adjacentSide].shouldRender())
|
| return false;
|
|
|
| - if (!edgesShareColor(edges[side], edges[adjacentSide]))
|
| + if (!edges[side].sharesColorWith(edges[adjacentSide]))
|
| return true;
|
|
|
| return borderStyleHasUnmatchedColorsAtCorner(edges[side].style, side, adjacentSide);
|
| @@ -1439,7 +1364,7 @@ static inline bool willBeOverdrawn(BoxSide side, BoxSide adjacentSide, const Bor
|
| if (edges[adjacentSide].presentButInvisible())
|
| return false;
|
|
|
| - if (!edgesShareColor(edges[side], edges[adjacentSide]) && edges[adjacentSide].color.hasAlpha())
|
| + if (!edges[side].sharesColorWith(edges[adjacentSide]) && edges[adjacentSide].color.hasAlpha())
|
| return false;
|
|
|
| if (!borderStyleFillsBorderArea(edges[adjacentSide].style))
|
| @@ -1477,7 +1402,7 @@ static bool joinRequiresMitre(BoxSide side, BoxSide adjacentSide, const BorderEd
|
| if (allowOverdraw && willBeOverdrawn(side, adjacentSide, edges))
|
| return false;
|
|
|
| - if (!edgesShareColor(edges[side], edges[adjacentSide]))
|
| + if (!edges[side].sharesColorWith(edges[adjacentSide]))
|
| return true;
|
|
|
| if (borderStylesRequireMitre(side, adjacentSide, edges[side].style, edges[adjacentSide].style))
|
| @@ -1650,7 +1575,7 @@ void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect&
|
| return;
|
|
|
| BorderEdge edges[4];
|
| - getBorderEdgeInfo(edges, style, includeLogicalLeftEdge, includeLogicalRightEdge);
|
| + style->getBorderEdgeInfo(edges, includeLogicalLeftEdge, includeLogicalRightEdge);
|
| RoundedRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
|
| RoundedRect innerBorder = style->getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(graphicsContext, rect, bleedAvoidance), includeLogicalLeftEdge, includeLogicalRightEdge);
|
|
|
| @@ -2273,72 +2198,6 @@ void RenderBoxModelObject::clipBorderSideForComplexInnerPath(GraphicsContext* gr
|
| graphicsContext->clipOutRoundedRect(adjustedInnerRect);
|
| }
|
|
|
| -void RenderBoxModelObject::getBorderEdgeInfo(BorderEdge edges[], const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
|
| -{
|
| - bool horizontal = style->isHorizontalWritingMode();
|
| -
|
| - edges[BSTop] = BorderEdge(style->borderTopWidth(),
|
| - resolveColor(style, CSSPropertyBorderTopColor),
|
| - style->borderTopStyle(),
|
| - style->borderTopIsTransparent(),
|
| - horizontal || includeLogicalLeftEdge);
|
| -
|
| - edges[BSRight] = BorderEdge(style->borderRightWidth(),
|
| - resolveColor(style, CSSPropertyBorderRightColor),
|
| - style->borderRightStyle(),
|
| - style->borderRightIsTransparent(),
|
| - !horizontal || includeLogicalRightEdge);
|
| -
|
| - edges[BSBottom] = BorderEdge(style->borderBottomWidth(),
|
| - resolveColor(style, CSSPropertyBorderBottomColor),
|
| - style->borderBottomStyle(),
|
| - style->borderBottomIsTransparent(),
|
| - horizontal || includeLogicalRightEdge);
|
| -
|
| - edges[BSLeft] = BorderEdge(style->borderLeftWidth(),
|
| - resolveColor(style, CSSPropertyBorderLeftColor),
|
| - style->borderLeftStyle(),
|
| - style->borderLeftIsTransparent(),
|
| - !horizontal || includeLogicalLeftEdge);
|
| -}
|
| -
|
| -bool RenderBoxModelObject::borderObscuresBackgroundEdge(const FloatSize& contextScale) const
|
| -{
|
| - BorderEdge edges[4];
|
| - getBorderEdgeInfo(edges, style());
|
| -
|
| - for (int i = BSTop; i <= BSLeft; ++i) {
|
| - const BorderEdge& currEdge = edges[i];
|
| - // FIXME: for vertical text
|
| - float axisScale = (i == BSTop || i == BSBottom) ? contextScale.height() : contextScale.width();
|
| - if (!currEdge.obscuresBackgroundEdge(axisScale))
|
| - return false;
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| -bool RenderBoxModelObject::borderObscuresBackground() const
|
| -{
|
| - if (!style()->hasBorder())
|
| - return false;
|
| -
|
| - // Bail if we have any border-image for now. We could look at the image alpha to improve this.
|
| - if (style()->borderImage().image())
|
| - return false;
|
| -
|
| - BorderEdge edges[4];
|
| - getBorderEdgeInfo(edges, style());
|
| -
|
| - for (int i = BSTop; i <= BSLeft; ++i) {
|
| - const BorderEdge& currEdge = edges[i];
|
| - if (!currEdge.obscuresBackground())
|
| - return false;
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| bool RenderBoxModelObject::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* inlineFlowBox) const
|
| {
|
| if (bleedAvoidance != BackgroundBleedNone)
|
|
|