Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 329553003: Delete now-unnecessary hack for 0-size layers, now that we use transformOrigin (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 { 155 {
156 Page* page = layer.renderer()->frame()->page(); 156 Page* page = layer.renderer()->frame()->page();
157 if (!page) 157 if (!page)
158 return 0; 158 return 0;
159 159
160 return page->scrollingCoordinator(); 160 return page->scrollingCoordinator();
161 } 161 }
162 162
163 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) 163 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer)
164 : m_owningLayer(layer) 164 : m_owningLayer(layer)
165 , m_artificiallyInflatedBounds(false)
166 , m_isMainFrameRenderViewLayer(false) 165 , m_isMainFrameRenderViewLayer(false)
167 , m_requiresOwnBackingStoreForIntrinsicReasons(true) 166 , m_requiresOwnBackingStoreForIntrinsicReasons(true)
168 , m_requiresOwnBackingStoreForAncestorReasons(true) 167 , m_requiresOwnBackingStoreForAncestorReasons(true)
169 , m_canCompositeFilters(false) 168 , m_canCompositeFilters(false)
170 , m_backgroundLayerPaintsFixedRootBackground(false) 169 , m_backgroundLayerPaintsFixedRootBackground(false)
171 , m_needToUpdateGraphicsLayer(false) 170 , m_needToUpdateGraphicsLayer(false)
172 , m_needToUpdateGraphicsLayerOfAllDecendants(false) 171 , m_needToUpdateGraphicsLayerOfAllDecendants(false)
173 { 172 {
174 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) 173 if (layer.isRootLayer() && renderer()->frame()->isMainFrame())
175 m_isMainFrameRenderViewLayer = true; 174 m_isMainFrameRenderViewLayer = true;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // For non-root layers, background is always painted by the primary graphics layer. 311 // For non-root layers, background is always painted by the primary graphics layer.
313 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 312 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
314 if (m_backgroundLayer) { 313 if (m_backgroundLayer) {
315 m_graphicsLayer->setContentsOpaque(false); 314 m_graphicsLayer->setContentsOpaque(false);
316 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds())); 315 m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBe OpaqueInRect(compositedBounds()));
317 } else { 316 } else {
318 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds())); 317 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOp aqueInRect(compositedBounds()));
319 } 318 }
320 } 319 }
321 320
322 static bool hasNonZeroTransformOrigin(const RenderObject* renderer)
323 {
324 RenderStyle* style = renderer->style();
325 return (style->transformOriginX().type() == Fixed && style->transformOriginX ().value())
326 || (style->transformOriginY().type() == Fixed && style->transformOriginY ().value());
327 }
328
329 void CompositedLayerMapping::updateCompositedBounds(GraphicsLayerUpdater::Update Type updateType) 321 void CompositedLayerMapping::updateCompositedBounds(GraphicsLayerUpdater::Update Type updateType)
330 { 322 {
331 if (!shouldUpdateGraphicsLayer(updateType)) 323 if (!shouldUpdateGraphicsLayer(updateType))
332 return; 324 return;
333 325
334 LayoutRect layerBounds = m_owningLayer.boundingBoxForCompositing(); 326 // FIXME: if this is really needed for performance, it would be better to st ore it on RenderLayer.
335 327 m_compositedBounds = m_owningLayer.boundingBoxForCompositing();
336 // FIXME: either move this hack to RenderLayer or find a way to get rid of i t. Removing it from here
337 // will alow us to get rid of m_compositedBounds.
338
339 // If the element has a transform-origin that has fixed lengths, and the ren derer has zero size,
340 // then we need to ensure that the compositing layer has non-zero size so th at we can apply
341 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse d as a fractional value).
342 // FIXME: this code is no longer necessary, remove.
343 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) {
344 layerBounds.setWidth(1);
345 layerBounds.setHeight(1);
346 m_artificiallyInflatedBounds = true;
347 } else {
348 m_artificiallyInflatedBounds = false;
349 }
350
351 m_compositedBounds = layerBounds;
352 } 328 }
353 329
354 void CompositedLayerMapping::updateAfterWidgetResize() 330 void CompositedLayerMapping::updateAfterWidgetResize()
355 { 331 {
356 if (renderer()->isRenderPart()) { 332 if (renderer()->isRenderPart()) {
357 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram eContentsCompositor(toRenderPart(renderer()))) { 333 if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::fram eContentsCompositor(toRenderPart(renderer()))) {
358 innerCompositor->frameViewDidChangeSize(); 334 innerCompositor->frameViewDidChangeSize();
359 // We can floor this point because our frameviews are always aligned to pixel boundaries. 335 // We can floor this point because our frameviews are always aligned to pixel boundaries.
360 ASSERT(contentsBox().location() == flooredIntPoint(contentsBox().loc ation())); 336 ASSERT(contentsBox().location() == flooredIntPoint(contentsBox().loc ation()));
361 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location())); 337 innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contents Box().location()));
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 continue; 1596 continue;
1621 if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant( curLayer)) 1597 if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant( curLayer))
1622 return true; 1598 return true;
1623 } 1599 }
1624 1600
1625 return false; 1601 return false;
1626 } 1602 }
1627 1603
1628 bool CompositedLayerMapping::containsPaintedContent() const 1604 bool CompositedLayerMapping::containsPaintedContent() const
1629 { 1605 {
1630 if (paintsIntoCompositedAncestor() || m_artificiallyInflatedBounds || m_owni ngLayer.isReflection()) 1606 if (paintsIntoCompositedAncestor() || m_owningLayer.isReflection())
1631 return false; 1607 return false;
1632 1608
1633 if (isDirectlyCompositedImage()) 1609 if (isDirectlyCompositedImage())
1634 return false; 1610 return false;
1635 1611
1636 RenderObject* renderObject = renderer(); 1612 RenderObject* renderObject = renderer();
1637 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely, 1613 // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
1638 // and set background color on the layer in that case, instead of allocating backing store and painting. 1614 // and set background color on the layer in that case, instead of allocating backing store and painting.
1639 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo ()) 1615 if (renderObject->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo ())
1640 return m_owningLayer.hasBoxDecorationsOrBackground(); 1616 return m_owningLayer.hasBoxDecorationsOrBackground();
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
2240 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2216 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2241 name = "Scrolling Contents Layer"; 2217 name = "Scrolling Contents Layer";
2242 } else { 2218 } else {
2243 ASSERT_NOT_REACHED(); 2219 ASSERT_NOT_REACHED();
2244 } 2220 }
2245 2221
2246 return name; 2222 return name;
2247 } 2223 }
2248 2224
2249 } // namespace WebCore 2225 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698