OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #if USE(ACCELERATED_COMPOSITING) | 28 #if USE(ACCELERATED_COMPOSITING) |
29 | 29 |
30 #include "GraphicsLayer.h" | 30 #include "GraphicsLayer.h" |
31 | 31 |
32 #include "FloatPoint.h" | 32 #include "FloatPoint.h" |
| 33 #include "GraphicsContext.h" |
| 34 #include "LayoutTypes.h" |
33 #include "RotateTransformOperation.h" | 35 #include "RotateTransformOperation.h" |
34 #include "TextStream.h" | 36 #include "TextStream.h" |
35 #include <wtf/text/CString.h> | 37 #include <wtf/text/CString.h> |
36 #include <wtf/text/WTFString.h> | 38 #include <wtf/text/WTFString.h> |
37 | 39 |
38 #ifndef NDEBUG | 40 #ifndef NDEBUG |
39 #include <stdio.h> | 41 #include <stdio.h> |
40 #endif | 42 #endif |
41 | 43 |
42 namespace WebCore { | 44 namespace WebCore { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 255 } |
254 | 256 |
255 void GraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) | 257 void GraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) |
256 { | 258 { |
257 if (layer) | 259 if (layer) |
258 layer->setReplicatedLayer(this); | 260 layer->setReplicatedLayer(this); |
259 | 261 |
260 m_replicaLayer = layer; | 262 m_replicaLayer = layer; |
261 } | 263 } |
262 | 264 |
| 265 void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset) |
| 266 { |
| 267 if (offset == m_offsetFromRenderer) |
| 268 return; |
| 269 |
| 270 m_offsetFromRenderer = offset; |
| 271 |
| 272 // If the compositing layer offset changes, we need to repaint. |
| 273 setNeedsDisplay(); |
| 274 } |
| 275 |
263 void GraphicsLayer::setBackgroundColor(const Color& color) | 276 void GraphicsLayer::setBackgroundColor(const Color& color) |
264 { | 277 { |
265 m_backgroundColor = color; | 278 m_backgroundColor = color; |
266 m_backgroundColorSet = true; | 279 m_backgroundColorSet = true; |
267 } | 280 } |
268 | 281 |
269 void GraphicsLayer::clearBackgroundColor() | 282 void GraphicsLayer::clearBackgroundColor() |
270 { | 283 { |
271 m_backgroundColor = Color(); | 284 m_backgroundColor = Color(); |
272 m_backgroundColorSet = false; | 285 m_backgroundColorSet = false; |
273 } | 286 } |
274 | 287 |
275 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) | 288 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) |
276 { | 289 { |
277 #ifndef NDEBUG | 290 #ifndef NDEBUG |
278 s_inPaintContents = true; | 291 s_inPaintContents = true; |
279 #endif | 292 #endif |
280 if (m_client) | 293 if (m_client) { |
281 m_client->paintContents(this, context, m_paintingPhase, clip); | 294 LayoutSize offset = offsetFromRenderer(); |
| 295 context.translate(-offset); |
| 296 |
| 297 LayoutRect clipRect(clip); |
| 298 clipRect.move(offset); |
| 299 |
| 300 m_client->paintContents(this, context, m_paintingPhase, clipRect); |
| 301 } |
282 #ifndef NDEBUG | 302 #ifndef NDEBUG |
283 s_inPaintContents = false; | 303 s_inPaintContents = false; |
284 #endif | 304 #endif |
285 } | 305 } |
286 | 306 |
287 String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property) | 307 String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property) |
288 { | 308 { |
289 // | is not a valid identifier character in CSS, so this can never conflict
with a keyframe identifier. | 309 // | is not a valid identifier character in CSS, so this can never conflict
with a keyframe identifier. |
290 String id = "-|transition"; | 310 String id = "-|transition"; |
291 id.append(static_cast<char>(property)); | 311 id.append(static_cast<char>(property)); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 { | 608 { |
589 if (!layer) | 609 if (!layer) |
590 return; | 610 return; |
591 | 611 |
592 WTF::String output = layer->layerTreeAsText(LayerTreeAsTextDebug); | 612 WTF::String output = layer->layerTreeAsText(LayerTreeAsTextDebug); |
593 fprintf(stderr, "%s\n", output.utf8().data()); | 613 fprintf(stderr, "%s\n", output.utf8().data()); |
594 } | 614 } |
595 #endif | 615 #endif |
596 | 616 |
597 #endif // USE(ACCELERATED_COMPOSITING) | 617 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |