| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics
Layer* except) | 207 static void clearPositionConstraintExceptForLayer(GraphicsLayer* layer, Graphics
Layer* except) |
| 208 { | 208 { |
| 209 if (layer && layer != except && toWebLayer(layer)) | 209 if (layer && layer != except && toWebLayer(layer)) |
| 210 toWebLayer(layer)->setPositionConstraint(WebLayerPositionConstraint()); | 210 toWebLayer(layer)->setPositionConstraint(WebLayerPositionConstraint()); |
| 211 } | 211 } |
| 212 | 212 |
| 213 static WebLayerPositionConstraint computePositionConstraint(const Layer* layer) | 213 static WebLayerPositionConstraint computePositionConstraint(const Layer* layer) |
| 214 { | 214 { |
| 215 ASSERT(layer->hasCompositedLayerMapping()); | 215 ASSERT(layer->hasCompositedLayerMapping()); |
| 216 do { | 216 do { |
| 217 if (layer->renderer()->style()->position() == FixedPosition) { | 217 if (layer->layoutObject()->style()->position() == FixedPosition) { |
| 218 const LayoutObject* fixedPositionObject = layer->renderer(); | 218 const LayoutObject* fixedPositionObject = layer->layoutObject(); |
| 219 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); | 219 bool fixedToRight = !fixedPositionObject->style()->right().isAuto(); |
| 220 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto(
); | 220 bool fixedToBottom = !fixedPositionObject->style()->bottom().isAuto(
); |
| 221 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed
ToBottom); | 221 return WebLayerPositionConstraint::fixedPosition(fixedToRight, fixed
ToBottom); |
| 222 } | 222 } |
| 223 | 223 |
| 224 layer = layer->parent(); | 224 layer = layer->parent(); |
| 225 | 225 |
| 226 // Composited layers that inherit a fixed position state will be positio
ned with respect to the nearest compositedLayerMapping's GraphicsLayer. | 226 // Composited layers that inherit a fixed position state will be positio
ned with respect to the nearest compositedLayerMapping's GraphicsLayer. |
| 227 // So, once we find a layer that has its own compositedLayerMapping, we
can stop searching for a fixed position LayoutObject. | 227 // So, once we find a layer that has its own compositedLayerMapping, we
can stop searching for a fixed position LayoutObject. |
| 228 } while (layer && !layer->hasCompositedLayerMapping()); | 228 } while (layer && !layer->hasCompositedLayerMapping()); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 Vector<LayoutRect>* glRects; | 479 Vector<LayoutRect>* glRects; |
| 480 if (glIter == graphicsRects.end()) | 480 if (glIter == graphicsRects.end()) |
| 481 glRects = &graphicsRects.add(graphicsLayer, Vector<LayoutRect>()).st
oredValue->value; | 481 glRects = &graphicsRects.add(graphicsLayer, Vector<LayoutRect>()).st
oredValue->value; |
| 482 else | 482 else |
| 483 glRects = &glIter->value; | 483 glRects = &glIter->value; |
| 484 | 484 |
| 485 // Transform each rect to the co-ordinate space of the graphicsLayer. | 485 // Transform each rect to the co-ordinate space of the graphicsLayer. |
| 486 for (size_t i = 0; i < layerIter->value.size(); ++i) { | 486 for (size_t i = 0; i < layerIter->value.size(); ++i) { |
| 487 LayoutRect rect = layerIter->value[i]; | 487 LayoutRect rect = layerIter->value[i]; |
| 488 if (compositedLayer != curLayer) { | 488 if (compositedLayer != curLayer) { |
| 489 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->renderer()); | 489 FloatQuad compositorQuad = geometryMap.mapToContainer(rect, comp
ositedLayer->layoutObject()); |
| 490 rect = LayoutRect(compositorQuad.boundingBox()); | 490 rect = LayoutRect(compositorQuad.boundingBox()); |
| 491 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction | 491 // If the enclosing composited layer itself is scrolled, we have
to undo the subtraction |
| 492 // of its scroll offset since we want the offset relative to the
scrolling content, not | 492 // of its scroll offset since we want the offset relative to the
scrolling content, not |
| 493 // the element itself. | 493 // the element itself. |
| 494 if (compositedLayer->renderer()->hasOverflowClip()) | 494 if (compositedLayer->layoutObject()->hasOverflowClip()) |
| 495 rect.move(compositedLayer->layoutBox()->scrolledContentOffse
t()); | 495 rect.move(compositedLayer->layoutBox()->scrolledContentOffse
t()); |
| 496 } | 496 } |
| 497 Layer::mapRectToPaintBackingCoordinates(compositedLayer->renderer(),
rect); | 497 Layer::mapRectToPaintBackingCoordinates(compositedLayer->layoutObjec
t(), rect); |
| 498 glRects->append(rect); | 498 glRects->append(rect); |
| 499 } | 499 } |
| 500 } | 500 } |
| 501 | 501 |
| 502 // Walk child layers of interest | 502 // Walk child layers of interest |
| 503 for (const Layer* childLayer = curLayer->firstChild(); childLayer; childLaye
r = childLayer->nextSibling()) { | 503 for (const Layer* childLayer = curLayer->firstChild(); childLayer; childLaye
r = childLayer->nextSibling()) { |
| 504 if (layersWithRects.contains(childLayer)) { | 504 if (layersWithRects.contains(childLayer)) { |
| 505 geometryMap.pushMappingsToAncestor(childLayer, curLayer); | 505 geometryMap.pushMappingsToAncestor(childLayer, curLayer); |
| 506 projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, gr
aphicsRects, geometryMap, layersWithRects, layerChildFrameMap); | 506 projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, gr
aphicsRects, geometryMap, layersWithRects, layerChildFrameMap); |
| 507 geometryMap.popMappingsToAncestor(curLayer); | 507 geometryMap.popMappingsToAncestor(curLayer); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 536 // all documents on the page). | 536 // all documents on the page). |
| 537 HashSet<const Layer*> layersWithRects; | 537 HashSet<const Layer*> layersWithRects; |
| 538 for (const auto& layerRect : layerRects) { | 538 for (const auto& layerRect : layerRects) { |
| 539 const Layer* layer = layerRect.key; | 539 const Layer* layer = layerRect.key; |
| 540 do { | 540 do { |
| 541 if (!layersWithRects.add(layer).isNewEntry) | 541 if (!layersWithRects.add(layer).isNewEntry) |
| 542 break; | 542 break; |
| 543 | 543 |
| 544 if (layer->parent()) { | 544 if (layer->parent()) { |
| 545 layer = layer->parent(); | 545 layer = layer->parent(); |
| 546 } else if (LayoutObject* parentDocLayoutObject = layer->renderer()->
frame()->ownerLayoutObject()) { | 546 } else if (LayoutObject* parentDocLayoutObject = layer->layoutObject
()->frame()->ownerLayoutObject()) { |
| 547 layer = parentDocLayoutObject->enclosingLayer(); | 547 layer = parentDocLayoutObject->enclosingLayer(); |
| 548 touchHandlerInChildFrame = true; | 548 touchHandlerInChildFrame = true; |
| 549 } | 549 } |
| 550 } while (layer); | 550 } while (layer); |
| 551 } | 551 } |
| 552 | 552 |
| 553 // Now walk the layer projecting rects while maintaining a LayoutGeometryMap | 553 // Now walk the layer projecting rects while maintaining a LayoutGeometryMap |
| 554 MapCoordinatesFlags flags = UseTransforms; | 554 MapCoordinatesFlags flags = UseTransforms; |
| 555 if (touchHandlerInChildFrame) | 555 if (touchHandlerInChildFrame) |
| 556 flags |= TraverseDocumentBoundaries; | 556 flags |= TraverseDocumentBoundaries; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 if (!node || !node->inDocument()) | 827 if (!node || !node->inDocument()) |
| 828 continue; | 828 continue; |
| 829 | 829 |
| 830 // If the document belongs to an invisible subframe it does not have a c
omposited layer | 830 // If the document belongs to an invisible subframe it does not have a c
omposited layer |
| 831 // and should be skipped. | 831 // and should be skipped. |
| 832 if (node->document().isInInvisibleSubframe()) | 832 if (node->document().isInInvisibleSubframe()) |
| 833 continue; | 833 continue; |
| 834 | 834 |
| 835 if (node->isDocumentNode() && node != document) { | 835 if (node->isDocumentNode() && node != document) { |
| 836 accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); | 836 accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); |
| 837 } else if (LayoutObject* renderer = node->renderer()) { | 837 } else if (LayoutObject* renderer = node->layoutObject()) { |
| 838 // If the set also contains one of our ancestor nodes then processin
g | 838 // If the set also contains one of our ancestor nodes then processin
g |
| 839 // this node would be redundant. | 839 // this node would be redundant. |
| 840 bool hasTouchEventTargetAncestor = false; | 840 bool hasTouchEventTargetAncestor = false; |
| 841 for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEvent
TargetAncestor; ancestor = ancestor->parentNode()) { | 841 for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEvent
TargetAncestor; ancestor = ancestor->parentNode()) { |
| 842 if (targets->contains(ancestor)) | 842 if (targets->contains(ancestor)) |
| 843 hasTouchEventTargetAncestor = true; | 843 hasTouchEventTargetAncestor = true; |
| 844 } | 844 } |
| 845 if (!hasTouchEventTargetAncestor) { | 845 if (!hasTouchEventTargetAncestor) { |
| 846 // Walk up the tree to the outermost non-composited scrollable l
ayer. | 846 // Walk up the tree to the outermost non-composited scrollable l
ayer. |
| 847 Layer* enclosingNonCompositedScrollLayer = nullptr; | 847 Layer* enclosingNonCompositedScrollLayer = nullptr; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 bool frameIsScrollable = frameView && frameView->isScrollable(); | 1054 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 1055 if (frameIsScrollable != m_wasFrameScrollable) | 1055 if (frameIsScrollable != m_wasFrameScrollable) |
| 1056 return true; | 1056 return true; |
| 1057 | 1057 |
| 1058 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) | 1058 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : nullptr) |
| 1059 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 1059 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 1060 return false; | 1060 return false; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 } // namespace blink | 1063 } // namespace blink |
| OLD | NEW |