OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 namespace blink { | 65 namespace blink { |
66 | 66 |
67 namespace { | 67 namespace { |
68 | 68 |
69 class PathBuilder { | 69 class PathBuilder { |
70 WTF_MAKE_NONCOPYABLE(PathBuilder); | 70 WTF_MAKE_NONCOPYABLE(PathBuilder); |
71 public: | 71 public: |
72 PathBuilder() : m_path(TypeBuilder::Array<JSONValue>::create()) { } | 72 PathBuilder() : m_path(TypeBuilder::Array<JSONValue>::create()) { } |
73 virtual ~PathBuilder() { } | 73 virtual ~PathBuilder() { } |
74 | 74 |
75 PassRefPtr<TypeBuilder::Array<JSONValue> > path() const { return m_path; } | 75 PassRefPtr<TypeBuilder::Array<JSONValue>> path() const { return m_path; } |
76 void appendPath(const Path& path) | 76 void appendPath(const Path& path) |
77 { | 77 { |
78 path.apply(this, &PathBuilder::appendPathElement); | 78 path.apply(this, &PathBuilder::appendPathElement); |
79 } | 79 } |
80 | 80 |
81 protected: | 81 protected: |
82 virtual FloatPoint translatePoint(const FloatPoint& point) { return point; } | 82 virtual FloatPoint translatePoint(const FloatPoint& point) { return point; } |
83 | 83 |
84 private: | 84 private: |
85 static void appendPathElement(void* pathBuilder, const PathElement* pathElem
ent) | 85 static void appendPathElement(void* pathBuilder, const PathElement* pathElem
ent) |
86 { | 86 { |
87 static_cast<PathBuilder*>(pathBuilder)->appendPathElement(pathElement); | 87 static_cast<PathBuilder*>(pathBuilder)->appendPathElement(pathElement); |
88 } | 88 } |
89 | 89 |
90 void appendPathElement(const PathElement*); | 90 void appendPathElement(const PathElement*); |
91 void appendPathCommandAndPoints(const char* command, const FloatPoint points
[], size_t length); | 91 void appendPathCommandAndPoints(const char* command, const FloatPoint points
[], size_t length); |
92 | 92 |
93 RefPtr<TypeBuilder::Array<JSONValue> > m_path; | 93 RefPtr<TypeBuilder::Array<JSONValue>> m_path; |
94 }; | 94 }; |
95 | 95 |
96 class ShapePathBuilder : public PathBuilder { | 96 class ShapePathBuilder : public PathBuilder { |
97 public: | 97 public: |
98 ShapePathBuilder(FrameView& view, RenderObject& renderer, const ShapeOutside
Info& shapeOutsideInfo) | 98 ShapePathBuilder(FrameView& view, RenderObject& renderer, const ShapeOutside
Info& shapeOutsideInfo) |
99 : m_view(view) | 99 : m_view(view) |
100 , m_renderer(renderer) | 100 , m_renderer(renderer) |
101 , m_shapeOutsideInfo(shapeOutsideInfo) { } | 101 , m_shapeOutsideInfo(shapeOutsideInfo) { } |
102 | 102 |
103 static PassRefPtr<TypeBuilder::Array<JSONValue> > buildPath(FrameView& view,
RenderObject& renderer, const ShapeOutsideInfo& shapeOutsideInfo, const Path& p
ath) | 103 static PassRefPtr<TypeBuilder::Array<JSONValue>> buildPath(FrameView& view,
RenderObject& renderer, const ShapeOutsideInfo& shapeOutsideInfo, const Path& pa
th) |
104 { | 104 { |
105 ShapePathBuilder builder(view, renderer, shapeOutsideInfo); | 105 ShapePathBuilder builder(view, renderer, shapeOutsideInfo); |
106 builder.appendPath(path); | 106 builder.appendPath(path); |
107 return builder.path(); | 107 return builder.path(); |
108 } | 108 } |
109 | 109 |
110 protected: | 110 protected: |
111 virtual FloatPoint translatePoint(const FloatPoint& point) | 111 virtual FloatPoint translatePoint(const FloatPoint& point) |
112 { | 112 { |
113 FloatPoint rendererPoint = m_shapeOutsideInfo.shapeToRendererPoint(point
); | 113 FloatPoint rendererPoint = m_shapeOutsideInfo.shapeToRendererPoint(point
); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 case PathElementAddQuadCurveToPoint: | 571 case PathElementAddQuadCurveToPoint: |
572 appendPathCommandAndPoints("Q", pathElement->points, 2); | 572 appendPathCommandAndPoints("Q", pathElement->points, 2); |
573 break; | 573 break; |
574 // The points member will contain no values. | 574 // The points member will contain no values. |
575 case PathElementCloseSubpath: | 575 case PathElementCloseSubpath: |
576 appendPathCommandAndPoints("Z", 0, 0); | 576 appendPathCommandAndPoints("Z", 0, 0); |
577 break; | 577 break; |
578 } | 578 } |
579 } | 579 } |
580 | 580 |
581 static RefPtr<TypeBuilder::Array<double> > buildArrayForQuad(const FloatQuad& qu
ad) | 581 static RefPtr<TypeBuilder::Array<double>> buildArrayForQuad(const FloatQuad& qua
d) |
582 { | 582 { |
583 RefPtr<TypeBuilder::Array<double> > array = TypeBuilder::Array<double>::crea
te(); | 583 RefPtr<TypeBuilder::Array<double>> array = TypeBuilder::Array<double>::creat
e(); |
584 array->addItem(quad.p1().x()); | 584 array->addItem(quad.p1().x()); |
585 array->addItem(quad.p1().y()); | 585 array->addItem(quad.p1().y()); |
586 array->addItem(quad.p2().x()); | 586 array->addItem(quad.p2().x()); |
587 array->addItem(quad.p2().y()); | 587 array->addItem(quad.p2().y()); |
588 array->addItem(quad.p3().x()); | 588 array->addItem(quad.p3().x()); |
589 array->addItem(quad.p3().y()); | 589 array->addItem(quad.p3().y()); |
590 array->addItem(quad.p4().x()); | 590 array->addItem(quad.p4().x()); |
591 array->addItem(quad.p4().y()); | 591 array->addItem(quad.p4().y()); |
592 return array.release(); | 592 return array.release(); |
593 } | 593 } |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 hideHighlight(); | 890 hideHighlight(); |
891 } | 891 } |
892 | 892 |
893 void InspectorOverlay::startedRecordingProfile() | 893 void InspectorOverlay::startedRecordingProfile() |
894 { | 894 { |
895 if (!m_activeProfilerCount++) | 895 if (!m_activeProfilerCount++) |
896 freePage(); | 896 freePage(); |
897 } | 897 } |
898 | 898 |
899 } // namespace blink | 899 } // namespace blink |
OLD | NEW |