| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 GraphicsLayer* graphicsLayer, | 1546 GraphicsLayer* graphicsLayer, |
| 1547 IntSize* layerOffset, | 1547 IntSize* layerOffset, |
| 1548 String* layerType) { | 1548 String* layerType) { |
| 1549 *layerOffset = IntSize(); | 1549 *layerOffset = IntSize(); |
| 1550 if (searchRoot->hasCompositedLayerMapping() && | 1550 if (searchRoot->hasCompositedLayerMapping() && |
| 1551 graphicsLayer == | 1551 graphicsLayer == |
| 1552 searchRoot->compositedLayerMapping()->mainGraphicsLayer()) { | 1552 searchRoot->compositedLayerMapping()->mainGraphicsLayer()) { |
| 1553 // If the |graphicsLayer| sets the scrollingContent layer as its | 1553 // If the |graphicsLayer| sets the scrollingContent layer as its |
| 1554 // scroll parent, consider it belongs to the scrolling layer and | 1554 // scroll parent, consider it belongs to the scrolling layer and |
| 1555 // mark the layer type as "scrolling". | 1555 // mark the layer type as "scrolling". |
| 1556 if (!searchRoot->layoutObject()->hasTransformRelatedProperty() && | 1556 if (!searchRoot->layoutObject().hasTransformRelatedProperty() && |
| 1557 searchRoot->scrollParent() && | 1557 searchRoot->scrollParent() && |
| 1558 searchRoot->parent() == searchRoot->scrollParent()) { | 1558 searchRoot->parent() == searchRoot->scrollParent()) { |
| 1559 *layerType = "scrolling"; | 1559 *layerType = "scrolling"; |
| 1560 // For hit-test rect visualization to work, the hit-test rect should | 1560 // For hit-test rect visualization to work, the hit-test rect should |
| 1561 // be relative to the scrolling layer and in this case the hit-test | 1561 // be relative to the scrolling layer and in this case the hit-test |
| 1562 // rect is relative to the element's own GraphicsLayer. So we will have | 1562 // rect is relative to the element's own GraphicsLayer. So we will have |
| 1563 // to adjust the rect to be relative to the scrolling layer here. | 1563 // to adjust the rect to be relative to the scrolling layer here. |
| 1564 // Only when the element's offsetParent == scroller's offsetParent we | 1564 // Only when the element's offsetParent == scroller's offsetParent we |
| 1565 // can compute the element's relative position to the scrolling content | 1565 // can compute the element's relative position to the scrolling content |
| 1566 // in this way. | 1566 // in this way. |
| 1567 if (searchRoot->layoutObject()->offsetParent() == | 1567 if (searchRoot->layoutObject().offsetParent() == |
| 1568 searchRoot->parent()->layoutObject()->offsetParent()) { | 1568 searchRoot->parent()->layoutObject().offsetParent()) { |
| 1569 LayoutBoxModelObject* current = searchRoot->layoutObject(); | 1569 LayoutBoxModelObject& current = searchRoot->layoutObject(); |
| 1570 LayoutBoxModelObject* parent = searchRoot->parent()->layoutObject(); | 1570 LayoutBoxModelObject& parent = searchRoot->parent()->layoutObject(); |
| 1571 layerOffset->setWidth((parent->offsetLeft(parent->offsetParent()) - | 1571 layerOffset->setWidth((parent.offsetLeft(parent.offsetParent()) - |
| 1572 current->offsetLeft(parent->offsetParent())) | 1572 current.offsetLeft(parent.offsetParent())) |
| 1573 .toInt()); | 1573 .toInt()); |
| 1574 layerOffset->setHeight((parent->offsetTop(parent->offsetParent()) - | 1574 layerOffset->setHeight((parent.offsetTop(parent.offsetParent()) - |
| 1575 current->offsetTop(parent->offsetParent())) | 1575 current.offsetTop(parent.offsetParent())) |
| 1576 .toInt()); | 1576 .toInt()); |
| 1577 return searchRoot->parent(); | 1577 return searchRoot->parent(); |
| 1578 } | 1578 } |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 LayoutRect rect; | 1581 LayoutRect rect; |
| 1582 PaintLayer::mapRectInPaintInvalidationContainerToBacking( | 1582 PaintLayer::mapRectInPaintInvalidationContainerToBacking( |
| 1583 *searchRoot->layoutObject(), rect); | 1583 searchRoot->layoutObject(), rect); |
| 1584 rect.move(searchRoot->compositedLayerMapping() | 1584 rect.move(searchRoot->compositedLayerMapping() |
| 1585 ->contentOffsetInCompositingLayer()); | 1585 ->contentOffsetInCompositingLayer()); |
| 1586 | 1586 |
| 1587 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt()); | 1587 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt()); |
| 1588 return searchRoot; | 1588 return searchRoot; |
| 1589 } | 1589 } |
| 1590 | 1590 |
| 1591 // If the |graphicsLayer| is a scroller's scrollingContent layer, | 1591 // If the |graphicsLayer| is a scroller's scrollingContent layer, |
| 1592 // consider this is a scrolling layer. | 1592 // consider this is a scrolling layer. |
| 1593 GraphicsLayer* layerForScrolling = | 1593 GraphicsLayer* layerForScrolling = |
| 1594 searchRoot->getScrollableArea() | 1594 searchRoot->getScrollableArea() |
| 1595 ? searchRoot->getScrollableArea()->layerForScrolling() | 1595 ? searchRoot->getScrollableArea()->layerForScrolling() |
| 1596 : 0; | 1596 : 0; |
| 1597 if (graphicsLayer == layerForScrolling) { | 1597 if (graphicsLayer == layerForScrolling) { |
| 1598 *layerType = "scrolling"; | 1598 *layerType = "scrolling"; |
| 1599 return searchRoot; | 1599 return searchRoot; |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { | 1602 if (searchRoot->compositingState() == PaintsIntoGroupedBacking) { |
| 1603 GraphicsLayer* squashingLayer = | 1603 GraphicsLayer* squashingLayer = |
| 1604 searchRoot->groupedMapping()->squashingLayer(); | 1604 searchRoot->groupedMapping()->squashingLayer(); |
| 1605 if (graphicsLayer == squashingLayer) { | 1605 if (graphicsLayer == squashingLayer) { |
| 1606 *layerType = "squashing"; | 1606 *layerType = "squashing"; |
| 1607 LayoutRect rect; | 1607 LayoutRect rect; |
| 1608 PaintLayer::mapRectInPaintInvalidationContainerToBacking( | 1608 PaintLayer::mapRectInPaintInvalidationContainerToBacking( |
| 1609 *searchRoot->layoutObject(), rect); | 1609 searchRoot->layoutObject(), rect); |
| 1610 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt()); | 1610 *layerOffset = IntSize(rect.x().toInt(), rect.y().toInt()); |
| 1611 return searchRoot; | 1611 return searchRoot; |
| 1612 } | 1612 } |
| 1613 } | 1613 } |
| 1614 | 1614 |
| 1615 GraphicsLayer* layerForHorizontalScrollbar = | 1615 GraphicsLayer* layerForHorizontalScrollbar = |
| 1616 searchRoot->getScrollableArea() | 1616 searchRoot->getScrollableArea() |
| 1617 ? searchRoot->getScrollableArea()->layerForHorizontalScrollbar() | 1617 ? searchRoot->getScrollableArea()->layerForHorizontalScrollbar() |
| 1618 : 0; | 1618 : 0; |
| 1619 if (graphicsLayer == layerForHorizontalScrollbar) { | 1619 if (graphicsLayer == layerForHorizontalScrollbar) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 GraphicsLayer* graphicsLayer, | 1701 GraphicsLayer* graphicsLayer, |
| 1702 LayerRectList* rects) { | 1702 LayerRectList* rects) { |
| 1703 WebVector<blink::WebRect> layerRects = | 1703 WebVector<blink::WebRect> layerRects = |
| 1704 graphicsLayer->platformLayer()->touchEventHandlerRegion(); | 1704 graphicsLayer->platformLayer()->touchEventHandlerRegion(); |
| 1705 if (!layerRects.isEmpty()) { | 1705 if (!layerRects.isEmpty()) { |
| 1706 mergeRects(layerRects); | 1706 mergeRects(layerRects); |
| 1707 String layerType; | 1707 String layerType; |
| 1708 IntSize layerOffset; | 1708 IntSize layerOffset; |
| 1709 PaintLayer* paintLayer = findLayerForGraphicsLayer( | 1709 PaintLayer* paintLayer = findLayerForGraphicsLayer( |
| 1710 compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType); | 1710 compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType); |
| 1711 Node* node = paintLayer ? paintLayer->layoutObject()->node() : 0; | 1711 Node* node = paintLayer ? paintLayer->layoutObject().node() : 0; |
| 1712 for (size_t i = 0; i < layerRects.size(); ++i) { | 1712 for (size_t i = 0; i < layerRects.size(); ++i) { |
| 1713 if (!layerRects[i].isEmpty()) { | 1713 if (!layerRects[i].isEmpty()) { |
| 1714 rects->append(node, layerType, layerOffset.width(), | 1714 rects->append(node, layerType, layerOffset.width(), |
| 1715 layerOffset.height(), ClientRect::create(layerRects[i])); | 1715 layerOffset.height(), ClientRect::create(layerRects[i])); |
| 1716 } | 1716 } |
| 1717 } | 1717 } |
| 1718 } | 1718 } |
| 1719 | 1719 |
| 1720 size_t numChildren = graphicsLayer->children().size(); | 1720 size_t numChildren = graphicsLayer->children().size(); |
| 1721 for (size_t i = 0; i < numChildren; ++i) | 1721 for (size_t i = 0; i < numChildren; ++i) |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3147 | 3147 |
| 3148 void Internals::crash() { | 3148 void Internals::crash() { |
| 3149 CHECK(false) << "Intentional crash"; | 3149 CHECK(false) << "Intentional crash"; |
| 3150 } | 3150 } |
| 3151 | 3151 |
| 3152 void Internals::setIsLowEndDevice(bool isLowEndDevice) { | 3152 void Internals::setIsLowEndDevice(bool isLowEndDevice) { |
| 3153 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); | 3153 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); |
| 3154 } | 3154 } |
| 3155 | 3155 |
| 3156 } // namespace blink | 3156 } // namespace blink |
| OLD | NEW |