[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
morrita at google.com
morrita at google.com
Sun Feb 20 23:09:41 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit fdba390e1899e3cdd6d83a64b21111e1ce2e29d1
Author: morrita at google.com <morrita at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 18 12:26:48 2011 +0000
2011-01-18 MORITA Hajime <morrita at 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
diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk
index 4251338..9ca484a 100644
--- a/Source/WebCore/Android.mk
+++ b/Source/WebCore/Android.mk
@@ -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 \
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 765e413..8050b48 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -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
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 580346f..60b8eb1 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,60 @@
+2011-01-18 MORITA Hajime <morrita at 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 at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am
index a36f386..efbbb70 100644
--- a/Source/WebCore/GNUmakefile.am
+++ b/Source/WebCore/GNUmakefile.am
@@ -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 \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 26240b3..8278e2b 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -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',
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index de12297..d37cdc7 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -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 \
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index b790472..3c3ea78 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -26693,14 +26693,6 @@
>
</File>
<File
- RelativePath="..\platform\graphics\RoundedIntRect.cpp"
- >
- </File>
- <File
- RelativePath="..\platform\graphics\RoundedIntRect.h"
- >
- </File>
- <File
RelativePath="..\platform\graphics\SegmentedFontData.cpp"
>
</File>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 215f820..ed86c67 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -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 */,
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
index e7ea881..61b778c 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
@@ -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;
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h
index a459b37..8588523 100644
--- a/Source/WebCore/platform/graphics/GraphicsContext.h
+++ b/Source/WebCore/platform/graphics/GraphicsContext.h
@@ -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&);
diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.cpp b/Source/WebCore/platform/graphics/RoundedIntRect.cpp
deleted file mode 100644
index 4e80c9a..0000000
--- a/Source/WebCore/platform/graphics/RoundedIntRect.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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
diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.h b/Source/WebCore/platform/graphics/RoundedIntRect.h
deleted file mode 100644
index 39b7fb4..0000000
--- a/Source/WebCore/platform/graphics/RoundedIntRect.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp
index f20aa0e..3d367aa 100644
--- a/Source/WebCore/rendering/RenderBox.cpp
+++ b/Source/WebCore/rendering/RenderBox.cpp
@@ -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;
}
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp
index f9849cf..5098306 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -547,9 +547,26 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co
context->save();
- RoundedIntRect border = style()->getRoundedBorderFor(borderRect);
- border.excludeLogicalEdges(box && box->isHorizontal(), !includeLeftEdge, !includeRightEdge);
- context->addRoundedRectClip(border);
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
+ style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
+
+ if (!includeLeftEdge) {
+ topLeft = IntSize();
+ if (box->isHorizontal())
+ bottomLeft = IntSize();
+ else
+ topRight = IntSize();
+ }
+
+ if (!includeRightEdge) {
+ if (box->isHorizontal())
+ topRight = IntSize();
+ else
+ bottomLeft = IntSize();
+ bottomRight = IntSize();
+ }
+
+ context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
clippedToBorderRadius = true;
}
@@ -1007,32 +1024,62 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge);
bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
+ bool renderRadii = false;
Path roundedPath;
- RoundedIntRect border(tx, ty, w, h);
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
+ IntRect borderRect(tx, ty, w, h);
if (style->hasBorderRadius()) {
- border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(),
- horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
+ IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius;
+ style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0;
int rightWidth = (!horizontal || includeLogicalRightEdge) ? style->borderRightWidth() : 0;
int topWidth = (horizontal || includeLogicalLeftEdge) ? style->borderTopWidth() : 0;
int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0;
- RoundedIntRect inner(borderInnerRect(border.rect(), topWidth, bottomWidth, leftWidth, rightWidth));
- inner.includeLogicalEdges(style->getRoundedInnerBorderWithBorderWidths(inner.rect(), topWidth, bottomWidth, leftWidth, rightWidth).radii(),
- horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
+ IntRect innerBorderRect = borderInnerRect(borderRect, topWidth, bottomWidth, leftWidth, rightWidth);
+ IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius;
+
+ style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, topWidth, bottomWidth, leftWidth, rightWidth, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius);
+
+ IntSize innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight;
+
+ if (includeLogicalLeftEdge) {
+ topLeft = topLeftRadius;
+ innerTopLeft = innerTopLeftRadius;
+ if (horizontal) {
+ bottomLeft = bottomLeftRadius;
+ innerBottomLeft = innerBottomLeftRadius;
+ } else {
+ topRight = topRightRadius;
+ innerTopRight = innerTopRightRadius;
+ }
+ }
+
+ if (includeLogicalRightEdge) {
+ if (horizontal) {
+ topRight = topRightRadius;
+ innerTopRight = innerTopRightRadius;
+ } else {
+ bottomLeft = bottomLeftRadius;
+ innerBottomLeft = innerBottomLeftRadius;
+ }
+ bottomRight = bottomRightRadius;
+ innerBottomRight = innerBottomRightRadius;
+ }
- if (border.isRounded()) {
+ renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero();
+
+ if (renderRadii) {
// Clip to the inner and outer radii rects.
graphicsContext->save();
- graphicsContext->addRoundedRectClip(border);
- graphicsContext->clipOutRoundedRect(inner);
- roundedPath.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());
+ graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
+ graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight);
+ roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
}
- bool renderRadii = border.isRounded();
bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor);
bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE);
bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE);
@@ -1042,11 +1089,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
int x = tx;
int x2 = tx + w;
- if (renderRadii && borderWillArcInnerEdge(border.radii().topLeft(), border.radii().topRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) {
+ if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) {
graphicsContext->save();
- clipBorderSidePolygon(graphicsContext, border, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
+ clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth());
- drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle);
+ drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle);
graphicsContext->restore();
} else {
bool ignoreLeft = (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET
@@ -1063,11 +1110,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
int x = tx;
int x2 = tx + w;
- if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().bottomRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) {
+ if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) {
graphicsContext->save();
- clipBorderSidePolygon(graphicsContext, border, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
+ clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth());
- drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle);
+ drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle);
graphicsContext->restore();
} else {
bool ignoreLeft = (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET
@@ -1086,11 +1133,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
int y = ty;
int y2 = ty + h;
- if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().topLeft(), style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) {
+ if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) {
graphicsContext->save();
- clipBorderSidePolygon(graphicsContext, border, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
+ clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth());
- drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle);
+ drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle);
graphicsContext->restore();
} else {
bool ignoreTop = (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET
@@ -1105,11 +1152,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
if (renderRight) {
- if (renderRadii && borderWillArcInnerEdge(border.radii().bottomRight(), border.radii().topRight(), style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) {
+ if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) {
graphicsContext->save();
- clipBorderSidePolygon(graphicsContext, border, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
+ clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);
float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth());
- drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle);
+ drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle);
graphicsContext->restore();
} else {
bool ignoreTop = ((topColor == rightColor) && (topTransparent == rightTransparent)
@@ -1162,43 +1209,65 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge);
bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
+ bool renderRadii = false;
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
- RoundedIntRect border(tx, ty, w, h);
if (style->hasBorderRadius()) {
- border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(),
- horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
- if (border.isRounded()) {
+ IntRect borderRect = IntRect(tx, ty, w, h);
+
+ IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius;
+ style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+
+ if (includeLogicalLeftEdge) {
+ topLeft = topLeftRadius;
+ if (horizontal)
+ bottomLeft = bottomLeftRadius;
+ else
+ topRight = topRightRadius;
+ }
+
+ if (includeLogicalRightEdge) {
+ if (horizontal)
+ topRight = topRightRadius;
+ else
+ bottomLeft = bottomLeftRadius;
+ bottomRight = bottomRightRadius;
+ }
+
+ renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero();
+
+ if (renderRadii) {
+ // Clip to the rounded rectangle.
graphicsContext->save();
- graphicsContext->addRoundedRectClip(border);
+ graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
}
int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan;
float thickness;
- bool renderRadii = border.isRounded();
bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor);
bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE);
bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE);
bool lowerRightBorderStylesMatch = renderRight && (bottomStyle == rightStyle) && (bottomColor == rightColor);
if (renderTop) {
- bool ignoreLeft = (renderRadii && border.radii().topLeft().width() > 0)
- || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET
- && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
-
- bool ignoreRight = (renderRadii && border.radii().topRight().width() > 0)
- || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET
- && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
+ bool ignore_left = (renderRadii && topLeft.width() > 0) ||
+ (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET &&
+ (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
+
+ bool ignore_right = (renderRadii && topRight.width() > 0) ||
+ (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET &&
+ (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
int x = tx;
int x2 = tx + w;
if (renderRadii) {
- x += border.radii().topLeft().width();
- x2 -= border.radii().topRight().width();
+ x += topLeft.width();
+ x2 -= topRight.width();
}
drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle,
- ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
+ ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
if (renderRadii) {
int leftY = ty;
@@ -1208,15 +1277,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
// with the arc-drawing function.
thickness = style->borderTopWidth() * 2;
- if (border.radii().topLeft().width()) {
+ if (topLeft.width()) {
int leftX = tx;
// The inner clip clips inside the arc. This is especially important for 1px borders.
- bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
- && (style->borderTopWidth() < border.radii().topLeft().height())
+ bool applyLeftInnerClip = (style->borderLeftWidth() < topLeft.width())
+ && (style->borderTopWidth() < topLeft.height())
&& (topStyle != DOUBLE || style->borderTopWidth() > 6);
if (applyLeftInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2),
style->borderTopWidth());
}
@@ -1224,20 +1293,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
firstAngleSpan = upperLeftBorderStylesMatch ? 90 : 45;
// Draw upper left arc
- drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
+ drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan,
BSTop, topColor, topStyle, true);
if (applyLeftInnerClip)
graphicsContext->restore();
}
- if (border.radii().topRight().width()) {
- int rightX = tx + w - border.radii().topRight().width() * 2;
- bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
- && (style->borderTopWidth() < border.radii().topRight().height())
+ if (topRight.width()) {
+ int rightX = tx + w - topRight.width() * 2;
+ bool applyRightInnerClip = (style->borderRightWidth() < topRight.width())
+ && (style->borderTopWidth() < topRight.height())
&& (topStyle != DOUBLE || style->borderTopWidth() > 6);
if (applyRightInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2),
style->borderTopWidth());
}
@@ -1250,7 +1319,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
// Draw upper right arc
- drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan,
+ drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan,
BSTop, topColor, topStyle, false);
if (applyRightInnerClip)
graphicsContext->restore();
@@ -1259,36 +1328,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
if (renderBottom) {
- bool ignoreLeft = (renderRadii && border.radii().bottomLeft().width() > 0)
- || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET
- && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
+ bool ignore_left = (renderRadii && bottomLeft.width() > 0) ||
+ (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET &&
+ (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
- bool ignoreRight = (renderRadii && border.radii().bottomRight().width() > 0)
- || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET
- && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
+ bool ignore_right = (renderRadii && bottomRight.width() > 0) ||
+ (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET &&
+ (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
int x = tx;
int x2 = tx + w;
if (renderRadii) {
- x += border.radii().bottomLeft().width();
- x2 -= border.radii().bottomRight().width();
+ x += bottomLeft.width();
+ x2 -= bottomRight.width();
}
drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle,
- ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
+ ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
if (renderRadii) {
thickness = style->borderBottomWidth() * 2;
- if (border.radii().bottomLeft().width()) {
+ if (bottomLeft.width()) {
int leftX = tx;
- int leftY = ty + h - border.radii().bottomLeft().height() * 2;
- bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
- && (style->borderBottomWidth() < border.radii().bottomLeft().height())
+ int leftY = ty + h - bottomLeft.height() * 2;
+ bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width())
+ && (style->borderBottomWidth() < bottomLeft.height())
&& (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
if (applyLeftInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2),
style->borderBottomWidth());
}
@@ -1301,21 +1370,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
// Draw lower left arc
- drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().bottomLeft(), firstAngleStart, firstAngleSpan,
+ drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan,
BSBottom, bottomColor, bottomStyle, true);
if (applyLeftInnerClip)
graphicsContext->restore();
}
- if (border.radii().bottomRight().width()) {
- int rightY = ty + h - border.radii().bottomRight().height() * 2;
- int rightX = tx + w - border.radii().bottomRight().width() * 2;
- bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
- && (style->borderBottomWidth() < border.radii().bottomRight().height())
+ if (bottomRight.width()) {
+ int rightY = ty + h - bottomRight.height() * 2;
+ int rightX = tx + w - bottomRight.width() * 2;
+ bool applyRightInnerClip = (style->borderRightWidth() < bottomRight.width())
+ && (style->borderBottomWidth() < bottomRight.height())
&& (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
if (applyRightInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bottomRight.width() * 2, bottomRight.height() * 2),
style->borderBottomWidth());
}
@@ -1323,7 +1392,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
secondAngleSpan = lowerRightBorderStylesMatch ? 90 : 45;
// Draw lower right arc
- drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
+ drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
BSBottom, bottomColor, bottomStyle, false);
if (applyRightInnerClip)
graphicsContext->restore();
@@ -1332,36 +1401,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
if (renderLeft) {
- bool ignoreTop = (renderRadii && border.radii().topLeft().height() > 0)
- || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET
- && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
+ bool ignore_top = (renderRadii && topLeft.height() > 0) ||
+ (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET &&
+ (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
- bool ignoreBottom = (renderRadii && border.radii().bottomLeft().height() > 0)
- || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET
- && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
+ bool ignore_bottom = (renderRadii && bottomLeft.height() > 0) ||
+ (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET &&
+ (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
int y = ty;
int y2 = ty + h;
if (renderRadii) {
- y += border.radii().topLeft().height();
- y2 -= border.radii().bottomLeft().height();
+ y += topLeft.height();
+ y2 -= bottomLeft.height();
}
drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
- ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
int topX = tx;
thickness = style->borderLeftWidth() * 2;
- if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {
+ if (!upperLeftBorderStylesMatch && topLeft.width()) {
int topY = ty;
- bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
- && (style->borderTopWidth() < border.radii().topLeft().height())
+ bool applyTopInnerClip = (style->borderLeftWidth() < topLeft.width())
+ && (style->borderTopWidth() < topLeft.height())
&& (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
if (applyTopInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2),
style->borderLeftWidth());
}
@@ -1369,20 +1438,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
firstAngleSpan = 45;
// Draw top left arc
- drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
+ drawArcForBoxSide(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan,
BSLeft, leftColor, leftStyle, true);
if (applyTopInnerClip)
graphicsContext->restore();
}
- if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) {
- int bottomY = ty + h - border.radii().bottomLeft().height() * 2;
- bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
- && (style->borderBottomWidth() < border.radii().bottomLeft().height())
+ if (!lowerLeftBorderStylesMatch && bottomLeft.width()) {
+ int bottomY = ty + h - bottomLeft.height() * 2;
+ bool applyBottomInnerClip = (style->borderLeftWidth() < bottomLeft.width())
+ && (style->borderBottomWidth() < bottomLeft.height())
&& (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
if (applyBottomInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2),
style->borderLeftWidth());
}
@@ -1390,7 +1459,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
secondAngleSpan = 45;
// Draw bottom left arc
- drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, border.radii().bottomLeft(), secondAngleStart, secondAngleSpan,
+ drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan,
BSLeft, leftColor, leftStyle, false);
if (applyBottomInnerClip)
graphicsContext->restore();
@@ -1399,38 +1468,38 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
if (renderRight) {
- bool ignoreTop = (renderRadii && border.radii().topRight().height() > 0)
- || ((topColor == rightColor) && (topTransparent == rightTransparent)
- && (rightStyle >= DOTTED || rightStyle == INSET)
- && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
+ bool ignore_top = (renderRadii && topRight.height() > 0) ||
+ ((topColor == rightColor) && (topTransparent == rightTransparent) &&
+ (rightStyle >= DOTTED || rightStyle == INSET) &&
+ (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
- bool ignoreBottom = (renderRadii && border.radii().bottomRight().height() > 0)
- || ((bottomColor == rightColor) && (bottomTransparent == rightTransparent)
- && (rightStyle >= DOTTED || rightStyle == INSET)
- && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
+ bool ignore_bottom = (renderRadii && bottomRight.height() > 0) ||
+ ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) &&
+ (rightStyle >= DOTTED || rightStyle == INSET) &&
+ (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
int y = ty;
int y2 = ty + h;
if (renderRadii) {
- y += border.radii().topRight().height();
- y2 -= border.radii().bottomRight().height();
+ y += topRight.height();
+ y2 -= bottomRight.height();
}
drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle,
- ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
+ ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) {
thickness = style->borderRightWidth() * 2;
- if (!upperRightBorderStylesMatch && border.radii().topRight().width()) {
- int topX = tx + w - border.radii().topRight().width() * 2;
+ if (!upperRightBorderStylesMatch && topRight.width()) {
+ int topX = tx + w - topRight.width() * 2;
int topY = ty;
- bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
- && (style->borderTopWidth() < border.radii().topRight().height())
+ bool applyTopInnerClip = (style->borderRightWidth() < topRight.width())
+ && (style->borderTopWidth() < topRight.height())
&& (rightStyle != DOUBLE || style->borderRightWidth() > 6);
if (applyTopInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2),
style->borderRightWidth());
}
@@ -1438,21 +1507,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
firstAngleSpan = 45;
// Draw top right arc
- drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan,
+ drawArcForBoxSide(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan,
BSRight, rightColor, rightStyle, true);
if (applyTopInnerClip)
graphicsContext->restore();
}
- if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) {
- int bottomX = tx + w - border.radii().bottomRight().width() * 2;
- int bottomY = ty + h - border.radii().bottomRight().height() * 2;
- bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
- && (style->borderBottomWidth() < border.radii().bottomRight().height())
+ if (!lowerRightBorderStylesMatch && bottomRight.width()) {
+ int bottomX = tx + w - bottomRight.width() * 2;
+ int bottomY = ty + h - bottomRight.height() * 2;
+ bool applyBottomInnerClip = (style->borderRightWidth() < bottomRight.width())
+ && (style->borderBottomWidth() < bottomRight.height())
&& (rightStyle != DOUBLE || style->borderRightWidth() > 6);
if (applyBottomInnerClip) {
graphicsContext->save();
- graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
+ graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2),
style->borderRightWidth());
}
@@ -1460,7 +1529,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
secondAngleSpan = 45;
// Draw bottom right arc
- drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
+ drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
BSRight, rightColor, rightStyle, false);
if (applyBottomInnerClip)
graphicsContext->restore();
@@ -1473,15 +1542,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx,
}
#endif
-void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const RoundedIntRect& border,
+void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, 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)
{
FloatPoint quad[4];
- int tx = border.rect().x();
- int ty = border.rect().y();
- int w = border.rect().width();
- int h = border.rect().height();
+ int tx = box.x();
+ int ty = box.y();
+ int w = box.width();
+ int h = box.height();
bool horizontal = style->isHorizontalWritingMode();
int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0;
@@ -1494,26 +1563,26 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex
switch (side) {
case BSTop:
quad[0] = FloatPoint(tx, ty);
- quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth));
- quad[2] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth));
+ quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth));
+ quad[2] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth));
quad[3] = FloatPoint(tx + w, ty);
break;
case BSLeft:
quad[0] = FloatPoint(tx, ty);
- quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth));
- quad[2] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth));
+ quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth));
+ quad[2] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth));
quad[3] = FloatPoint(tx, ty + h);
break;
case BSBottom:
quad[0] = FloatPoint(tx, ty + h);
- quad[1] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth));
- quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth));
+ quad[1] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth));
+ quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth));
quad[3] = FloatPoint(tx + w, ty + h);
break;
case BSRight:
quad[0] = FloatPoint(tx + w, ty);
- quad[1] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth));
- quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth));
+ quad[1] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth));
+ quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth));
quad[3] = FloatPoint(tx + w, ty + h);
break;
default:
@@ -1544,6 +1613,18 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex
graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches);
}
+static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight)
+{
+ topLeft.expand(delta, delta);
+ topLeft.clampNegativeToZero();
+ topRight.expand(delta, delta);
+ topRight.clampNegativeToZero();
+ bottomLeft.expand(delta, delta);
+ bottomLeft.clampNegativeToZero();
+ bottomRight.expand(delta, delta);
+ bottomRight.clampNegativeToZero();
+}
+
void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
{
// FIXME: Deal with border-image. Would be great to use border-image as a mask.
@@ -1551,19 +1632,61 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
if (context->paintingDisabled())
return;
- RoundedIntRect border(tx, ty, w, h);
+ IntRect rect(tx, ty, w, h);
+ IntSize topLeft;
+ IntSize topRight;
+ IntSize bottomLeft;
+ IntSize bottomRight;
+
bool hasBorderRadius = s->hasBorderRadius();
bool isHorizontal = s->isHorizontalWritingMode();
if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) {
- border = (shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect());
- border.includeLogicalEdges(border.radii(), isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
+ IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius;
+ s->getBorderRadiiForRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+
+ if (includeLogicalLeftEdge) {
+ if (shadowStyle == Inset) {
+ topLeftRadius.expand(-borderLeft(), -borderTop());
+ topLeftRadius.clampNegativeToZero();
+ if (isHorizontal) {
+ bottomLeftRadius.expand(-borderLeft(), -borderBottom());
+ bottomLeftRadius.clampNegativeToZero();
+ } else {
+ topRightRadius.expand(-borderRight(), -borderTop());
+ topRightRadius.clampNegativeToZero();
+ }
+ }
+ topLeft = topLeftRadius;
+ if (isHorizontal)
+ bottomLeft = bottomLeftRadius;
+ else
+ topRight = topRightRadius;
+ }
+ if (includeLogicalRightEdge) {
+ if (shadowStyle == Inset) {
+ if (isHorizontal) {
+ topRightRadius.expand(-borderRight(), -borderTop());
+ topRightRadius.clampNegativeToZero();
+ } else {
+ bottomLeftRadius.expand(-borderLeft(), -borderBottom());
+ bottomLeftRadius.clampNegativeToZero();
+ }
+ bottomRightRadius.expand(-borderRight(), -borderBottom());
+ bottomRightRadius.clampNegativeToZero();
+ }
+ if (isHorizontal)
+ topRight = topRightRadius;
+ else
+ bottomLeft = bottomLeftRadius;
+ bottomRight = bottomRightRadius;
+ }
+ }
+
+ if (shadowStyle == Inset) {
+ rect.move(includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0, includeLogicalLeftEdge || isHorizontal ? borderTop() : 0);
+ rect.setWidth(rect.width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0));
+ rect.setHeight(rect.height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0));
}
-
- if (shadowStyle == Inset)
- border.setRect(IntRect(border.rect().x() + (includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0),
- border.rect().y() + (includeLogicalLeftEdge || isHorizontal ? borderTop() : 0),
- border.rect().width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0),
- border.rect().height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0)));
bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255;
for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) {
@@ -1576,12 +1699,12 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
const Color& shadowColor = shadow->color();
if (shadow->style() == Normal) {
- RoundedIntRect fillRect = border;
+ IntRect fillRect(rect);
fillRect.inflate(shadowSpread);
if (fillRect.isEmpty())
continue;
- IntRect shadowRect(border.rect());
+ IntRect shadowRect(rect);
shadowRect.inflate(shadowBlur + shadowSpread);
shadowRect.move(shadowOffset);
@@ -1596,23 +1719,32 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
if (hasBorderRadius) {
- RoundedIntRect rectToClipOut = border;
+ IntRect rectToClipOut = rect;
+ IntSize topLeftToClipOut = topLeft;
+ IntSize topRightToClipOut = topRight;
+ IntSize bottomLeftToClipOut = bottomLeft;
+ IntSize bottomRightToClipOut = bottomRight;
+
+ IntSize topLeftToFill = topLeft;
+ IntSize topRightToFill = topRight;
+ IntSize bottomLeftToFill = bottomLeft;
+ IntSize bottomRightToFill = bottomRight;
+ if (shadowSpread < 0)
+ uniformlyExpandBorderRadii(shadowSpread, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill);
// If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
// when painting the shadow. On the other hand, it introduces subpixel gaps along the
// corners. Those are avoided by insetting the clipping path by one pixel.
if (hasOpaqueBackground) {
- rectToClipOut.inflateWithRadii(-1);
+ rectToClipOut.inflate(-1);
+ uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut);
}
if (!rectToClipOut.isEmpty())
- context->clipOutRoundedRect(rectToClipOut);
-
- if (shadowSpread < 0)
- fillRect.expandRadii(shadowSpread);
- context->fillRoundedRect(fillRect, Color::black, s->colorSpace());
+ context->clipOutRoundedRect(rectToClipOut, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut);
+ context->fillRoundedRect(fillRect, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill, Color::black, s->colorSpace());
} else {
- IntRect rectToClipOut = border.rect();
+ IntRect rectToClipOut = rect;
// If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
// when painting the shadow. On the other hand, it introduces subpixel gaps along the
@@ -1627,20 +1759,20 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
if (!rectToClipOut.isEmpty())
context->clipOut(rectToClipOut);
- context->fillRect(fillRect.rect(), Color::black, s->colorSpace());
+ context->fillRect(fillRect, Color::black, s->colorSpace());
}
context->restore();
} else {
// Inset shadow.
- IntRect holeRect(border.rect());
+ IntRect holeRect(rect);
holeRect.inflate(-shadowSpread);
if (holeRect.isEmpty()) {
if (hasBorderRadius)
- context->fillRoundedRect(border, shadowColor, s->colorSpace());
+ context->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, shadowColor, s->colorSpace());
else
- context->fillRect(border.rect(), shadowColor, s->colorSpace());
+ context->fillRect(rect, shadowColor, s->colorSpace());
continue;
}
@@ -1662,7 +1794,7 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
- IntRect outerRect(border.rect());
+ IntRect outerRect(rect);
outerRect.inflateX(w - 2 * shadowSpread);
outerRect.inflateY(h - 2 * shadowSpread);
@@ -1670,11 +1802,11 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
Path path;
if (hasBorderRadius) {
- path.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());
+ path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight);
context->clip(path);
path.clear();
} else
- context->clip(border.rect());
+ context->clip(rect);
IntSize extraOffset(2 * w + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
context->translate(extraOffset.width(), extraOffset.height());
@@ -1684,8 +1816,8 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
if (hasBorderRadius) {
if (shadowSpread > 0)
- border.shrinkRadii(shadowSpread);
- path.addRoundedRect(holeRect, border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());
+ uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight);
+ path.addRoundedRect(holeRect, topLeft, topRight, bottomLeft, bottomRight);
} else
path.addRect(holeRect);
diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h
index f6bcb94..8f9f465 100644
--- a/Source/WebCore/rendering/RenderBoxModelObject.h
+++ b/Source/WebCore/rendering/RenderBoxModelObject.h
@@ -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;
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index 5b39e0d..97ac5c3 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -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);
drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
graphicsContext->restore();
@@ -1018,14 +1030,18 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect
IntRect halfBorderRect = borderInnerRect(borderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2,
style->borderLeftWidth() / 2, style->borderRightWidth() / 2);
+ IntSize topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius;
+ style->getInnerBorderRadiiForRectWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2,
+ style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2,
+ topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius);
+
// Paint full border
drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1);
// Paint inner only
graphicsContext->save();
- RoundedIntRect clipRect = style->getRoundedInnerBorderWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2,
- style->borderLeftWidth() / 2, style->borderRightWidth() / 2);
- graphicsContext->addRoundedRectClip(clipRect);
+ graphicsContext->addRoundedRectClip(halfBorderRect, topLeftHalfRadius, topRightHalfRadius,
+ bottomLeftHalfRadius, bottomRightHalfRadius);
drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2);
graphicsContext->restore();
diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp
index 0d72f95..974a8d0 100644
--- a/Source/WebCore/rendering/RenderReplaced.cpp
+++ b/Source/WebCore/rendering/RenderReplaced.cpp
@@ -135,7 +135,11 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
else {
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
- paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect));
+
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
+ style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
+
+ paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
}
diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp
index 572aa2f..5b41ea2 100644
--- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp
+++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp
@@ -676,7 +676,9 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o,
// background (themed or filled) appropriately.
// FIXME: make sure we do the right thing if css background-clip is set.
i.context->save();
- i.context->addRoundedRectClip(o->style()->getRoundedBorderFor(r));
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
+ o->style()->getBorderRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight);
+ i.context->addRoundedRectClip(r, topLeft, topRight, bottomLeft, bottomRight);
}
{
const ThemeData& themeData = getThemeData(o);
diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm
index 605e958..0764093 100644
--- a/Source/WebCore/rendering/RenderThemeMac.mm
+++ b/Source/WebCore/rendering/RenderThemeMac.mm
@@ -1033,8 +1033,14 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn
paintInfo.context->save();
- RoundedIntRect border = o->style()->getRoundedBorderFor(r);
- int radius = border.radii().topLeft().width();
+ IntSize topLeftRadius;
+ IntSize topRightRadius;
+ IntSize bottomLeftRadius;
+ IntSize bottomRightRadius;
+
+ o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+
+ int radius = topLeftRadius.width();
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
@@ -1057,27 +1063,27 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
paintInfo.context->save();
CGContextClipToRect(context, r);
- paintInfo.context->addRoundedRectClip(border);
+ paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, mainShading.get());
paintInfo.context->restore();
paintInfo.context->save();
CGContextClipToRect(context, topGradient);
- paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize()));
+ paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize());
CGContextDrawShading(context, topShading.get());
paintInfo.context->restore();
if (!bottomGradient.isEmpty()) {
paintInfo.context->save();
CGContextClipToRect(context, bottomGradient);
- paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight()));
+ paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, bottomShading.get());
paintInfo.context->restore();
}
paintInfo.context->save();
CGContextClipToRect(context, r);
- paintInfo.context->addRoundedRectClip(border);
+ paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, leftShading.get());
CGContextDrawShading(context, rightShading.get());
paintInfo.context->restore();
@@ -1298,7 +1304,9 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf
mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
IntSize radius(trackRadius, trackRadius);
- paintInfo.context->addRoundedRectClip(RoundedIntRect(bounds, radius, radius, radius, radius));
+ paintInfo.context->addRoundedRectClip(bounds,
+ radius, radius,
+ radius, radius);
CGContextDrawShading(context, mainShading.get());
paintInfo.context->restore();
diff --git a/Source/WebCore/rendering/RenderThemeSafari.cpp b/Source/WebCore/rendering/RenderThemeSafari.cpp
index 47f627e..3c1dedc 100644
--- a/Source/WebCore/rendering/RenderThemeSafari.cpp
+++ b/Source/WebCore/rendering/RenderThemeSafari.cpp
@@ -752,8 +752,14 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain
paintInfo.context->save();
- RoundedIntRect bound = o->style()->getRoundedBorderFor(r);
- int radius = bound.radii().topLeft().width();
+ IntSize topLeftRadius;
+ IntSize topRightRadius;
+ IntSize bottomLeftRadius;
+ IntSize bottomRightRadius;
+
+ o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
+
+ int radius = topLeftRadius.width();
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
@@ -775,28 +781,28 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain
RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
paintInfo.context->save();
- CGContextClipToRect(context, bound.rect());
- paintInfo.context->addRoundedRectClip(bound);
+ CGContextClipToRect(context, r);
+ paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, mainShading.get());
paintInfo.context->restore();
paintInfo.context->save();
CGContextClipToRect(context, topGradient);
- paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), bound.radii().topLeft(), bound.radii().topRight(), IntSize(), IntSize()));
+ paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize());
CGContextDrawShading(context, topShading.get());
paintInfo.context->restore();
if (!bottomGradient.isEmpty()) {
paintInfo.context->save();
CGContextClipToRect(context, bottomGradient);
- paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight()));
+ paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, bottomShading.get());
paintInfo.context->restore();
}
paintInfo.context->save();
- CGContextClipToRect(context, bound.rect());
- paintInfo.context->addRoundedRectClip(bound);
+ CGContextClipToRect(context, r);
+ paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
CGContextDrawShading(context, leftShading.get());
CGContextDrawShading(context, rightShading.get());
paintInfo.context->restore();
@@ -952,35 +958,34 @@ const int trackRadius = 2;
bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
- IntSize radius(trackRadius, trackRadius);
- RoundedIntRect bounds(r, radius, radius, radius, radius);
-
- if (o->style()->appearance() == SliderHorizontalPart)
- bounds.setRect(IntRect(r.x(),
- r.y() + r.height() / 2 - trackWidth / 2,
- r.width(),
- trackWidth));
- else if (o->style()->appearance() == SliderVerticalPart)
- bounds.setRect(IntRect(r.x() + r.width() / 2 - trackWidth / 2,
- r.y(),
- trackWidth,
- r.height()));
+ IntRect bounds = r;
+
+ if (o->style()->appearance() == SliderHorizontalPart) {
+ bounds.setHeight(trackWidth);
+ bounds.setY(r.y() + r.height() / 2 - trackWidth / 2);
+ } else if (o->style()->appearance() == SliderVerticalPart) {
+ bounds.setWidth(trackWidth);
+ bounds.setX(r.x() + r.width() / 2 - trackWidth / 2);
+ }
CGContextRef context = paintInfo.context->platformContext();
CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
paintInfo.context->save();
- CGContextClipToRect(context, bounds.rect());
+ CGContextClipToRect(context, bounds);
struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
if (o->style()->appearance() == SliderVerticalPart)
- mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().bottom()), CGPointMake(bounds.rect().right(), bounds.rect().bottom()), mainFunction.get(), false, false));
+ mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false));
else
- mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().bottom()), mainFunction.get(), false, false));
+ mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false));
- paintInfo.context->addRoundedRectClip(bounds);
+ IntSize radius(trackRadius, trackRadius);
+ paintInfo.context->addRoundedRectClip(bounds,
+ radius, radius,
+ radius, radius);
CGContextDrawShading(context, mainShading.get());
paintInfo.context->restore();
diff --git a/Source/WebCore/rendering/RenderThemeWinCE.cpp b/Source/WebCore/rendering/RenderThemeWinCE.cpp
index d4bff96..2c55f31 100644
--- a/Source/WebCore/rendering/RenderThemeWinCE.cpp
+++ b/Source/WebCore/rendering/RenderThemeWinCE.cpp
@@ -378,7 +378,7 @@ bool RenderThemeWinCE::paintSearchFieldCancelButton(RenderObject* o, const Paint
int y = r.y() + (r.height() - cancelSize.height()) / 2 + 1;
IntRect cancelBounds(IntPoint(x, y), cancelSize);
paintInfo.context->save();
- paintInfo.context->addRoundedRectClip(RoundedIntRect(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius));
+ paintInfo.context->addRoundedRectClip(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius);
paintInfo.context->fillRect(cancelBounds, buttonColor, ColorSpaceDeviceRGB);
// Draw the 'x'
diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp
index d4b8ba6..22283a0 100644
--- a/Source/WebCore/rendering/RenderWidget.cpp
+++ b/Source/WebCore/rendering/RenderWidget.cpp
@@ -275,7 +275,11 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
- paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect));
+
+ IntSize topLeft, topRight, bottomLeft, bottomRight;
+ style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight);
+
+ paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
}
if (m_widget) {
diff --git a/Source/WebCore/rendering/style/BorderData.h b/Source/WebCore/rendering/style/BorderData.h
index 0e50edb..03635d9 100644
--- a/Source/WebCore/rendering/style/BorderData.h
+++ b/Source/WebCore/rendering/style/BorderData.h
@@ -26,7 +26,6 @@
#define BorderData_h
#include "BorderValue.h"
-#include "IntRect.h"
#include "LengthSize.h"
#include "NinePieceImage.h"
@@ -110,7 +109,7 @@ public:
const LengthSize& topRight() const { return m_topRight; }
const LengthSize& bottomLeft() const { return m_bottomLeft; }
const LengthSize& bottomRight() const { return m_bottomRight; }
-
+
private:
BorderValue m_left;
BorderValue m_right;
diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp
index 2836fb9..4665e52 100644
--- a/Source/WebCore/rendering/style/RenderStyle.cpp
+++ b/Source/WebCore/rendering/style/RenderStyle.cpp
@@ -744,19 +744,7 @@ void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add)
rareData->m_boxShadow.set(shadowData);
}
-static RoundedIntRect::Radii calcRadiiFor(const BorderData& border, int width, int height)
-{
- return RoundedIntRect::Radii(IntSize(border.topLeft().width().calcValue(width),
- border.topLeft().height().calcValue(height)),
- IntSize(border.topRight().width().calcValue(width),
- border.topRight().height().calcValue(height)),
- IntSize(border.bottomLeft().width().calcValue(width),
- border.bottomLeft().height().calcValue(height)),
- IntSize(border.bottomRight().width().calcValue(width),
- border.bottomRight().height().calcValue(height)));
-}
-
-static float calcConstraintScaleFor(const IntRect& rect, const RoundedIntRect::Radii& radii)
+static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight)
{
// Constrain corner radii using CSS3 rules:
// http://www.w3.org/TR/css3-background/#the-border-radius
@@ -765,43 +753,75 @@ static float calcConstraintScaleFor(const IntRect& rect, const RoundedIntRect::R
unsigned radiiSum;
// top
- radiiSum = static_cast<unsigned>(radii.topLeft().width()) + static_cast<unsigned>(radii.topRight().width()); // Casts to avoid integer overflow.
- if (radiiSum > static_cast<unsigned>(rect.width()))
- factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);
+ radiiSum = static_cast<unsigned>(topLeft.width()) + static_cast<unsigned>(topRight.width()); // Casts to avoid integer overflow.
+ if (radiiSum > static_cast<unsigned>(r.width()))
+ factor = min(static_cast<float>(r.width()) / radiiSum, factor);
// bottom
- radiiSum = static_cast<unsigned>(radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width());
- if (radiiSum > static_cast<unsigned>(rect.width()))
- factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);
+ radiiSum = static_cast<unsigned>(bottomLeft.width()) + static_cast<unsigned>(bottomRight.width());
+ if (radiiSum > static_cast<unsigned>(r.width()))
+ factor = min(static_cast<float>(r.width()) / radiiSum, factor);
// left
- radiiSum = static_cast<unsigned>(radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height());
- if (radiiSum > static_cast<unsigned>(rect.height()))
- factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);
+ radiiSum = static_cast<unsigned>(topLeft.height()) + static_cast<unsigned>(bottomLeft.height());
+ if (radiiSum > static_cast<unsigned>(r.height()))
+ factor = min(static_cast<float>(r.height()) / radiiSum, factor);
// right
- radiiSum = static_cast<unsigned>(radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height());
- if (radiiSum > static_cast<unsigned>(rect.height()))
- factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);
+ radiiSum = static_cast<unsigned>(topRight.height()) + static_cast<unsigned>(bottomRight.height());
+ if (radiiSum > static_cast<unsigned>(r.height()))
+ factor = min(static_cast<float>(r.height()) / radiiSum, factor);
- ASSERT(factor <= 1);
- return factor;
+ // Scale all radii by f if necessary.
+ if (factor < 1) {
+ // If either radius on a corner becomes zero, reset both radii on that corner.
+ topLeft.scale(factor);
+ if (!topLeft.width() || !topLeft.height())
+ topLeft = IntSize();
+ topRight.scale(factor);
+ if (!topRight.width() || !topRight.height())
+ topRight = IntSize();
+ bottomLeft.scale(factor);
+ if (!bottomLeft.width() || !bottomLeft.height())
+ bottomLeft = IntSize();
+ bottomRight.scale(factor);
+ if (!bottomRight.width() || !bottomRight.height())
+ bottomRight = IntSize();
+ }
}
-RoundedIntRect RenderStyle::getRoundedBorderFor(const IntRect& rect) const
+void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const
{
- RoundedIntRect::Radii radii = calcRadiiFor(surround->border, rect.width(), rect.height());
- radii.scale(calcConstraintScaleFor(rect, radii));
- return RoundedIntRect(rect, radii);
+ topLeft = IntSize(surround->border.topLeft().width().calcValue(r.width()), surround->border.topLeft().height().calcValue(r.height()));
+ topRight = IntSize(surround->border.topRight().width().calcValue(r.width()), surround->border.topRight().height().calcValue(r.height()));
+
+ bottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(r.width()), surround->border.bottomLeft().height().calcValue(r.height()));
+ bottomRight = IntSize(surround->border.bottomRight().width().calcValue(r.width()), surround->border.bottomRight().height().calcValue(r.height()));
+
+ constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight);
}
-RoundedIntRect RenderStyle::getRoundedInnerBorderWithBorderWidths(const IntRect& innerRect, unsigned short topWidth,
- unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const
+void RenderStyle::getInnerBorderRadiiForRectWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, IntSize& innerBottomRight) const
{
- RoundedIntRect::Radii radii = calcRadiiFor(surround->border, innerRect.width(), innerRect.height());
- radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth);
- radii.scale(calcConstraintScaleFor(innerRect, radii));
- return RoundedIntRect(innerRect, radii);
+ innerTopLeft = IntSize(surround->border.topLeft().width().calcValue(innerRect.width()), surround->border.topLeft().height().calcValue(innerRect.height()));
+ innerTopRight = IntSize(surround->border.topRight().width().calcValue(innerRect.width()), surround->border.topRight().height().calcValue(innerRect.height()));
+ innerBottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(innerRect.width()), surround->border.bottomLeft().height().calcValue(innerRect.height()));
+ innerBottomRight = IntSize(surround->border.bottomRight().width().calcValue(innerRect.width()), surround->border.bottomRight().height().calcValue(innerRect.height()));
+
+
+ innerTopLeft.setWidth(max(0, innerTopLeft.width() - leftWidth));
+ innerTopLeft.setHeight(max(0, innerTopLeft.height() - topWidth));
+
+ innerTopRight.setWidth(max(0, innerTopRight.width() - rightWidth));
+ innerTopRight.setHeight(max(0, innerTopRight.height() - topWidth));
+
+ innerBottomLeft.setWidth(max(0, innerBottomLeft.width() - leftWidth));
+ innerBottomLeft.setHeight(max(0, innerBottomLeft.height() - bottomWidth));
+
+ innerBottomRight.setWidth(max(0, innerBottomRight.width() - rightWidth));
+ innerBottomRight.setHeight(max(0, innerBottomRight.height() - bottomWidth));
+
+ constrainCornerRadiiForRect(innerRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight);
}
const CounterDirectiveMap* RenderStyle::counterDirectives() const
diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h
index 75ba048..64cd0a2 100644
--- a/Source/WebCore/rendering/style/RenderStyle.h
+++ b/Source/WebCore/rendering/style/RenderStyle.h
@@ -43,8 +43,6 @@
#include "NinePieceImage.h"
#include "OutlineValue.h"
#include "RenderStyleConstants.h"
-#include "RoundedIntRect.h"
-#include "ShadowData.h"
#include "StyleBackgroundData.h"
#include "StyleBoxData.h"
#include "StyleFlexibleBoxData.h"
@@ -848,10 +846,13 @@ public:
{
setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
}
+
- RoundedIntRect getRoundedBorderFor(const IntRect&) const;
- RoundedIntRect getRoundedInnerBorderWithBorderWidths(const IntRect&, unsigned short topWidth,
- unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const;
+ void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
+ void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth,
+ unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth,
+ IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft,
+ IntSize& innerBottomRight) const;
void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list