diff options
Diffstat (limited to 'Source/Platform')
-rw-r--r-- | Source/Platform/ChangeLog | 86 | ||||
-rw-r--r-- | Source/Platform/Platform.gyp/Platform.gyp | 28 | ||||
-rw-r--r-- | Source/Platform/Platform.gypi | 9 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebFloatPoint.h | 91 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebFloatQuad.h | 82 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebFloatRect.h | 103 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebPoint.h | 111 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebRect.h | 127 | ||||
-rw-r--r-- | Source/Platform/chromium/public/WebSize.h | 113 | ||||
-rw-r--r-- | Source/Platform/chromium/src/WebFloatQuad.cpp | 51 |
10 files changed, 800 insertions, 1 deletions
diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index fc45347b2..45c8504ed 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,89 @@ +2012-02-08 James Robinson <jamesr@chromium.org> + + r107042 caused compile breakages on chromium try bots + https://bugs.webkit.org/show_bug.cgi?id=78125 + + Reviewed by Adam Barth. + + Replace the copy script with a copies GYP action since the MSVS generator tracks dependencies on a per-file + basis. + + * Platform.gyp/Platform.gyp: + * Platform.gyp/copy_webcore_headers.py: Removed. + +2012-02-07 James Robinson <jamesr@chromium.org> + + [chromium] Move geometry headers in Platform API to Platform directory + https://bugs.webkit.org/show_bug.cgi?id=78067 + + Reviewed by Adam Barth. + + This moves several geometry-related headers in the chromium WebKit platform API to Platform/chromium/public. + These require a bit of extra work since when WEBKIT_IMPLEMENTATION is set they #include headers from + WebCore/platform such as IntPoint so that the implementations of several functions can be inlined. Since we do + not want to add anything in WebCore to the include path of projects that depend on the Platform API this poses a + bit of an issue. I've added an extra build step to copy the specific headers used into the + SHARED_INTERMEDIATE_DIR to preserve this inlining. + + Eventually we'll move the cross-platform code, including these headers, into somewhere under Platform/, but doing + that requires non-trivial modifications to every build system in WebKit. + + * Platform.gyp/Platform.gyp: + * Platform.gyp/copy_webcore_headers.py: Added. + (CopyHeaders): + (Main): + * chromium/public/WebFloatPoint.h: Copied from Source/WebKit/chromium/public/platform/WebFloatPoint.h. + (WebKit): + (WebFloatPoint): + (WebKit::WebFloatPoint::WebFloatPoint): + (WebKit::WebFloatPoint::operator=): + (WebKit::WebFloatPoint::operator WebCore::FloatPoint): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebFloatQuad.h: Copied from Source/WebKit/chromium/public/platform/WebFloatQuad.h. + (WebKit): + (WebFloatQuad): + (WebKit::WebFloatQuad::WebFloatQuad): + (WebKit::WebFloatQuad::operator=): + * chromium/public/WebFloatRect.h: Copied from Source/WebKit/chromium/public/platform/WebFloatRect.h. + (WebKit): + (WebFloatRect): + (WebKit::WebFloatRect::isEmpty): + (WebKit::WebFloatRect::WebFloatRect): + (WebKit::WebFloatRect::operator=): + (WebKit::WebFloatRect::operator WebCore::FloatRect): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebPoint.h: Copied from Source/WebKit/chromium/public/platform/WebPoint.h. + (WebKit): + (WebPoint): + (WebKit::WebPoint::WebPoint): + (WebKit::WebPoint::operator=): + (WebKit::WebPoint::operator WebCore::IntPoint): + (WebKit::WebPoint::operator gfx::Point): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebRect.h: Copied from Source/WebKit/chromium/public/platform/WebRect.h. + (WebKit): + (WebRect): + (WebKit::WebRect::isEmpty): + (WebKit::WebRect::WebRect): + (WebKit::WebRect::operator=): + (WebKit::WebRect::operator WebCore::IntRect): + (WebKit::WebRect::operator gfx::Rect): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebSize.h: Copied from Source/WebKit/chromium/public/platform/WebSize.h. + (WebKit): + (WebSize): + (WebKit::WebSize::isEmpty): + (WebKit::WebSize::WebSize): + (WebKit::WebSize::operator=): + (WebKit::WebSize::operator WebCore::IntSize): + (WebKit::WebSize::operator gfx::Size): + (WebKit::operator==): + (WebKit::operator!=): + 2012-01-19 Joi Sigurdsson <joi@chromium.org> Enable use of precompiled headers in Chromium port on Windows. diff --git a/Source/Platform/Platform.gyp/Platform.gyp b/Source/Platform/Platform.gyp/Platform.gyp index d3d4bbe07..9182ab392 100644 --- a/Source/Platform/Platform.gyp/Platform.gyp +++ b/Source/Platform/Platform.gyp/Platform.gyp @@ -43,6 +43,7 @@ ], 'include_dirs': [ '../chromium', + '<(output_dir)', ], 'defines': [ 'WEBKIT_IMPLEMENTATION=1', @@ -50,9 +51,28 @@ 'sources': [ '<@(platform_files)', ], + 'variables': { + # List of headers that are #included in Platform API headers that exist inside + # the WebCore directory. These are only included when WEBKIT_IMPLEMENTATION=1. + # Since Platform/ can't add WebCore/* to the include path, this build step + # copies these headers into the shared intermediate directory and adds that to the include path. + # This is temporary, the better solution is to move these headers into the Platform + # directory for all ports and just use them as normal. + 'webcore_headers': [ + '../../WebCore/platform/graphics/FloatPoint.h', + '../../WebCore/platform/graphics/FloatQuad.h', + '../../WebCore/platform/graphics/FloatRect.h', + '../../WebCore/platform/graphics/FloatSize.h', + '../../WebCore/platform/graphics/IntPoint.h', + '../../WebCore/platform/graphics/IntRect.h', + '../../WebCore/platform/graphics/IntSize.h', + ], + 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/webcore_headers' + }, 'direct_dependent_settings': { 'include_dirs': [ '../chromium', + '<(output_dir)' ], }, 'conditions': [ @@ -65,6 +85,14 @@ }], ], }], + ], + 'copies': [ + { + 'destination': '<(output_dir)', + 'files': [ + '<@(webcore_headers)' + ] + } ] } ] diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index 17e50adc1..c4da4d9dc 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -33,9 +33,16 @@ 'platform_files': [ 'chromium/public/WebCString.h', 'chromium/public/WebCommon.h', - 'chromium/public/WebString.h', + 'chromium/public/WebFloatPoint.h', + 'chromium/public/WebFloatQuad.h', + 'chromium/public/WebFloatRect.h', 'chromium/public/WebMimeRegistry.h', + 'chromium/public/WebPoint.h', + 'chromium/public/WebRect.h', + 'chromium/public/WebSize.h', + 'chromium/public/WebString.h', 'chromium/src/WebCString.cpp', + 'chromium/src/WebFloatQuad.cpp', 'chromium/src/WebString.cpp', ] } diff --git a/Source/Platform/chromium/public/WebFloatPoint.h b/Source/Platform/chromium/public/WebFloatPoint.h new file mode 100644 index 000000000..4afc16b9c --- /dev/null +++ b/Source/Platform/chromium/public/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebFloatQuad.h b/Source/Platform/chromium/public/WebFloatQuad.h new file mode 100644 index 000000000..da5eb0542 --- /dev/null +++ b/Source/Platform/chromium/public/WebFloatQuad.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebFloatQuad_h +#define WebFloatQuad_h + +#include "WebCommon.h" +#include "WebFloatPoint.h" +#include "WebRect.h" + +#include <algorithm> +#include <cmath> + +#if WEBKIT_IMPLEMENTATION +#include "FloatQuad.h" +#endif + +namespace WebKit { + +struct WebFloatQuad { + WebFloatPoint p[4]; + + WebFloatQuad() + { + } + + WebFloatQuad(const WebFloatPoint& p0, const WebFloatPoint& p1, const WebFloatPoint& p2, const WebFloatPoint& p3) + { + p[0] = p0; + p[1] = p1; + p[2] = p2; + p[3] = p3; + } + + WEBKIT_EXPORT WebRect enclosingRect() const; + +#if WEBKIT_IMPLEMENTATION + WebFloatQuad& operator=(const WebCore::FloatQuad& q) + { + p[0] = q.p1(); + p[1] = q.p2(); + p[2] = q.p3(); + p[3] = q.p4(); + return *this; + } + WebFloatQuad(const WebCore::FloatQuad& q) + { + *this = q; + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebFloatRect.h b/Source/Platform/chromium/public/WebFloatRect.h new file mode 100644 index 000000000..a883513fc --- /dev/null +++ b/Source/Platform/chromium/public/WebFloatRect.h @@ -0,0 +1,103 @@ +/* + * 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebFloatRect_h +#define WebFloatRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif + +namespace WebKit { + +struct WebFloatRect { + float x; + float y; + float width; + float height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebPoint.h b/Source/Platform/chromium/public/WebPoint.h new file mode 100644 index 000000000..766236398 --- /dev/null +++ b/Source/Platform/chromium/public/WebPoint.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebPoint_h +#define WebPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#else +#include <ui/gfx/point.h> +#endif + +namespace WebKit { + +struct WebPoint { + int x; + int y; + + WebPoint() + : x(0) + , y(0) + { + } + + WebPoint(int x, int y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebPoint(const WebCore::IntPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const WebCore::IntPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::IntPoint() const + { + return WebCore::IntPoint(x, y); + } +#else + WebPoint(const gfx::Point& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const gfx::Point& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator gfx::Point() const + { + return gfx::Point(x, y); + } +#endif +}; + +inline bool operator==(const WebPoint& a, const WebPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebPoint& a, const WebPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebRect.h b/Source/Platform/chromium/public/WebRect.h new file mode 100644 index 000000000..045b7a8eb --- /dev/null +++ b/Source/Platform/chromium/public/WebRect.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2009 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebRect_h +#define WebRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#else +#include <ui/gfx/rect.h> +#endif + +namespace WebKit { + +struct WebRect { + int x; + int y; + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebRect() + : x(0) + , y(0) + , width(0) + , height(0) + { + } + + WebRect(int x, int y, int width, int height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebRect(const WebCore::IntRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const WebCore::IntRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::IntRect() const + { + return WebCore::IntRect(x, y, width, height); + } +#else + WebRect(const gfx::Rect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const gfx::Rect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::Rect() const + { + return gfx::Rect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebRect& a, const WebRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebRect& a, const WebRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebSize.h b/Source/Platform/chromium/public/WebSize.h new file mode 100644 index 000000000..94a53654d --- /dev/null +++ b/Source/Platform/chromium/public/WebSize.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 WebSize_h +#define WebSize_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntSize.h" +#else +#include <ui/gfx/size.h> +#endif + +namespace WebKit { + +struct WebSize { + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebSize() + : width(0) + , height(0) + { + } + + WebSize(int width, int height) + : width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebSize(const WebCore::IntSize& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const WebCore::IntSize& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator WebCore::IntSize() const + { + return WebCore::IntSize(width, height); + } +#else + WebSize(const gfx::Size& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const gfx::Size& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator gfx::Size() const + { + return gfx::Size(width, height); + } +#endif +}; + +inline bool operator==(const WebSize& a, const WebSize& b) +{ + return a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebSize& a, const WebSize& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/src/WebFloatQuad.cpp b/Source/Platform/chromium/src/WebFloatQuad.cpp new file mode 100644 index 000000000..67cbdc601 --- /dev/null +++ b/Source/Platform/chromium/src/WebFloatQuad.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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 <public/WebFloatQuad.h> + +#include <algorithm> +#include <math.h> + +using namespace std; + +namespace WebKit { + +WebRect WebFloatQuad::enclosingRect() const +{ + int left = static_cast<int>(floorf(min(min(min(p[0].x, p[1].x), p[2].x), p[3].x))); + int top = static_cast<int>(floorf(min(min(min(p[0].y, p[1].y), p[2].y), p[3].y))); + int right = static_cast<int>(ceilf(max(max(max(p[0].x, p[1].x), p[2].x), p[3].x))); + int bottom = static_cast<int>(ceilf(max(max(max(p[0].y, p[1].y), p[2].y), p[3].y))); + + return WebRect(left, top, right - left, bottom - top); +} + +} // namespace WebKit |