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

Side by Side Diff: Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 static inline bool isAcceleratedCanvas(const LayoutObject* renderer) 110 static inline bool isAcceleratedCanvas(const LayoutObject* renderer)
111 { 111 {
112 if (renderer->isCanvas()) { 112 if (renderer->isCanvas()) {
113 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); 113 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
114 if (CanvasRenderingContext* context = canvas->renderingContext()) 114 if (CanvasRenderingContext* context = canvas->renderingContext())
115 return context->isAccelerated(); 115 return context->isAccelerated();
116 } 116 }
117 return false; 117 return false;
118 } 118 }
119 119
120 static bool hasBoxDecorationsOrBackgroundImage(const LayoutStyle& style) 120 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style)
121 { 121 {
122 return style.hasBoxDecorations() || style.hasBackgroundImage(); 122 return style.hasBoxDecorations() || style.hasBackgroundImage();
123 } 123 }
124 124
125 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* renderer) 125 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* renderer)
126 { 126 {
127 // No support for decorations - border, border-radius or outline. 127 // No support for decorations - border, border-radius or outline.
128 // Only simple background - solid color or transparent. 128 // Only simple background - solid color or transparent.
129 if (hasBoxDecorationsOrBackgroundImage(renderer->styleRef())) 129 if (hasBoxDecorationsOrBackgroundImage(renderer->styleRef()))
130 return false; 130 return false;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 m_childContainmentLayer = nullptr; 253 m_childContainmentLayer = nullptr;
254 m_childTransformLayer = nullptr; 254 m_childTransformLayer = nullptr;
255 m_maskLayer = nullptr; 255 m_maskLayer = nullptr;
256 m_childClippingMaskLayer = nullptr; 256 m_childClippingMaskLayer = nullptr;
257 257
258 m_scrollingLayer = nullptr; 258 m_scrollingLayer = nullptr;
259 m_scrollingContentsLayer = nullptr; 259 m_scrollingContentsLayer = nullptr;
260 m_scrollingBlockSelectionLayer = nullptr; 260 m_scrollingBlockSelectionLayer = nullptr;
261 } 261 }
262 262
263 void CompositedDeprecatedPaintLayerMapping::updateOpacity(const LayoutStyle& sty le) 263 void CompositedDeprecatedPaintLayerMapping::updateOpacity(const ComputedStyle& s tyle)
264 { 264 {
265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity())); 265 m_graphicsLayer->setOpacity(compositingOpacity(style.opacity()));
266 } 266 }
267 267
268 void CompositedDeprecatedPaintLayerMapping::updateTransform(const LayoutStyle& s tyle) 268 void CompositedDeprecatedPaintLayerMapping::updateTransform(const ComputedStyle& style)
269 { 269 {
270 // FIXME: This could use m_owningLayer.transform(), but that currently has t ransform-origin 270 // FIXME: This could use m_owningLayer.transform(), but that currently has t ransform-origin
271 // baked into it, and we don't want that. 271 // baked into it, and we don't want that.
272 TransformationMatrix t; 272 TransformationMatrix t;
273 if (m_owningLayer.hasTransformRelatedProperty()) { 273 if (m_owningLayer.hasTransformRelatedProperty()) {
274 style.applyTransform(t, LayoutSize(toLayoutBox(layoutObject())->pixelSna ppedSize()), LayoutStyle::ExcludeTransformOrigin); 274 style.applyTransform(t, LayoutSize(toLayoutBox(layoutObject())->pixelSna ppedSize()), ComputedStyle::ExcludeTransformOrigin);
275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing()); 275 makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing());
276 } 276 }
277 277
278 m_graphicsLayer->setTransform(t); 278 m_graphicsLayer->setTransform(t);
279 } 279 }
280 280
281 void CompositedDeprecatedPaintLayerMapping::updateFilters(const LayoutStyle& sty le) 281 void CompositedDeprecatedPaintLayerMapping::updateFilters(const ComputedStyle& s tyle)
282 { 282 {
283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style)); 283 m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style));
284 } 284 }
285 285
286 void CompositedDeprecatedPaintLayerMapping::updateLayerBlendMode(const LayoutSty le& style) 286 void CompositedDeprecatedPaintLayerMapping::updateLayerBlendMode(const ComputedS tyle& style)
287 { 287 {
288 setBlendMode(style.blendMode()); 288 setBlendMode(style.blendMode());
289 } 289 }
290 290
291 void CompositedDeprecatedPaintLayerMapping::updateIsRootForIsolatedGroup() 291 void CompositedDeprecatedPaintLayerMapping::updateIsRootForIsolatedGroup()
292 { 292 {
293 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants(); 293 bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
294 294
295 // non stacking context layers should never isolate 295 // non stacking context layers should never isolate
296 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate); 296 ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
297 297
298 m_graphicsLayer->setIsRootForIsolatedGroup(isolate); 298 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
299 } 299 }
300 300
301 void CompositedDeprecatedPaintLayerMapping::updateScrollBlocksOn(const LayoutSty le& style) 301 void CompositedDeprecatedPaintLayerMapping::updateScrollBlocksOn(const ComputedS tyle& style)
302 { 302 {
303 // Note that blink determines the default scroll blocking policy, even 303 // Note that blink determines the default scroll blocking policy, even
304 // when the scroll-blocks-on CSS feature isn't enabled. 304 // when the scroll-blocks-on CSS feature isn't enabled.
305 WebScrollBlocksOn blockingMode = WebScrollBlocksOnStartTouch | WebScrollBloc ksOnWheelEvent; 305 WebScrollBlocksOn blockingMode = WebScrollBlocksOnStartTouch | WebScrollBloc ksOnWheelEvent;
306 306
307 if (RuntimeEnabledFeatures::cssScrollBlocksOnEnabled()) 307 if (RuntimeEnabledFeatures::cssScrollBlocksOnEnabled())
308 blockingMode = style.scrollBlocksOn(); 308 blockingMode = style.scrollBlocksOn();
309 309
310 m_graphicsLayer->setScrollBlocksOn(blockingMode); 310 m_graphicsLayer->setScrollBlocksOn(blockingMode);
311 } 311 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) { 443 if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
444 layerConfigChanged = true; 444 layerConfigChanged = true;
445 scrollingConfigChanged = true; 445 scrollingConfigChanged = true;
446 } 446 }
447 447
448 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip)) 448 if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), require sVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip))
449 layerConfigChanged = true; 449 layerConfigChanged = true;
450 450
451 bool hasPerspective = false; 451 bool hasPerspective = false;
452 // FIXME: Can |style| be really null that late in the DocumentCycle? 452 // FIXME: Can |style| be really null that late in the DocumentCycle?
453 if (const LayoutStyle* style = renderer->style()) 453 if (const ComputedStyle* style = renderer->style())
454 hasPerspective = style->hasPerspective(); 454 hasPerspective = style->hasPerspective();
455 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get()) && renderer->isBox(); 455 bool needsChildTransformLayer = hasPerspective && (layerForChildrenTransform () == m_childTransformLayer.get()) && renderer->isBox();
456 if (updateChildTransformLayer(needsChildTransformLayer)) 456 if (updateChildTransformLayer(needsChildTransformLayer))
457 layerConfigChanged = true; 457 layerConfigChanged = true;
458 458
459 if (updateSquashingLayers(!m_squashedLayers.isEmpty())) 459 if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
460 layerConfigChanged = true; 460 layerConfigChanged = true;
461 461
462 updateScrollParent(scrollParent); 462 updateScrollParent(scrollParent);
463 updateClipParent(); 463 updateClipParent();
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 // should-flatten-transform value (the other layers' transforms don't matter here). 1473 // should-flatten-transform value (the other layers' transforms don't matter here).
1474 UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserv e3D() }; 1474 UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserv e3D() };
1475 ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D; 1475 ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D;
1476 ApplyToGraphicsLayers(this, functor, mode); 1476 ApplyToGraphicsLayers(this, functor, mode);
1477 1477
1478 // Note, if we apply perspective, we have to set should flatten differently 1478 // Note, if we apply perspective, we have to set should flatten differently
1479 // so that the transform propagates to child layers correctly. 1479 // so that the transform propagates to child layers correctly.
1480 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) { 1480 if (GraphicsLayer* childTransformLayer = layerForChildrenTransform()) {
1481 bool hasPerspective = false; 1481 bool hasPerspective = false;
1482 // FIXME: Can |style| be really null here? 1482 // FIXME: Can |style| be really null here?
1483 if (const LayoutStyle* style = m_owningLayer.layoutObject()->style()) 1483 if (const ComputedStyle* style = m_owningLayer.layoutObject()->style())
1484 hasPerspective = style->hasPerspective(); 1484 hasPerspective = style->hasPerspective();
1485 if (hasPerspective) 1485 if (hasPerspective)
1486 childTransformLayer->setShouldFlattenTransform(false); 1486 childTransformLayer->setShouldFlattenTransform(false);
1487 1487
1488 // Note, if the target is the scrolling layer, we need to ensure that th e 1488 // Note, if the target is the scrolling layer, we need to ensure that th e
1489 // scrolling content layer doesn't flatten the transform. (It would be n ice 1489 // scrolling content layer doesn't flatten the transform. (It would be n ice
1490 // if we could apply transform to the scrolling content layer, but that' s 1490 // if we could apply transform to the scrolling content layer, but that' s
1491 // too late, we need the children transform to be applied _before_ the 1491 // too late, we need the children transform to be applied _before_ the
1492 // scrolling offset.) 1492 // scrolling offset.)
1493 if (childTransformLayer == m_scrollingLayer.get()) { 1493 if (childTransformLayer == m_scrollingLayer.get()) {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 updateDrawsContent(); 1916 updateDrawsContent();
1917 1917
1918 // Image animation is "lazy", in that it automatically stops unless someone is drawing 1918 // Image animation is "lazy", in that it automatically stops unless someone is drawing
1919 // the image. So we have to kick the animation each time; this has the downs ide that the 1919 // the image. So we have to kick the animation each time; this has the downs ide that the
1920 // image will keep animating, even if its layer is not visible. 1920 // image will keep animating, even if its layer is not visible.
1921 image->startAnimation(); 1921 image->startAnimation();
1922 } 1922 }
1923 1923
1924 FloatPoint3D CompositedDeprecatedPaintLayerMapping::computeTransformOrigin(const IntRect& borderBox) const 1924 FloatPoint3D CompositedDeprecatedPaintLayerMapping::computeTransformOrigin(const IntRect& borderBox) const
1925 { 1925 {
1926 const LayoutStyle& style = layoutObject()->styleRef(); 1926 const ComputedStyle& style = layoutObject()->styleRef();
1927 1927
1928 FloatPoint3D origin; 1928 FloatPoint3D origin;
1929 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width()) ); 1929 origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width()) );
1930 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height() )); 1930 origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height() ));
1931 origin.setZ(style.transformOriginZ()); 1931 origin.setZ(style.transformOriginZ());
1932 1932
1933 return origin; 1933 return origin;
1934 } 1934 }
1935 1935
1936 // Return the offset from the top-left of this compositing layer at which the 1936 // Return the offset from the top-left of this compositing layer at which the
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2373 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2373 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2374 name = "Scrolling Block Selection Layer"; 2374 name = "Scrolling Block Selection Layer";
2375 } else { 2375 } else {
2376 ASSERT_NOT_REACHED(); 2376 ASSERT_NOT_REACHED();
2377 } 2377 }
2378 2378
2379 return name; 2379 return name;
2380 } 2380 }
2381 2381
2382 } // namespace blink 2382 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698