Changeset 152175 in webkit
- Timestamp:
- Jun 28, 2013 10:31:30 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r152168 r152175 1 2013-06-28 Simon Fraser <simon.fraser@apple.com> 2 3 Allow some LayoutPoint and LayoutSize conversions to be inlined 4 https://bugs.webkit.org/show_bug.cgi?id=118167 5 6 Reviewed by Ryosuke Niwa. 7 8 Construction of FloatSize from LayoutSize, and FloatPoint's move(const LayoutSize&) 9 and moveBy(const LayoutPoint&) were not inlined, and showed up on some profiles. 10 11 Make them inlined by removing the overloaded functions, and instead providing 12 conversion operators from LayoutSize to FloatSize, and LayoutPoint to FloatPoint. 13 Do the same to allow a LayoutRect to be converted to a FloatRect. 14 15 This is nice because it removes pollution of FloatRect, FloatPoint and FloatSize with 16 Layout* entirely. 17 18 Remove Qt-specific conversions on LayoutRect, LayoutPoint and LayoutSize. Qt can 19 convert via IntRect/FloatRect as necessary. 20 21 * platform/graphics/FloatPoint.cpp: 22 * platform/graphics/FloatPoint.h: 23 (WebCore::FloatPoint::move): 24 (WebCore::FloatPoint::moveBy): 25 * platform/graphics/FloatRect.cpp: 26 * platform/graphics/FloatRect.h: 27 * platform/graphics/FloatSize.cpp: 28 * platform/graphics/FloatSize.h: 29 * platform/graphics/LayoutPoint.h: 30 (WebCore::LayoutPoint::operator FloatPoint): 31 * platform/graphics/LayoutRect.cpp: 32 * platform/graphics/LayoutRect.h: 33 (WebCore::LayoutRect::operator FloatRect): 34 * platform/graphics/LayoutSize.h: 35 (WebCore::LayoutSize::operator FloatSize): 36 1 37 2013-06-28 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 38 -
trunk/Source/WebCore/Target.pri
r152167 r152175 2860 2860 platform/graphics/qt/FloatRectQt.cpp \ 2861 2861 platform/graphics/qt/FloatSizeQt.cpp \ 2862 platform/graphics/qt/LayoutPointQt.cpp \2863 platform/graphics/qt/LayoutRectQt.cpp \2864 platform/graphics/qt/LayoutSizeQt.cpp \2865 2862 platform/graphics/qt/GradientQt.cpp \ 2866 2863 platform/graphics/qt/GraphicsContextQt.cpp \ -
trunk/Source/WebCore/platform/graphics/FloatPoint.cpp
r138800 r152175 31 31 #include "FloatConversion.h" 32 32 #include "IntPoint.h" 33 #include "LayoutPoint.h"34 #include "LayoutSize.h"35 33 #include "TransformationMatrix.h" 36 34 #include <limits> … … 40 38 41 39 FloatPoint::FloatPoint(const IntPoint& p) : m_x(p.x()), m_y(p.y()) 42 {43 }44 45 FloatPoint::FloatPoint(const LayoutPoint& p) : m_x(p.x()), m_y(p.y())46 40 { 47 41 } … … 65 59 { 66 60 return sqrtf(lengthSquared()); 67 }68 69 void FloatPoint::move(const LayoutSize& size)70 {71 m_x += size.width();72 m_y += size.height();73 }74 75 void FloatPoint::moveBy(const LayoutPoint& point)76 {77 m_x += point.x();78 m_y += point.y();79 61 } 80 62 -
trunk/Source/WebCore/platform/graphics/FloatPoint.h
r149193 r152175 65 65 class IntPoint; 66 66 class IntSize; 67 class LayoutPoint;68 class LayoutSize;69 67 70 68 class FloatPoint { … … 73 71 FloatPoint(float x, float y) : m_x(x), m_y(y) { } 74 72 FloatPoint(const IntPoint&); 75 FloatPoint(const LayoutPoint&);76 73 explicit FloatPoint(const FloatSize& size) : m_x(size.width()), m_y(size.height()) { } 77 74 … … 100 97 m_y += a.height(); 101 98 } 102 void move(const LayoutSize&);103 99 void move(const FloatSize& a) 104 100 { … … 111 107 m_y += a.y(); 112 108 } 113 void moveBy(const LayoutPoint&);114 109 void moveBy(const FloatPoint& a) 115 110 { -
trunk/Source/WebCore/platform/graphics/FloatRect.cpp
r133779 r152175 30 30 #include "FloatConversion.h" 31 31 #include "IntRect.h" 32 #include "LayoutRect.h"33 32 #include <algorithm> 34 33 #include <math.h> … … 41 40 42 41 FloatRect::FloatRect(const IntRect& r) : m_location(r.location()), m_size(r.size()) 43 {44 }45 46 FloatRect::FloatRect(const LayoutRect& r) : m_location(r.location()), m_size(r.size())47 42 { 48 43 } -
trunk/Source/WebCore/platform/graphics/FloatRect.h
r150437 r152175 63 63 namespace WebCore { 64 64 65 class LayoutRect;66 65 class IntRect; 67 66 class IntPoint; … … 80 79 : m_location(FloatPoint(x, y)), m_size(FloatSize(width, height)) { } 81 80 FloatRect(const IntRect&); 82 FloatRect(const LayoutRect&);83 81 84 82 static FloatRect narrowPrecision(double x, double y, double width, double height); -
trunk/Source/WebCore/platform/graphics/FloatSize.cpp
r133779 r152175 30 30 #include "FloatConversion.h" 31 31 #include "IntSize.h" 32 #include "LayoutSize.h"33 32 #include <limits> 34 33 #include <math.h> … … 39 38 40 39 FloatSize::FloatSize(const IntSize& size) : m_width(size.width()), m_height(size.height()) 41 {42 }43 44 FloatSize::FloatSize(const LayoutSize& size) : m_width(size.width()), m_height(size.height())45 40 { 46 41 } -
trunk/Source/WebCore/platform/graphics/FloatSize.h
r151642 r152175 61 61 62 62 class IntSize; 63 class LayoutSize;64 63 65 64 class FloatSize { … … 68 67 FloatSize(float width, float height) : m_width(width), m_height(height) { } 69 68 FloatSize(const IntSize&); 70 FloatSize(const LayoutSize&);71 69 72 70 static FloatSize narrowPrecision(double width, double height); -
trunk/Source/WebCore/platform/graphics/LayoutPoint.h
r133779 r152175 36 36 #include <wtf/MathExtras.h> 37 37 38 #if PLATFORM(QT)39 #include <qglobal.h>40 QT_BEGIN_NAMESPACE41 class QPoint;42 class QPointF;43 QT_END_NAMESPACE44 #endif45 46 38 namespace WebCore { 47 39 … … 90 82 return LayoutPoint(m_y, m_x); 91 83 } 92 93 #if PLATFORM(QT) 94 explicit LayoutPoint(const QPoint&); 95 explicit LayoutPoint(const QPointF&); 96 operator QPointF() const; 97 #endif 84 85 operator FloatPoint() const { return FloatPoint(m_x, m_y); } 98 86 99 87 private: -
trunk/Source/WebCore/platform/graphics/LayoutRect.cpp
r133779 r152175 32 32 #include "LayoutRect.h" 33 33 34 #include "FloatRect.h"35 #include "LayoutUnit.h"36 34 #include <algorithm> 37 35 -
trunk/Source/WebCore/platform/graphics/LayoutRect.h
r143410 r152175 32 32 #define LayoutRect_h 33 33 34 #include "FloatRect.h" 34 35 #include "IntRect.h" 35 36 #include "LayoutBoxExtent.h" 36 37 #include "LayoutPoint.h" 37 38 #include <wtf/Vector.h> 38 39 #if PLATFORM(QT)40 #include <qglobal.h>41 QT_BEGIN_NAMESPACE42 class QRect;43 class QRectF;44 QT_END_NAMESPACE45 #endif46 39 47 40 namespace WebCore { … … 176 169 return LayoutRect(LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMax(), LayoutUnit::nearlyMax()); 177 170 } 178 179 #if PLATFORM(QT) 180 explicit LayoutRect(const QRect&); 181 explicit LayoutRect(const QRectF&); 182 operator QRectF() const; 183 #endif 171 172 operator FloatRect() const { return FloatRect(m_location, m_size); } 184 173 185 174 private: -
trunk/Source/WebCore/platform/graphics/LayoutSize.h
r143410 r152175 35 35 #include "IntSize.h" 36 36 #include "LayoutUnit.h" 37 38 #if PLATFORM(QT)39 #include <qglobal.h>40 QT_BEGIN_NAMESPACE41 class QSize;42 class QSizeF;43 QT_END_NAMESPACE44 #endif45 37 46 38 namespace WebCore { … … 121 113 } 122 114 123 #if PLATFORM(QT) 124 explicit LayoutSize(const QSize&); 125 explicit LayoutSize(const QSizeF&); 126 operator QSizeF() const; 127 #endif 115 operator FloatSize() const { return FloatSize(m_width, m_height); } 128 116 129 117 private:
Note: See TracChangeset
for help on using the changeset viewer.