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

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

Issue 1642223002: Delete selection gap code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 m_scrollingContentsLayer->setSize(FloatSize(scrollSize)); 994 m_scrollingContentsLayer->setSize(FloatSize(scrollSize));
995 // FIXME: The paint offset and the scroll offset should really be separate c oncepts. 995 // FIXME: The paint offset and the scroll offset should really be separate c oncepts.
996 m_scrollingContentsLayer->setOffsetDoubleFromLayoutObject(scrollingContentsO ffset, GraphicsLayer::DontSetNeedsDisplay); 996 m_scrollingContentsLayer->setOffsetDoubleFromLayoutObject(scrollingContentsO ffset, GraphicsLayer::DontSetNeedsDisplay);
997 997
998 if (m_foregroundLayer) { 998 if (m_foregroundLayer) {
999 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size()) 999 if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
1000 m_foregroundLayer->setSize(m_scrollingContentsLayer->size()); 1000 m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
1001 m_foregroundLayer->setNeedsDisplay(); 1001 m_foregroundLayer->setNeedsDisplay();
1002 m_foregroundLayer->setOffsetFromLayoutObject(m_scrollingContentsLayer->o ffsetFromLayoutObject()); 1002 m_foregroundLayer->setOffsetFromLayoutObject(m_scrollingContentsLayer->o ffsetFromLayoutObject());
1003 } 1003 }
1004
1005 updateScrollingBlockSelection();
1006 } 1004 }
1007 1005
1008 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() 1006 void CompositedLayerMapping::updateChildClippingMaskLayerGeometry()
1009 { 1007 {
1010 if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath()) 1008 if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath())
1011 return; 1009 return;
1012 LayoutBox* layoutBox = toLayoutBox(layoutObject()); 1010 LayoutBox* layoutBox = toLayoutBox(layoutObject());
1013 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect()); 1011 IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect());
1014 1012
1015 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position()); 1013 m_childClippingMaskLayer->setPosition(m_graphicsLayer->position());
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 // graphics layers. 1189 // graphics layers.
1192 // 1190 //
1193 // And drawing of composited children takes into account the subpixel 1191 // And drawing of composited children takes into account the subpixel
1194 // accumulation of this CLM already (through its own 1192 // accumulation of this CLM already (through its own
1195 // graphicsLayerParentLocation it appears). 1193 // graphicsLayerParentLocation it appears).
1196 FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation; 1194 FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation;
1197 m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAn cestor - offsetDueToAncestorGraphicsLayers); 1195 m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAn cestor - offsetDueToAncestorGraphicsLayers);
1198 m_contentOffsetInCompositingLayerDirty = false; 1196 m_contentOffsetInCompositingLayerDirty = false;
1199 } 1197 }
1200 1198
1201 void CompositedLayerMapping::updateScrollingBlockSelection()
1202 {
1203 if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
1204 return;
1205
1206 if (!m_scrollingBlockSelectionLayer)
1207 return;
1208
1209 if (!m_scrollingContentsAreEmpty) {
1210 // In this case, the selection will be painted directly into m_scrolling ContentsLayer.
1211 m_scrollingBlockSelectionLayer->setDrawsContent(false);
chrishtr 2016/01/28 22:06:22 delete m_scrollingBlockSelectionLayer?
wkorman 2016/01/28 22:54:32 Done.
1212 return;
1213 }
1214
1215 const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBou nds();
1216 const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty();
1217 m_scrollingBlockSelectionLayer->setDrawsContent(shouldDrawContent);
1218 if (!shouldDrawContent)
1219 return;
1220 // FIXME: Remove the flooredIntSize conversion. crbug.com/414283.
1221 const IntPoint position = blockSelectionGapsBounds.location() + flooredIntSi ze(m_owningLayer.scrollableArea()->adjustedScrollOffset());
1222 if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size( ) && m_scrollingBlockSelectionLayer->position() == position)
1223 return;
1224
1225 m_scrollingBlockSelectionLayer->setPosition(position);
1226 m_scrollingBlockSelectionLayer->setSize(FloatSize(blockSelectionGapsBounds.s ize()));
1227 m_scrollingBlockSelectionLayer->setOffsetFromLayoutObject(toIntSize(blockSel ectionGapsBounds.location()), GraphicsLayer::SetNeedsDisplay);
1228 }
1229
1230 void CompositedLayerMapping::updateDrawsContent() 1199 void CompositedLayerMapping::updateDrawsContent()
1231 { 1200 {
1232 bool hasPaintedContent = containsPaintedContent(); 1201 bool hasPaintedContent = containsPaintedContent();
1233 m_graphicsLayer->setDrawsContent(hasPaintedContent); 1202 m_graphicsLayer->setDrawsContent(hasPaintedContent);
1234 1203
1235 if (m_scrollingLayer) { 1204 if (m_scrollingLayer) {
1236 // m_scrollingLayer never has backing store. 1205 // m_scrollingLayer never has backing store.
1237 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint. 1206 // m_scrollingContentsLayer only needs backing store if the scrolled con tents need to paint.
1238 m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(la youtObject()->hasBackground() || paintsChildren()); 1207 m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(la youtObject()->hasBackground() || paintsChildren());
1239 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty); 1208 m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty);
1240 updateScrollingBlockSelection();
1241 } 1209 }
1242 1210
1243 if (hasPaintedContent && isAcceleratedCanvas(layoutObject())) { 1211 if (hasPaintedContent && isAcceleratedCanvas(layoutObject())) {
1244 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext(); 1212 CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->no de())->renderingContext();
1245 // Content layer may be null if context is lost. 1213 // Content layer may be null if context is lost.
1246 if (WebLayer* contentLayer = context->platformLayer()) { 1214 if (WebLayer* contentLayer = context->platformLayer()) {
1247 Color bgColor(Color::transparent); 1215 Color bgColor(Color::transparent);
1248 if (contentLayerSupportsDirectBackgroundComposition(layoutObject())) { 1216 if (contentLayerSupportsDirectBackgroundComposition(layoutObject())) {
1249 bgColor = layoutObjectBackgroundColor(); 1217 bgColor = layoutObjectBackgroundColor();
1250 hasPaintedContent = false; 1218 hasPaintedContent = false;
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 if (!m_scrollingLayer) { 1600 if (!m_scrollingLayer) {
1633 // Outer layer which corresponds with the scroll view. 1601 // Outer layer which corresponds with the scroll view.
1634 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer); 1602 m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScro llingContainer);
1635 m_scrollingLayer->setDrawsContent(false); 1603 m_scrollingLayer->setDrawsContent(false);
1636 m_scrollingLayer->setMasksToBounds(true); 1604 m_scrollingLayer->setMasksToBounds(true);
1637 1605
1638 // Inner layer which renders the content that scrolls. 1606 // Inner layer which renders the content that scrolls.
1639 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents); 1607 m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLaye rForScrollingContents);
1640 m_scrollingLayer->addChild(m_scrollingContentsLayer.get()); 1608 m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
1641 1609
1642 if (!RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEn abled()) {
1643 m_scrollingBlockSelectionLayer = createGraphicsLayer(Compositing ReasonLayerForScrollingBlockSelection);
1644 m_scrollingBlockSelectionLayer->setDrawsContent(true);
1645 m_scrollingContentsLayer->addChild(m_scrollingBlockSelectionLaye r.get());
1646 }
1647
1648 layerChanged = true; 1610 layerChanged = true;
1649 if (scrollingCoordinator) { 1611 if (scrollingCoordinator) {
1650 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.scrollableArea()); 1612 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_ownin gLayer.scrollableArea());
1651 scrollingCoordinator->scrollableAreasDidChange(); 1613 scrollingCoordinator->scrollableAreasDidChange();
1652 } 1614 }
1653 } 1615 }
1654 } else if (m_scrollingLayer) { 1616 } else if (m_scrollingLayer) {
1655 m_scrollingLayer = nullptr; 1617 m_scrollingLayer = nullptr;
1656 m_scrollingContentsLayer = nullptr; 1618 m_scrollingContentsLayer = nullptr;
1657 m_scrollingBlockSelectionLayer = nullptr; 1619 m_scrollingBlockSelectionLayer = nullptr;
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2547 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2586 name = "Scrolling Block Selection Layer"; 2548 name = "Scrolling Block Selection Layer";
2587 } else { 2549 } else {
2588 ASSERT_NOT_REACHED(); 2550 ASSERT_NOT_REACHED();
2589 } 2551 }
2590 2552
2591 return name; 2553 return name;
2592 } 2554 }
2593 2555
2594 } // namespace blink 2556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698