Commit fdba390e authored by morrita@google.com's avatar morrita@google.com
Browse files

2011-01-18 MORITA Hajime <morrita@google.com>

        Unreviewed, rolling out r76004, r76005, r76007, and r76011.
        http://trac.webkit.org/changeset/76004
        http://trac.webkit.org/changeset/76005
        http://trac.webkit.org/changeset/76007
        http://trac.webkit.org/changeset/76011
        https://bugs.webkit.org/show_bug.cgi?id=51664

        The r76004 broke pixel tests.
        (The failure was missed due to the tolerance.)

        * Android.mk:
        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * platform/graphics/GraphicsContext.cpp:
        (WebCore::GraphicsContext::addRoundedRectClip):
        (WebCore::GraphicsContext::clipOutRoundedRect):
        * platform/graphics/GraphicsContext.h:
        * platform/graphics/RoundedIntRect.cpp: Removed.
        * platform/graphics/RoundedIntRect.h: Removed.
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::pushContentsClip):
        * rendering/RenderBoxModelObject.cpp:
        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
        (WebCore::RenderBoxModelObject::paintBorder):
        (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
        (WebCore::uniformlyExpandBorderRadii):
        (WebCore::RenderBoxModelObject::paintBoxShadow):
        * rendering/RenderBoxModelObject.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::drawBoxSideFromPath):
        * rendering/RenderReplaced.cpp:
        (WebCore::RenderReplaced::paint):
        * rendering/RenderThemeChromiumWin.cpp:
        (WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
        * rendering/RenderThemeMac.mm:
        (WebCore::RenderThemeMac::paintMenuListButtonGradients):
        (WebCore::RenderThemeMac::paintSliderTrack):
        * rendering/RenderThemeSafari.cpp:
        (WebCore::RenderThemeSafari::paintMenuListButtonGradients):
        (WebCore::RenderThemeSafari::paintSliderTrack):
        * rendering/RenderThemeWinCE.cpp:
        (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton):
        * rendering/RenderWidget.cpp:
        (WebCore::RenderWidget::paint):
        * rendering/style/BorderData.h:
        * rendering/style/RenderStyle.cpp:
        (WebCore::constrainCornerRadiiForRect):
        (WebCore::RenderStyle::getBorderRadiiForRect):
        (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths):
        * rendering/style/RenderStyle.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76016 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7a4c7696
......@@ -531,7 +531,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/Path.cpp \
platform/graphics/PathTraversalState.cpp \
platform/graphics/Pattern.cpp \
platform/graphics/RoundedIntRect.cpp \
platform/graphics/SegmentedFontData.cpp \
platform/graphics/SimpleFontData.cpp \
platform/graphics/StringTruncator.cpp \
......
......@@ -1350,7 +1350,6 @@ SET(WebCore_SOURCES
platform/graphics/Path.cpp
platform/graphics/PathTraversalState.cpp
platform/graphics/Pattern.cpp
platform/graphics/RoundedIntRect.cpp
platform/graphics/SegmentedFontData.cpp
platform/graphics/SimpleFontData.cpp
platform/graphics/StringTruncator.cpp
......
2011-01-18 MORITA Hajime <morrita@google.com>
Unreviewed, rolling out r76004, r76005, r76007, and r76011.
http://trac.webkit.org/changeset/76004
http://trac.webkit.org/changeset/76005
http://trac.webkit.org/changeset/76007
http://trac.webkit.org/changeset/76011
https://bugs.webkit.org/show_bug.cgi?id=51664
The r76004 broke pixel tests.
(The failure was missed due to the tolerance.)
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::addRoundedRectClip):
(WebCore::GraphicsContext::clipOutRoundedRect):
* platform/graphics/GraphicsContext.h:
* platform/graphics/RoundedIntRect.cpp: Removed.
* platform/graphics/RoundedIntRect.h: Removed.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::pushContentsClip):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
(WebCore::uniformlyExpandBorderRadii):
(WebCore::RenderBoxModelObject::paintBoxShadow):
* rendering/RenderBoxModelObject.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::drawBoxSideFromPath):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* rendering/RenderThemeChromiumWin.cpp:
(WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonGradients):
(WebCore::RenderThemeMac::paintSliderTrack):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::paintMenuListButtonGradients):
(WebCore::RenderThemeSafari::paintSliderTrack):
* rendering/RenderThemeWinCE.cpp:
(WebCore::RenderThemeWinCE::paintSearchFieldCancelButton):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
* rendering/style/BorderData.h:
* rendering/style/RenderStyle.cpp:
(WebCore::constrainCornerRadiiForRect):
(WebCore::RenderStyle::getBorderRadiiForRect):
(WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths):
* rendering/style/RenderStyle.h:
2011-01-17 Pavel Podivilov <podivilov@chromium.org>
 
Reviewed by Yury Semikhatsky.
......@@ -2435,8 +2435,6 @@ webcore_sources += \
Source/WebCore/platform/graphics/PathTraversalState.h \
Source/WebCore/platform/graphics/Pattern.cpp \
Source/WebCore/platform/graphics/Pattern.h \
Source/WebCore/platform/graphics/RoundedIntRect.h \
Source/WebCore/platform/graphics/RoundedIntRect.cpp \
Source/WebCore/platform/graphics/SegmentedFontData.cpp \
Source/WebCore/platform/graphics/SegmentedFontData.h \
Source/WebCore/platform/graphics/SimpleFontData.cpp \
......
......@@ -2942,8 +2942,6 @@
'platform/graphics/PathTraversalState.h',
'platform/graphics/Pattern.cpp',
'platform/graphics/Pattern.h',
'platform/graphics/RoundedIntRect.cpp',
'platform/graphics/RoundedIntRect.h',
'platform/graphics/SegmentedFontData.cpp',
'platform/graphics/SegmentedFontData.h',
'platform/graphics/SimpleFontData.cpp',
......
......@@ -1210,7 +1210,6 @@ SOURCES += \
platform/graphics/Path.cpp \
platform/graphics/PathTraversalState.cpp \
platform/graphics/Pattern.cpp \
platform/graphics/RoundedIntRect.cpp \
platform/graphics/SegmentedFontData.cpp \
platform/graphics/SimpleFontData.cpp \
platform/graphics/TiledBackingStore.cpp \
......@@ -2130,7 +2129,6 @@ HEADERS += \
platform/graphics/Path.h \
platform/graphics/PathTraversalState.h \
platform/graphics/Pattern.h \
platform/graphics/RoundedIntRect.h \
platform/graphics/qt/FontCustomPlatformData.h \
platform/graphics/qt/ImageDecoderQt.h \
platform/graphics/qt/StillImageQt.h \
......
......@@ -26692,14 +26692,6 @@
RelativePath="..\platform\graphics\Pattern.h"
>
</File>
<File
RelativePath="..\platform\graphics\RoundedIntRect.cpp"
>
</File>
<File
RelativePath="..\platform\graphics\RoundedIntRect.h"
>
</File>
<File
RelativePath="..\platform\graphics\SegmentedFontData.cpp"
>
......@@ -3163,8 +3163,6 @@
A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F9122C44A600A785B3 /* GenericBinding.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */; };
A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; };
A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */; };
......@@ -9535,8 +9533,6 @@
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedIntRect.cpp; sourceTree = "<group>"; };
A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedIntRect.h; sourceTree = "<group>"; };
A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; };
A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEBlend.cpp; path = filters/FEBlend.cpp; sourceTree = "<group>"; };
......@@ -17464,8 +17460,6 @@
A88DD4860B4629A300C02990 /* PathTraversalState.h */,
A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */,
A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */,
A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */,
A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */,
371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */,
371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */,
B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */,
......@@ -21731,7 +21725,6 @@
FD3160AD12B026F700C1A359 /* ReverbInputBuffer.h in Headers */,
BC74DA371013F3F7007987AD /* RGBColor.h in Headers */,
A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */,
A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */,
49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */,
1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */,
1A569D1F0D7E2B82007C3983 /* runtime_array.h in Headers */,
......@@ -24523,7 +24516,6 @@
FD3160AC12B026F700C1A359 /* ReverbInputBuffer.cpp in Sources */,
BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */,
A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */,
A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */,
49E911C80EF86D47009D0CAF /* RotateTransformOperation.cpp in Sources */,
1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */,
1A569D1E0D7E2B82007C3983 /* runtime_array.cpp in Sources */,
......@@ -31,7 +31,6 @@
#include "Generator.h"
#include "ImageBuffer.h"
#include "IntRect.h"
#include "RoundedIntRect.h"
using namespace std;
......@@ -537,23 +536,25 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorS
image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale);
}
void GraphicsContext::addRoundedRectClip(const RoundedIntRect& rect)
void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
const IntSize& bottomLeft, const IntSize& bottomRight)
{
if (paintingDisabled())
return;
Path path;
path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());
path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
clip(path);
}
void GraphicsContext::clipOutRoundedRect(const RoundedIntRect& rect)
void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
const IntSize& bottomLeft, const IntSize& bottomRight)
{
if (paintingDisabled())
return;
Path path;
path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());
path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
clipOut(path);
}
......@@ -584,11 +585,6 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator)
generator.fill(this, rect);
}
void GraphicsContext::fillRoundedRect(const RoundedIntRect& rect, const Color& color, ColorSpace colorSpace)
{
fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);
}
void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation)
{
m_state.compositeOperator = compositeOperation;
......
......@@ -120,7 +120,6 @@ namespace WebCore {
class GraphicsContextPlatformPrivate;
class ImageBuffer;
class IntRect;
class RoundedIntRect;
class KURL;
class SharedGraphicsContext3D;
class TextRun;
......@@ -283,7 +282,6 @@ namespace WebCore {
void fillRect(const FloatRect&, const Color&, ColorSpace);
void fillRect(const FloatRect&, Generator&);
void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace);
void fillRoundedRect(const RoundedIntRect&, const Color&, ColorSpace);
void clearRect(const FloatRect&);
......@@ -312,10 +310,10 @@ namespace WebCore {
InterpolationQuality imageInterpolationQuality() const;
void clip(const FloatRect&);
void addRoundedRectClip(const RoundedIntRect&);
void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
void addInnerRoundedRectClip(const IntRect&, int thickness);
void clipOut(const IntRect&);
void clipOutRoundedRect(const RoundedIntRect&);
void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
void clipPath(const Path&, WindRule);
void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
void clipToImageBuffer(ImageBuffer*, const FloatRect&);
......
/*
* Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "RoundedIntRect.h"
#include "IntRect.h"
#include <algorithm>
namespace WebCore {
bool RoundedIntRect::Radii::isZero() const
{
return m_topLeft.isZero() && m_topRight.isZero() && m_bottomLeft.isZero() && m_bottomRight.isZero();
}
void RoundedIntRect::Radii::scale(float factor)
{
if (factor == 1)
return;
// If either radius on a corner becomes zero, reset both radii on that corner.
m_topLeft.scale(factor);
if (!m_topLeft.width() || !m_topLeft.height())
m_topLeft = IntSize();
m_topRight.scale(factor);
if (!m_topRight.width() || !m_topRight.height())
m_topRight = IntSize();
m_bottomLeft.scale(factor);
if (!m_bottomLeft.width() || !m_bottomLeft.height())
m_bottomLeft = IntSize();
m_bottomRight.scale(factor);
if (!m_bottomRight.width() || !m_bottomRight.height())
m_bottomRight = IntSize();
}
void RoundedIntRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth)
{
m_topLeft.setWidth(std::max(0, m_topLeft.width() + leftWidth));
m_topLeft.setHeight(std::max(0, m_topLeft.height() + topWidth));
m_topRight.setWidth(std::max(0, m_topRight.width() + rightWidth));
m_topRight.setHeight(std::max(0, m_topRight.height() + topWidth));
m_bottomLeft.setWidth(std::max(0, m_bottomLeft.width() + leftWidth));
m_bottomLeft.setHeight(std::max(0, m_bottomLeft.height() + bottomWidth));
m_bottomRight.setWidth(std::max(0, m_bottomRight.width() + rightWidth));
m_bottomRight.setHeight(std::max(0, m_bottomRight.height() + bottomWidth));
}
void RoundedIntRect::Radii::includeLogicalEdges(const RoundedIntRect::Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
if (includeLogicalLeftEdge) {
if (isHorizontal)
m_bottomLeft = edges.bottomLeft();
else
m_topRight = edges.topRight();
m_topLeft = edges.topLeft();
}
if (includeLogicalRightEdge) {
if (isHorizontal)
m_topRight = edges.topRight();
else
m_bottomLeft = edges.bottomLeft();
m_bottomRight = edges.bottomRight();
}
}
void RoundedIntRect::Radii::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
{
if (excludeLogicalLeftEdge) {
if (isHorizontal)
m_bottomLeft = IntSize();
else
m_topRight = IntSize();
m_topLeft = IntSize();
}
if (excludeLogicalRightEdge) {
if (isHorizontal)
m_topRight = IntSize();
else
m_bottomLeft = IntSize();
m_bottomRight = IntSize();
}
}
RoundedIntRect::RoundedIntRect(int x, int y, int width, int height)
: m_rect(x, y, width, height)
{
}
RoundedIntRect::RoundedIntRect(const IntRect& rect, const Radii& radii)
: m_rect(rect)
, m_radii(radii)
{
}
RoundedIntRect::RoundedIntRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
: m_rect(rect)
, m_radii(topLeft, topRight, bottomLeft, bottomRight)
{
}
void RoundedIntRect::includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
m_radii.includeLogicalEdges(edges, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
}
void RoundedIntRect::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge)
{
m_radii.excludeLogicalEdges(isHorizontal, excludeLogicalLeftEdge, excludeLogicalRightEdge);
}
} // namespace WebCore
/*
* Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RoundedIntRect_h
#define RoundedIntRect_h
#include "IntRect.h"
namespace WebCore {
class RoundedIntRect {
public:
class Radii {
public:
Radii() {}
Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight)
: m_topLeft(topLeft)
, m_topRight(topRight)
, m_bottomLeft(bottomLeft)
, m_bottomRight(bottomRight)
{
}
void setTopLeft(const IntSize& size) { m_topLeft = size; }
void setTopRight(const IntSize& size) { m_topRight = size; }
void setBottomLeft(const IntSize& size) { m_bottomLeft = size; }
void setBottomRight(const IntSize& size) { m_bottomRight = size; }
const IntSize& topLeft() const { return m_topLeft; }
const IntSize& topRight() const { return m_topRight; }
const IntSize& bottomLeft() const { return m_bottomLeft; }
const IntSize& bottomRight() const { return m_bottomRight; }
bool isZero() const;
void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
void scale(float factor);
void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth);
void expand(int size) { expand(size, size, size, size); }
void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); }
void shrink(int size) { shrink(size, size, size, size); }
private:
IntSize m_topLeft;
IntSize m_topRight;
IntSize m_bottomLeft;
IntSize m_bottomRight;
};
explicit RoundedIntRect(const IntRect&, const Radii& = Radii());
RoundedIntRect(int x, int y, int width, int height);
RoundedIntRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight);
IntPoint location() const { return m_rect.location(); }
IntSize size() const { return m_rect.size(); }
int x() const { return m_rect.x(); }
int y() const { return m_rect.y(); }
int width() const { return m_rect.width(); }
int height() const { return m_rect.height(); }
int right() const { return m_rect.right(); }
int bottom() const { return m_rect.bottom(); }
const IntRect& rect() const { return m_rect; }
const Radii& radii() const { return m_radii; }
bool isRounded() const { return !m_radii.isZero(); }
bool isEmpty() const { return m_rect.isEmpty(); }
void setRect(const IntRect& rect) { m_rect = rect; }
void setRadii(const Radii& radii) { m_radii = radii; }
void move(const IntSize size) { m_rect.move(size); }
void inflate(int size) { m_rect.inflate(size); }
void inflateWithRadii(int size) { m_rect.inflate(size); m_radii.expand(size); }
void expandRadii(int size) { m_radii.expand(size); }
void shrinkRadii(int size) { m_radii.shrink(size); }
void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge);
private:
IntRect m_rect;
Radii m_radii;
};
} // namespace WebCore
#endif // RoundedIntRect_h
......@@ -1067,8 +1067,14 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, int tx, int ty)
}
IntRect clipRect(isControlClip ? controlClipRect(tx, ty) : overflowClipRect(tx, ty));
paintInfo.context->save();
if (style()->hasBorderRadius())
paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(tx, ty, width(), height())));
if (style()->hasBorderRadius()) {
IntSize topLeft, topRight, bottomLeft, bottomRight;
IntRect borderRect = IntRect(tx, ty, width(), height());
style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
paintInfo.context->clip(clipRect);
return true;
}
......
......@@ -134,8 +134,8 @@ private:
IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const;
void clipBorderSidePolygon(GraphicsContext*, const RoundedIntRect& border,
const BoxSide, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle*,
void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft,
const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
friend class RenderView;
......
......@@ -979,24 +979,36 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect
innerBorderLeftWidth += 1;
// Get the inner border rects for both the outer border line and the inner border line
IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth,
outerBorderLeftWidth, outerBorderRightWidth);
IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth,
innerBorderLeftWidth, innerBorderRightWidth);
// Get the inner radii for the outer border line
IntSize outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius,
outerBorderBottomRightInnerRadius;
style->getInnerBorderRadiiForRectWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth,
outerBorderLeftWidth, outerBorderRightWidth, outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius,
outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius);
// Get the inner radii for the inner border line
IntSize innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius,
innerBorderBottomRightInnerRadius;
style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth,
innerBorderLeftWidth, innerBorderRightWidth, innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius,
innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius);
// Draw inner border line
graphicsContext->save();
IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth,
innerBorderLeftWidth, innerBorderRightWidth);
RoundedIntRect innerClip = style->getRoundedInnerBorderWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth,
innerBorderLeftWidth, innerBorderRightWidth);
graphicsContext->addRoundedRectClip(innerClip);
graphicsContext->addRoundedRectClip(innerBorderInnerRect, innerBorderTopLeftInnerRadius,
innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius);
drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
graphicsContext->restore();
// Draw outer border line
graphicsContext->save();
IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth,
outerBorderLeftWidth, outerBorderRightWidth);
RoundedIntRect outerClip = style->getRoundedInnerBorderWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth,
outerBorderLeftWidth, outerBorderRightWidth);
graphicsContext->clipOutRoundedRect(outerClip);
graphicsContext->clipOutRoundedRect(outerBorderInnerRect, outerBorderTopLeftInnerRadius,
outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius);