| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 | 2319 |
| 2315 bool CompositedLayerMapping::needsRepaint() const | 2320 bool CompositedLayerMapping::needsRepaint() const |
| 2316 { | 2321 { |
| 2317 return m_owningLayer.needsRepaint(); | 2322 return m_owningLayer.needsRepaint(); |
| 2318 } | 2323 } |
| 2319 | 2324 |
| 2320 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const | 2325 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G
raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase,
const IntRect& interestRect) const |
| 2321 { | 2326 { |
| 2322 // https://code.google.com/p/chromium/issues/detail?id=343772 | 2327 // https://code.google.com/p/chromium/issues/detail?id=343772 |
| 2323 DisableCompositingQueryAsserts disabler; | 2328 DisableCompositingQueryAsserts disabler; |
| 2329 |
| 2330 int64_t previousId = setCurrentScreenId(reinterpret_cast<int64_t>(layoutObje
ct()->frame()->page())); |
| 2331 |
| 2332 // fprintf(stderr, "CompositedLayerMapping::paintContents begins page %ld\n"
, (long int) currentScreenId()); |
| 2333 // fflush(stderr); |
| 2334 |
| 2324 #if ENABLE(ASSERT) | 2335 #if ENABLE(ASSERT) |
| 2325 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. | 2336 // FIXME: once the state machine is ready, this can be removed and we can re
fer to that instead. |
| 2326 if (Page* page = layoutObject()->frame()->page()) | 2337 if (Page* page = layoutObject()->frame()->page()) |
| 2327 page->setIsPainting(true); | 2338 page->setIsPainting(true); |
| 2328 #endif | 2339 #endif |
| 2329 | 2340 |
| 2330 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); | 2341 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data
(m_owningLayer.layoutObject(), LayoutRect(interestRect), graphicsLayer)); |
| 2331 | 2342 |
| 2332 PaintLayerFlags paintLayerFlags = 0; | 2343 PaintLayerFlags paintLayerFlags = 0; |
| 2333 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) | 2344 if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 } else if (graphicsLayer == layerForHorizontalScrollbar()) { | 2380 } else if (graphicsLayer == layerForHorizontalScrollbar()) { |
| 2370 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); | 2381 paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), co
ntext, interestRect); |
| 2371 } else if (graphicsLayer == layerForVerticalScrollbar()) { | 2382 } else if (graphicsLayer == layerForVerticalScrollbar()) { |
| 2372 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); | 2383 paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), cont
ext, interestRect); |
| 2373 } else if (graphicsLayer == layerForScrollCorner()) { | 2384 } else if (graphicsLayer == layerForScrollCorner()) { |
| 2374 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); | 2385 IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()
->scrollCornerAndResizerRect().location(); |
| 2375 CullRect cullRect(enclosingIntRect(interestRect)); | 2386 CullRect cullRect(enclosingIntRect(interestRect)); |
| 2376 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); | 2387 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner
(&context, -scrollCornerAndResizerLocation, cullRect); |
| 2377 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); | 2388 ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&con
text, -scrollCornerAndResizerLocation, cullRect); |
| 2378 } | 2389 } |
| 2390 |
| 2379 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, &context, LayoutRect(interestRect)); | 2391 InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLay
er, &context, LayoutRect(interestRect)); |
| 2392 |
| 2380 #if ENABLE(ASSERT) | 2393 #if ENABLE(ASSERT) |
| 2381 if (Page* page = layoutObject()->frame()->page()) | 2394 if (Page* page = layoutObject()->frame()->page()) |
| 2382 page->setIsPainting(false); | 2395 page->setIsPainting(false); |
| 2383 #endif | 2396 #endif |
| 2397 |
| 2398 // fprintf(stderr, "CompositedLayerMapping::paintContents ends page %ld\n",
(long int) currentScreenId()); |
| 2399 // fflush(stderr); |
| 2400 |
| 2401 setCurrentScreenId(previousId); |
| 2384 } | 2402 } |
| 2385 | 2403 |
| 2386 bool CompositedLayerMapping::isTrackingPaintInvalidations() const | 2404 bool CompositedLayerMapping::isTrackingPaintInvalidations() const |
| 2387 { | 2405 { |
| 2388 GraphicsLayerClient* client = compositor(); | 2406 GraphicsLayerClient* client = compositor(); |
| 2389 return client ? client->isTrackingPaintInvalidations() : false; | 2407 return client ? client->isTrackingPaintInvalidations() : false; |
| 2390 } | 2408 } |
| 2391 | 2409 |
| 2392 #if ENABLE(ASSERT) | 2410 #if ENABLE(ASSERT) |
| 2393 void CompositedLayerMapping::verifyNotPainting() | 2411 void CompositedLayerMapping::verifyNotPainting() |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2579 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2562 name = "Scrolling Block Selection Layer"; | 2580 name = "Scrolling Block Selection Layer"; |
| 2563 } else { | 2581 } else { |
| 2564 ASSERT_NOT_REACHED(); | 2582 ASSERT_NOT_REACHED(); |
| 2565 } | 2583 } |
| 2566 | 2584 |
| 2567 return name; | 2585 return name; |
| 2568 } | 2586 } |
| 2569 | 2587 |
| 2570 } // namespace blink | 2588 } // namespace blink |
| OLD | NEW |