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

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: Rebase Created 6 years, 4 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap ping(); 612 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap ping();
613 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers(); 613 GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
614 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer(); 614 GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
615 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) { 615 if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != r ootLayer) {
616 hostingLayer->removeAllChildren(); 616 hostingLayer->removeAllChildren();
617 hostingLayer->addChild(rootLayer); 617 hostingLayer->addChild(rootLayer);
618 } 618 }
619 return true; 619 return true;
620 } 620 }
621 621
622 bool RenderLayerCompositor::computeEnclosingCompositingLayer(Node* node, RenderL ayer*& renderLayer, GraphicsLayer*& graphicsLayer)
623 {
624 if (!node || !node->renderer())
625 return false;
626
627 // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries
628 // to find a suitable layer.
629 RenderObject* renderer = node->renderer();
630 do {
631 renderLayer = renderer->enclosingLayer()->enclosingLayerForPaintInvalida tion();
632 if (!renderLayer) {
633 renderer = renderer->frame()->ownerRenderer();
634 if (!renderer)
635 return false;
636 }
637 } while (!renderLayer);
638
639 ASSERT(renderLayer->compositingState() != NotComposited);
640
641 graphicsLayer = renderLayer->graphicsLayerBacking();
642 if (!graphicsLayer->drawsContent()) {
643 graphicsLayer = renderLayer->graphicsLayerBackingForScrolling();
644 }
645
646 return true;
647 }
648
649 static FloatPoint convertTargetSpacePointToCompositedLayer(const FloatPoint& poi nt, RenderObject* targetRenderer, RenderObject* compositedRenderer)
650 {
651 IntPoint roundedPoint(roundedIntPoint(point));
652 roundedPoint = targetRenderer->frame()->view()->contentsToWindow(roundedPoin t);
653 roundedPoint = compositedRenderer->frame()->view()->windowToContents(rounded Point);
654 return compositedRenderer->absoluteToLocal(roundedPoint, UseTransforms);
655 }
656
657 void RenderLayerCompositor::convertTargetSpaceQuadToCompositedLayer(const FloatQ uad& targetSpaceQuad, RenderObject* targetRenderer, RenderObject* compositedRend erer, FloatQuad& compositedSpaceQuad)
658 {
659 ASSERT(targetRenderer);
660 ASSERT(compositedRenderer);
661 compositedSpaceQuad.setP1(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p1(), targetRenderer, compositedRenderer));
662 compositedSpaceQuad.setP2(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p2(), targetRenderer, compositedRenderer));
663 compositedSpaceQuad.setP3(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p3(), targetRenderer, compositedRenderer));
664 compositedSpaceQuad.setP4(convertTargetSpacePointToCompositedLayer(targetSpa ceQuad.p4(), targetRenderer, compositedRenderer));
665 }
666
622 void RenderLayerCompositor::repaintCompositedLayers() 667 void RenderLayerCompositor::repaintCompositedLayers()
623 { 668 {
624 recursiveRepaintLayer(rootRenderLayer()); 669 recursiveRepaintLayer(rootRenderLayer());
625 } 670 }
626 671
627 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer) 672 void RenderLayerCompositor::recursiveRepaintLayer(RenderLayer* layer)
628 { 673 {
629 // FIXME: This method does not work correctly with transforms. 674 // FIXME: This method does not work correctly with transforms.
630 if (layer->compositingState() == PaintsIntoOwnBacking) { 675 if (layer->compositingState() == PaintsIntoOwnBacking) {
631 layer->compositedLayerMapping()->setContentsNeedDisplay(); 676 layer->compositedLayerMapping()->setContentsNeedDisplay();
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 } else if (graphicsLayer == m_scrollLayer.get()) { 1216 } else if (graphicsLayer == m_scrollLayer.get()) {
1172 name = "LocalFrame Scrolling Layer"; 1217 name = "LocalFrame Scrolling Layer";
1173 } else { 1218 } else {
1174 ASSERT_NOT_REACHED(); 1219 ASSERT_NOT_REACHED();
1175 } 1220 }
1176 1221
1177 return name; 1222 return name;
1178 } 1223 }
1179 1224
1180 } // namespace blink 1225 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/RenderLayerCompositor.h ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698