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

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

Issue 303253004: Allow proper highlighting on universal overflow scroll. (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
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer) 169 CompositedLayerMapping::CompositedLayerMapping(RenderLayer& layer)
170 : m_owningLayer(layer) 170 : m_owningLayer(layer)
171 , m_artificiallyInflatedBounds(false) 171 , m_artificiallyInflatedBounds(false)
172 , m_isMainFrameRenderViewLayer(false) 172 , m_isMainFrameRenderViewLayer(false)
173 , m_requiresOwnBackingStoreForIntrinsicReasons(true) 173 , m_requiresOwnBackingStoreForIntrinsicReasons(true)
174 , m_requiresOwnBackingStoreForAncestorReasons(true) 174 , m_requiresOwnBackingStoreForAncestorReasons(true)
175 , m_canCompositeFilters(false) 175 , m_canCompositeFilters(false)
176 , m_backgroundLayerPaintsFixedRootBackground(false) 176 , m_backgroundLayerPaintsFixedRootBackground(false)
177 , m_needToUpdateGraphicsLayer(false) 177 , m_needToUpdateGraphicsLayer(false)
178 , m_needToUpdateGraphicsLayerOfAllDecendants(false) 178 , m_needToUpdateGraphicsLayerOfAllDecendants(false)
179 , m_scrollingContentsAreEmpty(false)
179 { 180 {
180 if (layer.isRootLayer() && renderer()->frame()->isMainFrame()) 181 if (layer.isRootLayer() && renderer()->frame()->isMainFrame())
181 m_isMainFrameRenderViewLayer = true; 182 m_isMainFrameRenderViewLayer = true;
182 183
183 createPrimaryGraphicsLayer(); 184 createPrimaryGraphicsLayer();
184 } 185 }
185 186
186 CompositedLayerMapping::~CompositedLayerMapping() 187 CompositedLayerMapping::~CompositedLayerMapping()
187 { 188 {
188 // Hits in compositing/squashing/squash-onto-nephew.html. 189 // Hits in compositing/squashing/squash-onto-nephew.html.
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 paintPhase |= GraphicsLayerPaintForeground; 1045 paintPhase |= GraphicsLayerPaintForeground;
1045 m_scrollingContentsLayer->setPaintingPhase(paintPhase); 1046 m_scrollingContentsLayer->setPaintingPhase(paintPhase);
1046 } 1047 }
1047 } 1048 }
1048 1049
1049 void CompositedLayerMapping::updateContentsRect() 1050 void CompositedLayerMapping::updateContentsRect()
1050 { 1051 {
1051 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox())); 1052 m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
1052 } 1053 }
1053 1054
1055 void CompositedLayerMapping::updateScrollingContentsForSelectionGaps(const IntRe ct& blockSelectionGapsBounds)
1056 {
1057 if (!m_scrollingContentsAreEmpty || !m_scrollingContentsLayer)
1058 return;
1059
1060 if (blockSelectionGapsBounds.isEmpty()) {
1061 m_scrollingContentsLayer->setDrawsContent(false);
1062 return;
1063 }
1064
1065 m_scrollingContentsLayer->setDrawsContent(true);
1066 m_scrollingContentsLayer->setContentsRect(IntRect());
Ian Vollick 2014/06/03 17:11:47 It's weird that you can pass the empty rect. Can y
hartmanng 2014/06/04 15:32:32 It turns out that the contents rect isn't being us
hartmanng 2014/06/05 15:59:37 Done (in patch set 7).
1067 }
1068
1054 void CompositedLayerMapping::updateDrawsContent() 1069 void CompositedLayerMapping::updateDrawsContent()
1055 { 1070 {
1056 if (m_scrollingLayer) { 1071 if (m_scrollingLayer) {
1057 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere. 1072 // We don't have to consider overflow controls, because we know that the scrollbars are drawn elsewhere.
1058 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint. 1073 // m_graphicsLayer only needs backing store if the non-scrolling parts ( background, outlines, borders, shadows etc) need to paint.
1059 // m_scrollingLayer never has backing store. 1074 // m_scrollingLayer never has backing store.
1060 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. 1075 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint.
1061 bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() & & m_owningLayer.hasBoxDecorationsOrBackground(); 1076 bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() & & m_owningLayer.hasBoxDecorationsOrBackground();
1062 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent); 1077 m_graphicsLayer->setDrawsContent(hasNonScrollingPaintedContent);
1063 1078
1064 bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && ( renderer()->hasBackground() || paintsChildren()); 1079 bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() && ( renderer()->hasBackground() || paintsChildren());
1065 m_scrollingContentsLayer->setDrawsContent(hasScrollingPaintedContent); 1080 m_scrollingContentsAreEmpty = !hasScrollingPaintedContent;
1081
1082 IntRect gapRect = owningLayer().blockSelectionGapsBounds();
1083 bool shouldDrawContent = !m_scrollingContentsAreEmpty || !gapRect.isEmpt y();
1084 m_scrollingContentsLayer->setDrawsContent(shouldDrawContent);
1085 if (shouldDrawContent && m_scrollingContentsAreEmpty)
1086 m_scrollingContentsLayer->setContentsRect(IntRect());
1066 return; 1087 return;
1067 } 1088 }
1068 1089
1069 bool hasPaintedContent = containsPaintedContent(); 1090 bool hasPaintedContent = containsPaintedContent();
1070 if (hasPaintedContent && isAcceleratedCanvas(renderer())) { 1091 if (hasPaintedContent && isAcceleratedCanvas(renderer())) {
1071 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext(); 1092 CanvasRenderingContext* context = toHTMLCanvasElement(renderer()->node() )->renderingContext();
1072 // Content layer may be null if context is lost. 1093 // Content layer may be null if context is lost.
1073 if (blink::WebLayer* contentLayer = context->platformLayer()) { 1094 if (blink::WebLayer* contentLayer = context->platformLayer()) {
1074 Color bgColor(Color::transparent); 1095 Color bgColor(Color::transparent);
1075 if (contentLayerSupportsDirectBackgroundComposition(renderer())) { 1096 if (contentLayerSupportsDirectBackgroundComposition(renderer())) {
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2267 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2247 name = "Scrolling Contents Layer"; 2268 name = "Scrolling Contents Layer";
2248 } else { 2269 } else {
2249 ASSERT_NOT_REACHED(); 2270 ASSERT_NOT_REACHED();
2250 } 2271 }
2251 2272
2252 return name; 2273 return name;
2253 } 2274 }
2254 2275
2255 } // namespace WebCore 2276 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698