| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 if (m_replicaLayer) | 131 if (m_replicaLayer) |
| 132 m_replicaLayer->setReplicatedLayer(0); | 132 m_replicaLayer->setReplicatedLayer(0); |
| 133 | 133 |
| 134 if (m_replicatedLayer) | 134 if (m_replicatedLayer) |
| 135 m_replicatedLayer->setReplicatedByLayer(0); | 135 m_replicatedLayer->setReplicatedByLayer(0); |
| 136 | 136 |
| 137 removeAllChildren(); | 137 removeAllChildren(); |
| 138 removeFromParent(); | 138 removeFromParent(); |
| 139 | 139 |
| 140 resetTrackedRepaints(); | 140 resetTrackedPaintInvalidations(); |
| 141 ASSERT(!m_parent); | 141 ASSERT(!m_parent); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void GraphicsLayer::setParent(GraphicsLayer* layer) | 144 void GraphicsLayer::setParent(GraphicsLayer* layer) |
| 145 { | 145 { |
| 146 ASSERT(!layer || !layer->hasAncestor(this)); | 146 ASSERT(!layer || !layer->hasAncestor(this)); |
| 147 m_parent = layer; | 147 m_parent = layer; |
| 148 } | 148 } |
| 149 | 149 |
| 150 #if ENABLE(ASSERT) | 150 #if ENABLE(ASSERT) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 clone->setDebugName(debugName(layer)); | 423 clone->setDebugName(debugName(layer)); |
| 424 return clone; | 424 return clone; |
| 425 } | 425 } |
| 426 | 426 |
| 427 WebLayer* GraphicsLayer::contentsLayerIfRegistered() | 427 WebLayer* GraphicsLayer::contentsLayerIfRegistered() |
| 428 { | 428 { |
| 429 clearContentsLayerIfUnregistered(); | 429 clearContentsLayerIfUnregistered(); |
| 430 return m_contentsLayer; | 430 return m_contentsLayer; |
| 431 } | 431 } |
| 432 | 432 |
| 433 void GraphicsLayer::resetTrackedRepaints() | 433 void GraphicsLayer::resetTrackedPaintInvalidations() |
| 434 { | 434 { |
| 435 repaintRectMap().remove(this); | 435 repaintRectMap().remove(this); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void GraphicsLayer::addRepaintRect(const FloatRect& repaintRect) | 438 void GraphicsLayer::addRepaintRect(const FloatRect& repaintRect) |
| 439 { | 439 { |
| 440 if (m_client->isTrackingRepaints()) { | 440 if (m_client->isTrackingPaintInvalidations()) { |
| 441 FloatRect largestRepaintRect(FloatPoint(), m_size); | 441 FloatRect largestRepaintRect(FloatPoint(), m_size); |
| 442 largestRepaintRect.intersect(repaintRect); | 442 largestRepaintRect.intersect(repaintRect); |
| 443 RepaintMap::iterator repaintIt = repaintRectMap().find(this); | 443 RepaintMap::iterator repaintIt = repaintRectMap().find(this); |
| 444 if (repaintIt == repaintRectMap().end()) { | 444 if (repaintIt == repaintRectMap().end()) { |
| 445 Vector<FloatRect> repaintRects; | 445 Vector<FloatRect> repaintRects; |
| 446 repaintRects.append(largestRepaintRect); | 446 repaintRects.append(largestRepaintRect); |
| 447 repaintRectMap().set(this, repaintRects); | 447 repaintRectMap().set(this, repaintRects); |
| 448 } else { | 448 } else { |
| 449 Vector<FloatRect>& repaintRects = repaintIt->value; | 449 Vector<FloatRect>& repaintRects = repaintIt->value; |
| 450 repaintRects.append(largestRepaintRect); | 450 repaintRects.append(largestRepaintRect); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 if (!m_transform.isIdentity()) | 604 if (!m_transform.isIdentity()) |
| 605 json->setArray("transform", transformAsJSONArray(m_transform)); | 605 json->setArray("transform", transformAsJSONArray(m_transform)); |
| 606 | 606 |
| 607 if (m_replicaLayer) | 607 if (m_replicaLayer) |
| 608 json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSON(flags, r
enderingContextMap)); | 608 json->setObject("replicaLayer", m_replicaLayer->layerTreeAsJSON(flags, r
enderingContextMap)); |
| 609 | 609 |
| 610 if (m_replicatedLayer) | 610 if (m_replicatedLayer) |
| 611 json->setString("replicatedLayer", flags & LayerTreeIncludesDebugInfo ?
pointerAsString(m_replicatedLayer) : ""); | 611 json->setString("replicatedLayer", flags & LayerTreeIncludesDebugInfo ?
pointerAsString(m_replicatedLayer) : ""); |
| 612 | 612 |
| 613 if ((flags & LayerTreeIncludesRepaintRects) && repaintRectMap().contains(thi
s) && !repaintRectMap().get(this).isEmpty()) { | 613 if ((flags & LayerTreeIncludesPaintInvalidationRects) && repaintRectMap().co
ntains(this) && !repaintRectMap().get(this).isEmpty()) { |
| 614 Vector<FloatRect> repaintRectsCopy = repaintRectMap().get(this); | 614 Vector<FloatRect> repaintRectsCopy = repaintRectMap().get(this); |
| 615 std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloa
tRects); | 615 std::sort(repaintRectsCopy.begin(), repaintRectsCopy.end(), &compareFloa
tRects); |
| 616 RefPtr<JSONArray> repaintRectsJSON = adoptRef(new JSONArray); | 616 RefPtr<JSONArray> repaintRectsJSON = adoptRef(new JSONArray); |
| 617 for (size_t i = 0; i < repaintRectsCopy.size(); ++i) { | 617 for (size_t i = 0; i < repaintRectsCopy.size(); ++i) { |
| 618 if (repaintRectsCopy[i].isEmpty()) | 618 if (repaintRectsCopy[i].isEmpty()) |
| 619 continue; | 619 continue; |
| 620 repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i])); | 620 repaintRectsJSON->pushArray(rectAsJSONArray(repaintRectsCopy[i])); |
| 621 } | 621 } |
| 622 json->setArray("repaintRects", repaintRectsJSON); | 622 json->setArray("repaintRects", repaintRectsJSON); |
| 623 } | 623 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 #ifndef NDEBUG | 1055 #ifndef NDEBUG |
| 1056 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1056 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
| 1057 { | 1057 { |
| 1058 if (!layer) | 1058 if (!layer) |
| 1059 return; | 1059 return; |
| 1060 | 1060 |
| 1061 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1061 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1062 fprintf(stderr, "%s\n", output.utf8().data()); | 1062 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1063 } | 1063 } |
| 1064 #endif | 1064 #endif |
| OLD | NEW |