OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "core/paint/PaintTiming.h" | 54 #include "core/paint/PaintTiming.h" |
55 #include "core/paint/ScrollableAreaPainter.h" | 55 #include "core/paint/ScrollableAreaPainter.h" |
56 #include "core/paint/TransformRecorder.h" | 56 #include "core/paint/TransformRecorder.h" |
57 #include "core/plugins/PluginView.h" | 57 #include "core/plugins/PluginView.h" |
58 #include "platform/LengthFunctions.h" | 58 #include "platform/LengthFunctions.h" |
59 #include "platform/RuntimeEnabledFeatures.h" | 59 #include "platform/RuntimeEnabledFeatures.h" |
60 #include "platform/fonts/FontCache.h" | 60 #include "platform/fonts/FontCache.h" |
61 #include "platform/geometry/TransformState.h" | 61 #include "platform/geometry/TransformState.h" |
62 #include "platform/graphics/BitmapImage.h" | 62 #include "platform/graphics/BitmapImage.h" |
63 #include "platform/graphics/GraphicsContext.h" | 63 #include "platform/graphics/GraphicsContext.h" |
| 64 #include "platform/graphics/GraphicsScreen.h" |
64 #include "platform/graphics/paint/ClipDisplayItem.h" | 65 #include "platform/graphics/paint/ClipDisplayItem.h" |
65 #include "platform/graphics/paint/CullRect.h" | 66 #include "platform/graphics/paint/CullRect.h" |
66 #include "platform/graphics/paint/PaintController.h" | 67 #include "platform/graphics/paint/PaintController.h" |
67 #include "platform/graphics/paint/TransformDisplayItem.h" | 68 #include "platform/graphics/paint/TransformDisplayItem.h" |
68 #include "public/platform/WebCompositorMutableProperties.h" | 69 #include "public/platform/WebCompositorMutableProperties.h" |
69 #include "wtf/CurrentTime.h" | 70 #include "wtf/CurrentTime.h" |
70 #include "wtf/text/StringBuilder.h" | 71 #include "wtf/text/StringBuilder.h" |
71 | 72 |
72 namespace blink { | 73 namespace blink { |
73 | 74 |
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); | 1949 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); |
1949 | 1950 |
1950 ImageResource* cachedImage = imageLayoutObject->cachedImage(); | 1951 ImageResource* cachedImage = imageLayoutObject->cachedImage(); |
1951 if (!cachedImage) | 1952 if (!cachedImage) |
1952 return; | 1953 return; |
1953 | 1954 |
1954 Image* image = cachedImage->image(); | 1955 Image* image = cachedImage->image(); |
1955 if (!image) | 1956 if (!image) |
1956 return; | 1957 return; |
1957 | 1958 |
| 1959 uintptr_t previousId = setCurrentScreenId(Page::screenId(layoutObject()->fra
me()->page())); |
| 1960 |
1958 // This is a no-op if the layer doesn't have an inner layer for the image. | 1961 // This is a no-op if the layer doesn't have an inner layer for the image. |
1959 m_graphicsLayer->setContentsToImage(image, LayoutObject::shouldRespectImageO
rientation(imageLayoutObject)); | 1962 m_graphicsLayer->setContentsToImage(image, LayoutObject::shouldRespectImageO
rientation(imageLayoutObject)); |
1960 | 1963 |
1961 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering()
== ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality); | 1964 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering()
== ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality); |
1962 | 1965 |
1963 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 | 1966 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 |
1964 updateDrawsContent(); | 1967 updateDrawsContent(); |
1965 | 1968 |
1966 // Image animation is "lazy", in that it automatically stops unless someone
is drawing | 1969 // Image animation is "lazy", in that it automatically stops unless someone
is drawing |
1967 // the image. So we have to kick the animation each time; this has the downs
ide that the | 1970 // the image. So we have to kick the animation each time; this has the downs
ide that the |
1968 // image will keep animating, even if its layer is not visible. | 1971 // image will keep animating, even if its layer is not visible. |
1969 image->startAnimation(); | 1972 image->startAnimation(); |
| 1973 |
| 1974 setCurrentScreenId(previousId); |
1970 } | 1975 } |
1971 | 1976 |
1972 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const | 1977 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const |
1973 { | 1978 { |
1974 const ComputedStyle& style = layoutObject()->styleRef(); | 1979 const ComputedStyle& style = layoutObject()->styleRef(); |
1975 | 1980 |
1976 FloatPoint3D origin; | 1981 FloatPoint3D origin; |
1977 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); | 1982 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); |
1978 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); | 1983 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); |
1979 origin.setZ(style.transformOriginZ()); | 1984 origin.setZ(style.transformOriginZ()); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 | 2356 |
2352 bool CompositedLayerMapping::needsRepaint() const | 2357 bool CompositedLayerMapping::needsRepaint() const |
2353 { | 2358 { |
2354 return m_owningLayer.needsRepaint(); | 2359 return m_owningLayer.needsRepaint(); |
2355 } | 2360 } |
2356 | 2361 |
2357 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const | 2362 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const |
2358 { | 2363 { |
2359 // https://code.google.com/p/chromium/issues/detail?id=343772 | 2364 // https://code.google.com/p/chromium/issues/detail?id=343772 |
2360 DisableCompositingQueryAsserts disabler; | 2365 DisableCompositingQueryAsserts disabler; |
| 2366 |
| 2367 uintptr_t previousId = setCurrentScreenId(Page::screenId(layoutObject()->fra
me()->page())); |
| 2368 |
2361 #if ENABLE(ASSERT) | 2369 #if ENABLE(ASSERT) |
2362 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. | 2370 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. |
2363 if (Page* page = layoutObject()->frame()->page()) | 2371 if (Page* page = layoutObject()->frame()->page()) |
2364 page->setIsPainting(true); | 2372 page->setIsPainting(true); |
2365 #endif | 2373 #endif |
2366 | 2374 |
2367 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); | 2375 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); |
2368 | 2376 |
2369 PaintLayerFlags paintLayerFlags = 0; | 2377 PaintLayerFlags paintLayerFlags = 0; |
2370 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 2378 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 } else if (graphicsLayer == layerForHorizontalScrollbar()) { | 2414 } else if (graphicsLayer == layerForHorizontalScrollbar()) { |
2407 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); | 2415 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); |
2408 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 2416 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
2409 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); | 2417 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); |
2410 } else if (graphicsLayer == layerForScrollCorner()) { | 2418 } else if (graphicsLayer == layerForScrollCorner()) { |
2411 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); | 2419 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); |
2412 CullRect cullRect(enclosingIntRect(interestRect)); | 2420 CullRect cullRect(enclosingIntRect(interestRect)); |
2413 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(context, -scrollCornerAndResizerLocation, cullRect); | 2421 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(context, -scrollCornerAndResizerLocation, cullRect); |
2414 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(cont
ext, -scrollCornerAndResizerLocation, cullRect); | 2422 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(cont
ext, -scrollCornerAndResizerLocation, cullRect); |
2415 } | 2423 } |
| 2424 |
2416 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, context, LayoutRect(interestRect)); | 2425 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, context, LayoutRect(interestRect)); |
| 2426 |
2417 #if ENABLE(ASSERT) | 2427 #if ENABLE(ASSERT) |
2418 if (Page* page = layoutObject()->frame()->page()) | 2428 if (Page* page = layoutObject()->frame()->page()) |
2419 page->setIsPainting(false); | 2429 page->setIsPainting(false); |
2420 #endif | 2430 #endif |
| 2431 |
| 2432 setCurrentScreenId(previousId); |
2421 } | 2433 } |
2422 | 2434 |
2423 bool CompositedLayerMapping::isTrackingPaintInvalidations() const | 2435 bool CompositedLayerMapping::isTrackingPaintInvalidations() const |
2424 { | 2436 { |
2425 GraphicsLayerClient* client = compositor(); | 2437 GraphicsLayerClient* client = compositor(); |
2426 return client ? client->isTrackingPaintInvalidations() : false; | 2438 return client ? client->isTrackingPaintInvalidations() : false; |
2427 } | 2439 } |
2428 | 2440 |
2429 #if ENABLE(ASSERT) | 2441 #if ENABLE(ASSERT) |
2430 void CompositedLayerMapping::verifyNotPainting() | 2442 void CompositedLayerMapping::verifyNotPainting() |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2610 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2599 name = "Scrolling Block Selection Layer"; | 2611 name = "Scrolling Block Selection Layer"; |
2600 } else { | 2612 } else { |
2601 ASSERT_NOT_REACHED(); | 2613 ASSERT_NOT_REACHED(); |
2602 } | 2614 } |
2603 | 2615 |
2604 return name; | 2616 return name; |
2605 } | 2617 } |
2606 | 2618 |
2607 } // namespace blink | 2619 } // namespace blink |
OLD | NEW |