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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "core/paint/PaintTiming.h" | 56 #include "core/paint/PaintTiming.h" |
57 #include "core/paint/ScrollableAreaPainter.h" | 57 #include "core/paint/ScrollableAreaPainter.h" |
58 #include "core/paint/TransformRecorder.h" | 58 #include "core/paint/TransformRecorder.h" |
59 #include "core/plugins/PluginView.h" | 59 #include "core/plugins/PluginView.h" |
60 #include "platform/LengthFunctions.h" | 60 #include "platform/LengthFunctions.h" |
61 #include "platform/RuntimeEnabledFeatures.h" | 61 #include "platform/RuntimeEnabledFeatures.h" |
62 #include "platform/fonts/FontCache.h" | 62 #include "platform/fonts/FontCache.h" |
63 #include "platform/geometry/TransformState.h" | 63 #include "platform/geometry/TransformState.h" |
64 #include "platform/graphics/BitmapImage.h" | 64 #include "platform/graphics/BitmapImage.h" |
65 #include "platform/graphics/GraphicsContext.h" | 65 #include "platform/graphics/GraphicsContext.h" |
| 66 #include "platform/graphics/GraphicsScreen.h" |
66 #include "platform/graphics/paint/ClipDisplayItem.h" | 67 #include "platform/graphics/paint/ClipDisplayItem.h" |
67 #include "platform/graphics/paint/CullRect.h" | 68 #include "platform/graphics/paint/CullRect.h" |
68 #include "platform/graphics/paint/PaintController.h" | 69 #include "platform/graphics/paint/PaintController.h" |
69 #include "platform/graphics/paint/TransformDisplayItem.h" | 70 #include "platform/graphics/paint/TransformDisplayItem.h" |
70 #include "wtf/CurrentTime.h" | 71 #include "wtf/CurrentTime.h" |
71 #include "wtf/text/StringBuilder.h" | 72 #include "wtf/text/StringBuilder.h" |
72 | 73 |
73 namespace blink { | 74 namespace blink { |
74 | 75 |
75 using namespace HTMLNames; | 76 using namespace HTMLNames; |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); | 1915 LayoutImage* imageLayoutObject = toLayoutImage(layoutObject()); |
1915 | 1916 |
1916 ImageResource* cachedImage = imageLayoutObject->cachedImage(); | 1917 ImageResource* cachedImage = imageLayoutObject->cachedImage(); |
1917 if (!cachedImage) | 1918 if (!cachedImage) |
1918 return; | 1919 return; |
1919 | 1920 |
1920 Image* image = cachedImage->image(); | 1921 Image* image = cachedImage->image(); |
1921 if (!image) | 1922 if (!image) |
1922 return; | 1923 return; |
1923 | 1924 |
| 1925 int64_t previousId = setCurrentScreenId(reinterpret_cast<int64_t>(layoutObje
ct()->frame()->page())); |
| 1926 |
1924 // This is a no-op if the layer doesn't have an inner layer for the image. | 1927 // This is a no-op if the layer doesn't have an inner layer for the image. |
1925 m_graphicsLayer->setContentsToImage(image, imageLayoutObject->shouldRespectI
mageOrientation()); | 1928 m_graphicsLayer->setContentsToImage(image, imageLayoutObject->shouldRespectI
mageOrientation()); |
1926 | 1929 |
1927 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering()
== ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality); | 1930 m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering()
== ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality); |
1928 | 1931 |
1929 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 | 1932 // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632 |
1930 updateDrawsContent(); | 1933 updateDrawsContent(); |
1931 | 1934 |
1932 // Image animation is "lazy", in that it automatically stops unless someone
is drawing | 1935 // Image animation is "lazy", in that it automatically stops unless someone
is drawing |
1933 // the image. So we have to kick the animation each time; this has the downs
ide that the | 1936 // the image. So we have to kick the animation each time; this has the downs
ide that the |
1934 // image will keep animating, even if its layer is not visible. | 1937 // image will keep animating, even if its layer is not visible. |
1935 image->startAnimation(); | 1938 image->startAnimation(); |
| 1939 |
| 1940 setCurrentScreenId(previousId); |
1936 } | 1941 } |
1937 | 1942 |
1938 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const | 1943 FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borde
rBox) const |
1939 { | 1944 { |
1940 const ComputedStyle& style = layoutObject()->styleRef(); | 1945 const ComputedStyle& style = layoutObject()->styleRef(); |
1941 | 1946 |
1942 FloatPoint3D origin; | 1947 FloatPoint3D origin; |
1943 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); | 1948 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width())
); |
1944 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); | 1949 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()
)); |
1945 origin.setZ(style.transformOriginZ()); | 1950 origin.setZ(style.transformOriginZ()); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 | 2323 |
2319 bool CompositedLayerMapping::needsRepaint() const | 2324 bool CompositedLayerMapping::needsRepaint() const |
2320 { | 2325 { |
2321 return m_owningLayer.needsRepaint(); | 2326 return m_owningLayer.needsRepaint(); |
2322 } | 2327 } |
2323 | 2328 |
2324 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const | 2329 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const |
2325 { | 2330 { |
2326 // https://code.google.com/p/chromium/issues/detail?id=343772 | 2331 // https://code.google.com/p/chromium/issues/detail?id=343772 |
2327 DisableCompositingQueryAsserts disabler; | 2332 DisableCompositingQueryAsserts disabler; |
| 2333 |
| 2334 int64_t previousId = setCurrentScreenId(reinterpret_cast<int64_t>(layoutObje
ct()->frame()->page())); |
| 2335 |
| 2336 // fprintf(stderr, "CompositedLayerMapping::paintContents begins page %ld\n"
, (long int) currentScreenId()); |
| 2337 // fflush(stderr); |
| 2338 |
2328 #if ENABLE(ASSERT) | 2339 #if ENABLE(ASSERT) |
2329 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. | 2340 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. |
2330 if (Page* page = layoutObject()->frame()->page()) | 2341 if (Page* page = layoutObject()->frame()->page()) |
2331 page->setIsPainting(true); | 2342 page->setIsPainting(true); |
2332 #endif | 2343 #endif |
2333 | 2344 |
2334 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); | 2345 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); |
2335 | 2346 |
2336 PaintLayerFlags paintLayerFlags = 0; | 2347 PaintLayerFlags paintLayerFlags = 0; |
2337 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 2348 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 } else if (graphicsLayer == layerForHorizontalScrollbar()) { | 2384 } else if (graphicsLayer == layerForHorizontalScrollbar()) { |
2374 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); | 2385 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); |
2375 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 2386 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
2376 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); | 2387 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); |
2377 } else if (graphicsLayer == layerForScrollCorner()) { | 2388 } else if (graphicsLayer == layerForScrollCorner()) { |
2378 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); | 2389 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); |
2379 CullRect cullRect(enclosingIntRect(interestRect)); | 2390 CullRect cullRect(enclosingIntRect(interestRect)); |
2380 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); | 2391 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); |
2381 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); | 2392 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); |
2382 } | 2393 } |
| 2394 |
2383 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, &context, LayoutRect(interestRect)); | 2395 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, &context, LayoutRect(interestRect)); |
| 2396 |
2384 #if ENABLE(ASSERT) | 2397 #if ENABLE(ASSERT) |
2385 if (Page* page = layoutObject()->frame()->page()) | 2398 if (Page* page = layoutObject()->frame()->page()) |
2386 page->setIsPainting(false); | 2399 page->setIsPainting(false); |
2387 #endif | 2400 #endif |
| 2401 |
| 2402 // fprintf(stderr, "CompositedLayerMapping::paintContents ends page %ld\n",
(long int) currentScreenId()); |
| 2403 // fflush(stderr); |
| 2404 |
| 2405 setCurrentScreenId(previousId); |
2388 } | 2406 } |
2389 | 2407 |
2390 bool CompositedLayerMapping::isTrackingPaintInvalidations() const | 2408 bool CompositedLayerMapping::isTrackingPaintInvalidations() const |
2391 { | 2409 { |
2392 GraphicsLayerClient* client = compositor(); | 2410 GraphicsLayerClient* client = compositor(); |
2393 return client ? client->isTrackingPaintInvalidations() : false; | 2411 return client ? client->isTrackingPaintInvalidations() : false; |
2394 } | 2412 } |
2395 | 2413 |
2396 #if ENABLE(ASSERT) | 2414 #if ENABLE(ASSERT) |
2397 void CompositedLayerMapping::verifyNotPainting() | 2415 void CompositedLayerMapping::verifyNotPainting() |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2583 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2566 name = "Scrolling Block Selection Layer"; | 2584 name = "Scrolling Block Selection Layer"; |
2567 } else { | 2585 } else { |
2568 ASSERT_NOT_REACHED(); | 2586 ASSERT_NOT_REACHED(); |
2569 } | 2587 } |
2570 | 2588 |
2571 return name; | 2589 return name; |
2572 } | 2590 } |
2573 | 2591 |
2574 } // namespace blink | 2592 } // namespace blink |
OLD | NEW |