OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 } | 1481 } |
1482 | 1482 |
1483 if (!containing_layer) | 1483 if (!containing_layer) |
1484 return nullptr; | 1484 return nullptr; |
1485 | 1485 |
1486 location += layer->Location(); | 1486 location += layer->Location(); |
1487 return containing_layer; | 1487 return containing_layer; |
1488 } | 1488 } |
1489 | 1489 |
1490 void PaintLayer::ConvertToLayerCoords(const PaintLayer* ancestor_layer, | 1490 void PaintLayer::ConvertToLayerCoords(const PaintLayer* ancestor_layer, |
1491 LayoutPoint& location) const { | 1491 LayoutPoint& location, |
| 1492 bool* is_descendant) const { |
1492 if (ancestor_layer == this) | 1493 if (ancestor_layer == this) |
1493 return; | 1494 return; |
1494 | 1495 |
1495 const PaintLayer* curr_layer = this; | 1496 const PaintLayer* curr_layer = this; |
1496 while (curr_layer && curr_layer != ancestor_layer) | 1497 while (curr_layer && curr_layer != ancestor_layer) |
1497 curr_layer = | 1498 curr_layer = |
1498 AccumulateOffsetTowardsAncestor(curr_layer, ancestor_layer, location); | 1499 AccumulateOffsetTowardsAncestor(curr_layer, ancestor_layer, location); |
| 1500 |
| 1501 if (is_descendant) |
| 1502 *is_descendant = curr_layer == ancestor_layer; |
1499 } | 1503 } |
1500 | 1504 |
1501 void PaintLayer::ConvertToLayerCoords(const PaintLayer* ancestor_layer, | 1505 void PaintLayer::ConvertToLayerCoords(const PaintLayer* ancestor_layer, |
1502 LayoutRect& rect) const { | 1506 LayoutRect& rect) const { |
1503 LayoutPoint delta; | 1507 LayoutPoint delta; |
1504 ConvertToLayerCoords(ancestor_layer, delta); | 1508 ConvertToLayerCoords(ancestor_layer, delta); |
1505 rect.MoveBy(delta); | 1509 rect.MoveBy(delta); |
1506 } | 1510 } |
1507 | 1511 |
1508 LayoutPoint PaintLayer::VisualOffsetFromAncestor( | 1512 LayoutPoint PaintLayer::VisualOffsetFromAncestor( |
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 } | 3332 } |
3329 | 3333 |
3330 void showLayerTree(const blink::LayoutObject* layoutObject) { | 3334 void showLayerTree(const blink::LayoutObject* layoutObject) { |
3331 if (!layoutObject) { | 3335 if (!layoutObject) { |
3332 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; | 3336 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; |
3333 return; | 3337 return; |
3334 } | 3338 } |
3335 showLayerTree(layoutObject->EnclosingLayer()); | 3339 showLayerTree(layoutObject->EnclosingLayer()); |
3336 } | 3340 } |
3337 #endif | 3341 #endif |
OLD | NEW |