| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    91     , m_contentsOpaque(false) |    91     , m_contentsOpaque(false) | 
|    92     , m_preserves3D(false) |    92     , m_preserves3D(false) | 
|    93     , m_backfaceVisibility(true) |    93     , m_backfaceVisibility(true) | 
|    94     , m_masksToBounds(false) |    94     , m_masksToBounds(false) | 
|    95     , m_drawsContent(false) |    95     , m_drawsContent(false) | 
|    96     , m_contentsVisible(true) |    96     , m_contentsVisible(true) | 
|    97     , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) |    97     , m_paintingPhase(GraphicsLayerPaintAllWithOverflowClip) | 
|    98     , m_contentsOrientation(CompositingCoordinatesTopDown) |    98     , m_contentsOrientation(CompositingCoordinatesTopDown) | 
|    99     , m_parent(0) |    99     , m_parent(0) | 
|   100     , m_maskLayer(0) |   100     , m_maskLayer(0) | 
 |   101     , m_contentsClippingMaskLayer(0) | 
|   101     , m_replicaLayer(0) |   102     , m_replicaLayer(0) | 
|   102     , m_replicatedLayer(0) |   103     , m_replicatedLayer(0) | 
|   103     , m_paintCount(0) |   104     , m_paintCount(0) | 
|   104     , m_contentsLayer(0) |   105     , m_contentsLayer(0) | 
|   105     , m_contentsLayerId(0) |   106     , m_contentsLayerId(0) | 
|   106     , m_contentsLayerPurpose(NoContentsLayer) |   107     , m_contentsLayerPurpose(NoContentsLayer) | 
|   107     , m_scrollableArea(0) |   108     , m_scrollableArea(0) | 
|   108     , m_compositingReasons(WebKit::CompositingReasonUnknown) |   109     , m_compositingReasons(WebKit::CompositingReasonUnknown) | 
|   109 { |   110 { | 
|   110 #ifndef NDEBUG |   111 #ifndef NDEBUG | 
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   424 } |   425 } | 
|   425  |   426  | 
|   426 void GraphicsLayer::updateContentsRect() |   427 void GraphicsLayer::updateContentsRect() | 
|   427 { |   428 { | 
|   428     WebLayer* contentsLayer = contentsLayerIfRegistered(); |   429     WebLayer* contentsLayer = contentsLayerIfRegistered(); | 
|   429     if (!contentsLayer) |   430     if (!contentsLayer) | 
|   430         return; |   431         return; | 
|   431  |   432  | 
|   432     contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()
      )); |   433     contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()
      )); | 
|   433     contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.heig
      ht())); |   434     contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.heig
      ht())); | 
 |   435  | 
 |   436     if (m_contentsClippingMaskLayer) { | 
 |   437         if (m_contentsClippingMaskLayer->size() != m_contentsRect.size()) { | 
 |   438             m_contentsClippingMaskLayer->setSize(m_contentsRect.size()); | 
 |   439             m_contentsClippingMaskLayer->setNeedsDisplay(); | 
 |   440         } | 
 |   441         m_contentsClippingMaskLayer->setPosition(FloatPoint()); | 
 |   442         m_contentsClippingMaskLayer->setOffsetFromRenderer(offsetFromRenderer() 
      + IntSize(m_contentsRect.location().x(), m_contentsRect.location().y())); | 
 |   443     } | 
|   434 } |   444 } | 
|   435  |   445  | 
|   436 static HashSet<int>* s_registeredLayerSet; |   446 static HashSet<int>* s_registeredLayerSet; | 
|   437  |   447  | 
|   438 void GraphicsLayer::registerContentsLayer(WebLayer* layer) |   448 void GraphicsLayer::registerContentsLayer(WebLayer* layer) | 
|   439 { |   449 { | 
|   440     if (!s_registeredLayerSet) |   450     if (!s_registeredLayerSet) | 
|   441         s_registeredLayerSet = new HashSet<int>; |   451         s_registeredLayerSet = new HashSet<int>; | 
|   442     if (s_registeredLayerSet->contains(layer->id())) |   452     if (s_registeredLayerSet->contains(layer->id())) | 
|   443         CRASH(); |   453         CRASH(); | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   489         m_contentsLayer->setAnchorPoint(FloatPoint(0, 0)); |   499         m_contentsLayer->setAnchorPoint(FloatPoint(0, 0)); | 
|   490         m_contentsLayer->setUseParentBackfaceVisibility(true); |   500         m_contentsLayer->setUseParentBackfaceVisibility(true); | 
|   491  |   501  | 
|   492         // It is necessary to call setDrawsContent as soon as we receive the new
       contentsLayer, for |   502         // It is necessary to call setDrawsContent as soon as we receive the new
       contentsLayer, for | 
|   493         // the correctness of early exit conditions in setDrawsContent() and set
      ContentsVisible(). |   503         // the correctness of early exit conditions in setDrawsContent() and set
      ContentsVisible(). | 
|   494         m_contentsLayer->setDrawsContent(m_contentsVisible); |   504         m_contentsLayer->setDrawsContent(m_contentsVisible); | 
|   495  |   505  | 
|   496         // Insert the content layer first. Video elements require this, because 
      they have |   506         // Insert the content layer first. Video elements require this, because 
      they have | 
|   497         // shadow content that must display in front of the video. |   507         // shadow content that must display in front of the video. | 
|   498         m_layer->layer()->insertChild(m_contentsLayer, 0); |   508         m_layer->layer()->insertChild(m_contentsLayer, 0); | 
 |   509         WebLayer* borderWebLayer = m_contentsClippingMaskLayer ? m_contentsClipp
      ingMaskLayer->platformLayer() : 0; | 
 |   510         m_contentsLayer->setMaskLayer(borderWebLayer); | 
|   499     } |   511     } | 
|   500 } |   512 } | 
|   501  |   513  | 
|   502 void GraphicsLayer::clearContentsLayerIfUnregistered() |   514 void GraphicsLayer::clearContentsLayerIfUnregistered() | 
|   503 { |   515 { | 
|   504     if (!m_contentsLayerId || s_registeredLayerSet->contains(m_contentsLayerId)) |   516     if (!m_contentsLayerId || s_registeredLayerSet->contains(m_contentsLayerId)) | 
|   505         return; |   517         return; | 
|   506  |   518  | 
|   507     m_contentsLayer = 0; |   519     m_contentsLayer = 0; | 
|   508     m_contentsLayerId = 0; |   520     m_contentsLayerId = 0; | 
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   697             ts << "GraphicsLayerPaintBackground\n"; |   709             ts << "GraphicsLayerPaintBackground\n"; | 
|   698         } |   710         } | 
|   699         if (paintingPhase() & GraphicsLayerPaintForeground) { |   711         if (paintingPhase() & GraphicsLayerPaintForeground) { | 
|   700             writeIndent(ts, indent + 2); |   712             writeIndent(ts, indent + 2); | 
|   701             ts << "GraphicsLayerPaintForeground\n"; |   713             ts << "GraphicsLayerPaintForeground\n"; | 
|   702         } |   714         } | 
|   703         if (paintingPhase() & GraphicsLayerPaintMask) { |   715         if (paintingPhase() & GraphicsLayerPaintMask) { | 
|   704             writeIndent(ts, indent + 2); |   716             writeIndent(ts, indent + 2); | 
|   705             ts << "GraphicsLayerPaintMask\n"; |   717             ts << "GraphicsLayerPaintMask\n"; | 
|   706         } |   718         } | 
 |   719         if (paintingPhase() & GraphicsLayerPaintChildClippingMask) { | 
 |   720             writeIndent(ts, indent + 2); | 
 |   721             ts << "GraphicsLayerPaintChildClippingMask\n"; | 
 |   722         } | 
|   707         if (paintingPhase() & GraphicsLayerPaintOverflowContents) { |   723         if (paintingPhase() & GraphicsLayerPaintOverflowContents) { | 
|   708             writeIndent(ts, indent + 2); |   724             writeIndent(ts, indent + 2); | 
|   709             ts << "GraphicsLayerPaintOverflowContents\n"; |   725             ts << "GraphicsLayerPaintOverflowContents\n"; | 
|   710         } |   726         } | 
|   711         if (paintingPhase() & GraphicsLayerPaintCompositedScroll) { |   727         if (paintingPhase() & GraphicsLayerPaintCompositedScroll) { | 
|   712             writeIndent(ts, indent + 2); |   728             writeIndent(ts, indent + 2); | 
|   713             ts << "GraphicsLayerPaintCompositedScroll\n"; |   729             ts << "GraphicsLayerPaintCompositedScroll\n"; | 
|   714         } |   730         } | 
|   715         writeIndent(ts, indent + 1); |   731         writeIndent(ts, indent + 1); | 
|   716         ts << ")\n"; |   732         ts << ")\n"; | 
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   869 void GraphicsLayer::setMaskLayer(GraphicsLayer* maskLayer) |   885 void GraphicsLayer::setMaskLayer(GraphicsLayer* maskLayer) | 
|   870 { |   886 { | 
|   871     if (maskLayer == m_maskLayer) |   887     if (maskLayer == m_maskLayer) | 
|   872         return; |   888         return; | 
|   873  |   889  | 
|   874     m_maskLayer = maskLayer; |   890     m_maskLayer = maskLayer; | 
|   875     WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0; |   891     WebLayer* maskWebLayer = m_maskLayer ? m_maskLayer->platformLayer() : 0; | 
|   876     m_layer->layer()->setMaskLayer(maskWebLayer); |   892     m_layer->layer()->setMaskLayer(maskWebLayer); | 
|   877 } |   893 } | 
|   878  |   894  | 
 |   895 void GraphicsLayer::setContentsClippingMaskLayer(GraphicsLayer* contentsClipping
      MaskLayer) | 
 |   896 { | 
 |   897     if (contentsClippingMaskLayer == m_contentsClippingMaskLayer) | 
 |   898         return; | 
 |   899  | 
 |   900     m_contentsClippingMaskLayer = contentsClippingMaskLayer; | 
 |   901     WebLayer* contentsClippingMaskWebLayer = m_contentsClippingMaskLayer ? m_con
      tentsClippingMaskLayer->platformLayer() : 0; | 
 |   902     if (hasContentsLayer()) | 
 |   903         contentsLayer()->setMaskLayer(contentsClippingMaskWebLayer); | 
 |   904     updateContentsRect(); | 
 |   905 } | 
 |   906  | 
|   879 void GraphicsLayer::setBackfaceVisibility(bool visible) |   907 void GraphicsLayer::setBackfaceVisibility(bool visible) | 
|   880 { |   908 { | 
|   881     m_backfaceVisibility = visible; |   909     m_backfaceVisibility = visible; | 
|   882     m_layer->setDoubleSided(m_backfaceVisibility); |   910     m_layer->setDoubleSided(m_backfaceVisibility); | 
|   883 } |   911 } | 
|   884  |   912  | 
|   885 void GraphicsLayer::setOpacity(float opacity) |   913 void GraphicsLayer::setOpacity(float opacity) | 
|   886 { |   914 { | 
|   887     float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); |   915     float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f); | 
|   888     m_opacity = clampedOpacity; |   916     m_opacity = clampedOpacity; | 
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1211 #ifndef NDEBUG |  1239 #ifndef NDEBUG | 
|  1212 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) |  1240 void showGraphicsLayerTree(const WebCore::GraphicsLayer* layer) | 
|  1213 { |  1241 { | 
|  1214     if (!layer) |  1242     if (!layer) | 
|  1215         return; |  1243         return; | 
|  1216  |  1244  | 
|  1217     String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); |  1245     String output = layer->layerTreeAsText(WebCore::LayerTreeIncludesDebugInfo); | 
|  1218     fprintf(stderr, "%s\n", output.utf8().data()); |  1246     fprintf(stderr, "%s\n", output.utf8().data()); | 
|  1219 } |  1247 } | 
|  1220 #endif |  1248 #endif | 
| OLD | NEW |