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

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

Issue 302993003: Route selection bounds updates through WebLayerTreeView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Factor common logic to RenderLayerCompositor 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled()) 360 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled())
361 applyOverlayFullscreenVideoAdjustment(); 361 applyOverlayFullscreenVideoAdjustment();
362 } 362 }
363 363
364 if (m_needsUpdateFixedBackground) { 364 if (m_needsUpdateFixedBackground) {
365 rootFixedBackgroundsChanged(); 365 rootFixedBackgroundsChanged();
366 m_needsUpdateFixedBackground = false; 366 m_needsUpdateFixedBackground = false;
367 } 367 }
368 368
369
370
abarth-chromium 2014/06/13 21:38:14 This change is spurious.
369 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function. 371 // The scrolling coordinator may realize that it needs updating while compos iting was being updated in this function.
370 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange(); 372 needsToUpdateScrollingCoordinator |= scrollingCoordinator() && scrollingCoor dinator()->needsToUpdateAfterCompositingChange();
371 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode()) 373 if (needsToUpdateScrollingCoordinator && m_renderView.frame()->isMainFrame() && scrollingCoordinator() && inCompositingMode())
372 scrollingCoordinator()->updateAfterCompositingChange(); 374 scrollingCoordinator()->updateAfterCompositingChange();
373 375
374 for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) { 376 for (unsigned i = 0; i < layersNeedingRepaint.size(); i++) {
375 RenderLayer* layer = layersNeedingRepaint[i]; 377 RenderLayer* layer = layersNeedingRepaint[i];
376 layer->repainter().computeRepaintRectsIncludingNonCompositingDescendants (); 378 layer->repainter().computeRepaintRectsIncludingNonCompositingDescendants ();
377 379
378 repaintOnCompositingChange(layer); 380 repaintOnCompositingChange(layer);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap ping(); 662 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap ping();
661 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); 663 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
662 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); 664 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
663 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { 665 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) {
664 hostingLayer->removeAllChildren(); 666 hostingLayer->removeAllChildren();
665 hostingLayer->addChild(rootLayer); 667 hostingLayer->addChild(rootLayer);
666 } 668 }
667 return true; 669 return true;
668 } 670 }
669 671
672 bool RenderLayerCompositor::computeEnclosingCompositingLayer(Node* node, RenderL ayer*& renderLayer, GraphicsLayer*& graphicsLayer)
673 {
674 if (!node || !node->renderer())
675 return false;
676
677 // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries
678 // to find a suitable layer.
679 RenderObject* renderer = node->renderer();
680 RenderLayer* currentRenderLayer;
681 do {
682 currentRenderLayer = renderer->enclosingLayer()->enclosingCompositingLay erForRepaint();
683 if (!currentRenderLayer) {
684 renderer = renderer->frame()->ownerRenderer();
685 if (!renderer)
686 return false;
687 }
688 } while (!currentRenderLayer);
abarth-chromium 2014/06/13 21:38:14 We shouldn't need to do this sort of search. Inst
689
690 renderLayer = currentRenderLayer;
691 CompositedLayerMappingPtr compositedLayerMapping = renderLayer->compositingS tate() == PaintsIntoGroupedBacking ? renderLayer->groupedMapping() : renderLayer ->compositedLayerMapping();
692 graphicsLayer = renderLayer->compositingState() == PaintsIntoGroupedBacking ? compositedLayerMapping->squashingLayer() : compositedLayerMapping->mainGraphic sLayer();
693
694 if (!graphicsLayer->drawsContent()) {
695 if (renderLayer->scrollableArea() && renderLayer->scrollableArea()->uses CompositedScrolling()) {
696 ASSERT(renderLayer->hasCompositedLayerMapping() && renderLayer->comp ositedLayerMapping()->scrollingContentsLayer());
697 graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
698 }
699 }
abarth-chromium 2014/06/13 21:38:15 Again, this search shouldn't be needed.
700
701 return true;
702 }
703
704 static FloatPoint convertTargetSpacePointToCompositedLayer(const FloatPoint& poi nt, RenderObject* targetRenderer, RenderObject* compositedRenderer)
705 {
706 IntPoint roundedPoint(roundedIntPoint(point));
707 roundedPoint = targetRenderer->frame()->view()->contentsToWindow(roundedPoin t);
708 roundedPoint = compositedRenderer->frame()->view()->windowToContents(rounded Point);
709 return compositedRenderer->absoluteToLocal(roundedPoint, UseTransforms);
710 }
abarth-chromium 2014/06/13 21:38:14 If we do this right, we shouldn't need to do any o
711
712 void RenderLayerCompositor::convertTargetSpaceQuadToCompositedLayer(const FloatQ uad& targetSpaceQuad, RenderObject* targetRenderer, RenderObject* compositedRend erer, FloatQuad& compositedSpaceQuad)
713 {
714 ASSERT(targetRenderer);
715 ASSERT(compositedRenderer);
716 compositedSpaceQuad.setP1(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p1(), targetRenderer, compositedRenderer));
717 compositedSpaceQuad.setP2(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p2(), targetRenderer, compositedRenderer));
718 compositedSpaceQuad.setP3(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p3(), targetRenderer, compositedRenderer));
719 compositedSpaceQuad.setP4(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p4(), targetRenderer, compositedRenderer));
720 }
abarth-chromium 2014/06/13 21:38:14 Again, this sort of coordinate conversion shouldn'
721
670 void RenderLayerCompositor::repaintCompositedLayers() 722 void RenderLayerCompositor::repaintCompositedLayers()
671 { 723 {
672 recursiveRepaintLayer(rootRenderLayer()); 724 recursiveRepaintLayer(rootRenderLayer());
673 } 725 }
674 726
675 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer) 727 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer)
676 { 728 {
677 // FIXME: This method does not work correctly with transforms. 729 // FIXME: This method does not work correctly with transforms.
678 if (layer->compositingState() == PaintsIntoOwnBacking) 730 if (layer->compositingState() == PaintsIntoOwnBacking)
679 layer->repainter().setBackingNeedsRepaint(); 731 layer->repainter().setBackingNeedsRepaint();
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } else if (graphicsLayer == m_scrollLayer.get()) { 1291 } else if (graphicsLayer == m_scrollLayer.get()) {
1240 name = "LocalFrame Scrolling Layer"; 1292 name = "LocalFrame Scrolling Layer";
1241 } else { 1293 } else {
1242 ASSERT_NOT_REACHED(); 1294 ASSERT_NOT_REACHED();
1243 } 1295 }
1244 1296
1245 return name; 1297 return name;
1246 } 1298 }
1247 1299
1248 } // namespace WebCore 1300 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698