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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2629083003: Fix box shadow rendering on opaque WebGL canvases (Closed)
Patch Set: fixed tests Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-shadow-no-alpha-expected.html ('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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (shouldPaintOntoGraphicsLayer != !!m_backgroundPaintsOntoGraphicsLayer) { 384 if (shouldPaintOntoGraphicsLayer != !!m_backgroundPaintsOntoGraphicsLayer) {
385 m_backgroundPaintsOntoGraphicsLayer = shouldPaintOntoGraphicsLayer; 385 m_backgroundPaintsOntoGraphicsLayer = shouldPaintOntoGraphicsLayer;
386 // The graphics layer needs to be updated for changed 386 // The graphics layer needs to be updated for changed
387 // m_backgroundPaintsOntoGraphicsLayer. 387 // m_backgroundPaintsOntoGraphicsLayer.
388 m_graphicsLayer->setNeedsDisplay(); 388 m_graphicsLayer->setNeedsDisplay();
389 } 389 }
390 } 390 }
391 391
392 void CompositedLayerMapping::updateContentsOpaque() { 392 void CompositedLayerMapping::updateContentsOpaque() {
393 if (isAcceleratedCanvas(layoutObject())) { 393 if (isAcceleratedCanvas(layoutObject())) {
394 // Determine whether the rendering context's external texture layer is
395 // opaque.
396 CanvasRenderingContext* context = 394 CanvasRenderingContext* context =
397 toHTMLCanvasElement(layoutObject()->node())->renderingContext(); 395 toHTMLCanvasElement(layoutObject()->node())->renderingContext();
398 if (!context->creationAttributes().alpha()) 396 WebLayer* layer = context ? context->platformLayer() : nullptr;
399 m_graphicsLayer->setContentsOpaque(true); 397 // Determine whether the external texture layer covers the whole graphics
400 else if (WebLayer* layer = context->platformLayer()) 398 // layer. This may not be the case if there are box decorations or
401 m_graphicsLayer->setContentsOpaque( 399 // shadows.
402 !Color(layer->backgroundColor()).hasAlpha()); 400 if (layer &&
403 else 401 layer->bounds() == m_graphicsLayer->platformLayer()->bounds()) {
402 // Determine whether the rendering context's external texture layer is
403 // opaque.
404 if (!context->creationAttributes().alpha()) {
405 m_graphicsLayer->setContentsOpaque(true);
406 } else {
407 m_graphicsLayer->setContentsOpaque(
408 !Color(layer->backgroundColor()).hasAlpha());
409 }
410 } else {
404 m_graphicsLayer->setContentsOpaque(false); 411 m_graphicsLayer->setContentsOpaque(false);
412 }
405 } else if (m_backgroundLayer) { 413 } else if (m_backgroundLayer) {
406 m_graphicsLayer->setContentsOpaque(false); 414 m_graphicsLayer->setContentsOpaque(false);
407 m_backgroundLayer->setContentsOpaque( 415 m_backgroundLayer->setContentsOpaque(
408 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds())); 416 m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
409 } else { 417 } else {
410 // For non-root layers, background is painted by the scrolling contents 418 // For non-root layers, background is painted by the scrolling contents
411 // layer if all backgrounds are background attachment local, otherwise 419 // layer if all backgrounds are background attachment local, otherwise
412 // background is painted by the primary graphics layer. 420 // background is painted by the primary graphics layer.
413 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) { 421 if (hasScrollingLayer() && m_backgroundPaintsOntoScrollingContentsLayer) {
414 // Backgrounds painted onto the foreground are clipped by the padding box 422 // Backgrounds painted onto the foreground are clipped by the padding box
(...skipping 3029 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { 3452 } else if (graphicsLayer == m_decorationOutlineLayer.get()) {
3445 name = "Decoration Layer"; 3453 name = "Decoration Layer";
3446 } else { 3454 } else {
3447 ASSERT_NOT_REACHED(); 3455 ASSERT_NOT_REACHED();
3448 } 3456 }
3449 3457
3450 return name; 3458 return name;
3451 } 3459 }
3452 3460
3453 } // namespace blink 3461 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/webgl/webgl-shadow-no-alpha-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698