| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 m_isTrackingRasterInvalidations(client && | 102 m_isTrackingRasterInvalidations(client && |
| 103 client->isTrackingRasterInvalidations()), | 103 client->isTrackingRasterInvalidations()), |
| 104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip), | 104 m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip), |
| 105 m_parent(0), | 105 m_parent(0), |
| 106 m_maskLayer(0), | 106 m_maskLayer(0), |
| 107 m_contentsClippingMaskLayer(0), | 107 m_contentsClippingMaskLayer(0), |
| 108 m_paintCount(0), | 108 m_paintCount(0), |
| 109 m_contentsLayer(0), | 109 m_contentsLayer(0), |
| 110 m_contentsLayerId(0), | 110 m_contentsLayerId(0), |
| 111 m_scrollableArea(nullptr), | 111 m_scrollableArea(nullptr), |
| 112 m_renderingContext3d(0) { | 112 m_renderingContext3d(0), |
| 113 m_preferredRasterScale(1.0f), |
| 114 m_hasPreferredRasterScale(false) { |
| 113 #if ENABLE(ASSERT) | 115 #if ENABLE(ASSERT) |
| 114 if (m_client) | 116 if (m_client) |
| 115 m_client->verifyNotPainting(); | 117 m_client->verifyNotPainting(); |
| 116 #endif | 118 #endif |
| 117 | 119 |
| 118 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); | 120 m_contentLayerDelegate = wrapUnique(new ContentLayerDelegate(this)); |
| 119 m_layer = Platform::current()->compositorSupport()->createContentLayer( | 121 m_layer = Platform::current()->compositorSupport()->createContentLayer( |
| 120 m_contentLayerDelegate.get()); | 122 m_contentLayerDelegate.get()); |
| 121 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); | 123 m_layer->layer()->setDrawsContent(m_drawsContent && m_contentsVisible); |
| 122 m_layer->layer()->setLayerClient(this); | 124 m_layer->layer()->setLayerClient(this); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 142 LayoutRect GraphicsLayer::visualRect() const { | 144 LayoutRect GraphicsLayer::visualRect() const { |
| 143 LayoutRect bounds = LayoutRect(FloatPoint(), size()); | 145 LayoutRect bounds = LayoutRect(FloatPoint(), size()); |
| 144 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation()); | 146 bounds.move(offsetFromLayoutObjectWithSubpixelAccumulation()); |
| 145 return bounds; | 147 return bounds; |
| 146 } | 148 } |
| 147 | 149 |
| 148 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform) { | 150 void GraphicsLayer::setHasWillChangeTransformHint(bool hasWillChangeTransform) { |
| 149 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform); | 151 m_layer->layer()->setHasWillChangeTransformHint(hasWillChangeTransform); |
| 150 } | 152 } |
| 151 | 153 |
| 154 void GraphicsLayer::setPreferredRasterScale(float preferredRasterScale) { |
| 155 m_preferredRasterScale = preferredRasterScale; |
| 156 m_hasPreferredRasterScale = true; |
| 157 m_layer->layer()->setPreferredRasterScale(preferredRasterScale); |
| 158 } |
| 159 |
| 160 void GraphicsLayer::clearPreferredRasterScale() { |
| 161 m_preferredRasterScale = 1.0f; |
| 162 m_hasPreferredRasterScale = false; |
| 163 m_layer->layer()->clearPreferredRasterScale(); |
| 164 } |
| 165 |
| 152 void GraphicsLayer::setParent(GraphicsLayer* layer) { | 166 void GraphicsLayer::setParent(GraphicsLayer* layer) { |
| 153 ASSERT(!layer || !layer->hasAncestor(this)); | 167 ASSERT(!layer || !layer->hasAncestor(this)); |
| 154 m_parent = layer; | 168 m_parent = layer; |
| 155 } | 169 } |
| 156 | 170 |
| 157 #if ENABLE(ASSERT) | 171 #if ENABLE(ASSERT) |
| 158 | 172 |
| 159 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const { | 173 bool GraphicsLayer::hasAncestor(GraphicsLayer* ancestor) const { |
| 160 for (GraphicsLayer* curr = parent(); curr; curr = curr->parent()) { | 174 for (GraphicsLayer* curr = parent(); curr; curr = curr->parent()) { |
| 161 if (curr == ancestor) | 175 if (curr == ancestor) |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 if (m_drawsContent) | 680 if (m_drawsContent) |
| 667 json->setBoolean("drawsContent", m_drawsContent); | 681 json->setBoolean("drawsContent", m_drawsContent); |
| 668 | 682 |
| 669 if (!m_contentsVisible) | 683 if (!m_contentsVisible) |
| 670 json->setBoolean("contentsVisible", m_contentsVisible); | 684 json->setBoolean("contentsVisible", m_contentsVisible); |
| 671 | 685 |
| 672 if (!m_backfaceVisibility) | 686 if (!m_backfaceVisibility) |
| 673 json->setString("backfaceVisibility", | 687 json->setString("backfaceVisibility", |
| 674 m_backfaceVisibility ? "visible" : "hidden"); | 688 m_backfaceVisibility ? "visible" : "hidden"); |
| 675 | 689 |
| 690 if (m_hasPreferredRasterScale) |
| 691 json->setDouble("preferredRasterScale", m_preferredRasterScale); |
| 692 |
| 676 if (flags & LayerTreeIncludesDebugInfo) | 693 if (flags & LayerTreeIncludesDebugInfo) |
| 677 json->setString("client", pointerAsString(m_client)); | 694 json->setString("client", pointerAsString(m_client)); |
| 678 | 695 |
| 679 if (m_backgroundColor.alpha()) | 696 if (m_backgroundColor.alpha()) |
| 680 json->setString("backgroundColor", | 697 json->setString("backgroundColor", |
| 681 m_backgroundColor.nameForLayoutTreeAsText()); | 698 m_backgroundColor.nameForLayoutTreeAsText()); |
| 682 | 699 |
| 683 if (!m_transform.isIdentity()) | 700 if (!m_transform.isIdentity()) |
| 684 json->setArray("transform", transformAsJSONArray(m_transform)); | 701 json->setArray("transform", transformAsJSONArray(m_transform)); |
| 685 | 702 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { | 1290 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) { |
| 1274 if (!layer) { | 1291 if (!layer) { |
| 1275 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1292 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
| 1276 return; | 1293 return; |
| 1277 } | 1294 } |
| 1278 | 1295 |
| 1279 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1296 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
| 1280 fprintf(stderr, "%s\n", output.utf8().data()); | 1297 fprintf(stderr, "%s\n", output.utf8().data()); |
| 1281 } | 1298 } |
| 1282 #endif | 1299 #endif |
| OLD | NEW |