| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |     2  * Copyright (C) 2009, 2010, 2011 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   241 { |   241 { | 
|   242     m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); |   242     m_graphicsLayer->setOpacity(compositingOpacity(style->opacity())); | 
|   243 } |   243 } | 
|   244  |   244  | 
|   245 void RenderLayerBacking::updateTransform(const RenderStyle* style) |   245 void RenderLayerBacking::updateTransform(const RenderStyle* style) | 
|   246 { |   246 { | 
|   247     // FIXME: This could use m_owningLayer->transform(), but that currently has 
      transform-origin |   247     // FIXME: This could use m_owningLayer->transform(), but that currently has 
      transform-origin | 
|   248     // baked into it, and we don't want that. |   248     // baked into it, and we don't want that. | 
|   249     TransformationMatrix t; |   249     TransformationMatrix t; | 
|   250     if (m_owningLayer->hasTransform()) { |   250     if (m_owningLayer->hasTransform()) { | 
|   251         style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxR
      ect().size(), RenderStyle::ExcludeTransformOrigin); |   251         style->applyTransform(t, toRenderBox(renderer())->pixelSnappedBorderBoxR
      ect().size(), RenderStyle::ExcludeTransformOrigin, renderer()->view()); | 
|   252         makeMatrixRenderable(t, compositor()->canRender3DTransforms()); |   252         makeMatrixRenderable(t, compositor()->canRender3DTransforms()); | 
|   253     } |   253     } | 
|   254  |   254  | 
|   255     m_graphicsLayer->setTransform(t); |   255     m_graphicsLayer->setTransform(t); | 
|   256 } |   256 } | 
|   257  |   257  | 
|   258 void RenderLayerBacking::updateFilters(const RenderStyle* style) |   258 void RenderLayerBacking::updateFilters(const RenderStyle* style) | 
|   259 { |   259 { | 
|   260     bool didCompositeFilters = m_canCompositeFilters; |   260     bool didCompositeFilters = m_canCompositeFilters; | 
|   261     m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFi
      lterOperations(style)); |   261     m_canCompositeFilters = m_graphicsLayer->setFilters(owningLayer()->computeFi
      lterOperations(style)); | 
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1721             transformVector.insert(adoptPtr(new TransformAnimationValue(key, &(k
      eyframeStyle->transform()), tf))); |  1721             transformVector.insert(adoptPtr(new TransformAnimationValue(key, &(k
      eyframeStyle->transform()), tf))); | 
|  1722  |  1722  | 
|  1723         if ((hasOpacity && isFirstOrLastKeyframe) || currentKeyframe.containsPro
      perty(CSSPropertyOpacity)) |  1723         if ((hasOpacity && isFirstOrLastKeyframe) || currentKeyframe.containsPro
      perty(CSSPropertyOpacity)) | 
|  1724             opacityVector.insert(adoptPtr(new FloatAnimationValue(key, keyframeS
      tyle->opacity(), tf))); |  1724             opacityVector.insert(adoptPtr(new FloatAnimationValue(key, keyframeS
      tyle->opacity(), tf))); | 
|  1725  |  1725  | 
|  1726         if ((hasFilter && isFirstOrLastKeyframe) || currentKeyframe.containsProp
      erty(CSSPropertyWebkitFilter)) |  1726         if ((hasFilter && isFirstOrLastKeyframe) || currentKeyframe.containsProp
      erty(CSSPropertyWebkitFilter)) | 
|  1727             filterVector.insert(adoptPtr(new FilterAnimationValue(key, &(keyfram
      eStyle->filter()), tf))); |  1727             filterVector.insert(adoptPtr(new FilterAnimationValue(key, &(keyfram
      eStyle->filter()), tf))); | 
|  1728     } |  1728     } | 
|  1729  |  1729  | 
|  1730     bool didAnimate = false; |  1730     bool didAnimate = false; | 
 |  1731     RenderView* view = m_owningLayer->renderer()->view(); | 
|  1731  |  1732  | 
|  1732     if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderB
      ox(renderer())->pixelSnappedBorderBoxRect().size(), anim, keyframes.animationNam
      e(), timeOffset)) |  1733     if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderB
      ox(renderer())->pixelSnappedBorderBoxRect().size(), anim, keyframes.animationNam
      e(), timeOffset, view)) | 
|  1733         didAnimate = true; |  1734         didAnimate = true; | 
|  1734  |  1735  | 
|  1735     if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), an
      im, keyframes.animationName(), timeOffset)) |  1736     if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), an
      im, keyframes.animationName(), timeOffset, view)) | 
|  1736         didAnimate = true; |  1737         didAnimate = true; | 
|  1737  |  1738  | 
|  1738     if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), anim
      , keyframes.animationName(), timeOffset)) |  1739     if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), anim
      , keyframes.animationName(), timeOffset, view)) | 
|  1739         didAnimate = true; |  1740         didAnimate = true; | 
|  1740  |  1741  | 
|  1741     return didAnimate; |  1742     return didAnimate; | 
|  1742 } |  1743 } | 
|  1743  |  1744  | 
|  1744 void RenderLayerBacking::animationPaused(double timeOffset, const String& animat
      ionName) |  1745 void RenderLayerBacking::animationPaused(double timeOffset, const String& animat
      ionName) | 
|  1745 { |  1746 { | 
|  1746     m_graphicsLayer->pauseAnimation(animationName, timeOffset); |  1747     m_graphicsLayer->pauseAnimation(animationName, timeOffset); | 
|  1747 } |  1748 } | 
|  1748  |  1749  | 
|  1749 void RenderLayerBacking::animationFinished(const String& animationName) |  1750 void RenderLayerBacking::animationFinished(const String& animationName) | 
|  1750 { |  1751 { | 
|  1751     m_graphicsLayer->removeAnimation(animationName); |  1752     m_graphicsLayer->removeAnimation(animationName); | 
|  1752 } |  1753 } | 
|  1753  |  1754  | 
|  1754 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper
      ty, const RenderStyle* fromStyle, const RenderStyle* toStyle) |  1755 bool RenderLayerBacking::startTransition(double timeOffset, CSSPropertyID proper
      ty, const RenderStyle* fromStyle, const RenderStyle* toStyle) | 
|  1755 { |  1756 { | 
|  1756     bool didAnimate = false; |  1757     bool didAnimate = false; | 
 |  1758     RenderView* view = m_owningLayer->renderer()->view(); | 
|  1757  |  1759  | 
|  1758     ASSERT(property != CSSPropertyInvalid); |  1760     ASSERT(property != CSSPropertyInvalid); | 
|  1759  |  1761  | 
|  1760     if (property == CSSPropertyOpacity) { |  1762     if (property == CSSPropertyOpacity) { | 
|  1761         const CSSAnimationData* opacityAnim = toStyle->transitionForProperty(CSS
      PropertyOpacity); |  1763         const CSSAnimationData* opacityAnim = toStyle->transitionForProperty(CSS
      PropertyOpacity); | 
|  1762         if (opacityAnim && !opacityAnim->isEmptyOrZeroDuration()) { |  1764         if (opacityAnim && !opacityAnim->isEmptyOrZeroDuration()) { | 
|  1763             KeyframeValueList opacityVector(AnimatedPropertyOpacity); |  1765             KeyframeValueList opacityVector(AnimatedPropertyOpacity); | 
|  1764             opacityVector.insert(adoptPtr(new FloatAnimationValue(0, compositing
      Opacity(fromStyle->opacity())))); |  1766             opacityVector.insert(adoptPtr(new FloatAnimationValue(0, compositing
      Opacity(fromStyle->opacity())))); | 
|  1765             opacityVector.insert(adoptPtr(new FloatAnimationValue(1, compositing
      Opacity(toStyle->opacity())))); |  1767             opacityVector.insert(adoptPtr(new FloatAnimationValue(1, compositing
      Opacity(toStyle->opacity())))); | 
|  1766             // The boxSize param is only used for transform animations (which ca
      n only run on RenderBoxes), so we pass an empty size here. |  1768             // The boxSize param is only used for transform animations (which ca
      n only run on RenderBoxes), so we pass an empty size here. | 
|  1767             if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityA
      nim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOff
      set)) { |  1769             if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityA
      nim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOff
      set, view)) { | 
|  1768                 // To ensure that the correct opacity is visible when the animat
      ion ends, also set the final opacity. |  1770                 // To ensure that the correct opacity is visible when the animat
      ion ends, also set the final opacity. | 
|  1769                 updateOpacity(toStyle); |  1771                 updateOpacity(toStyle); | 
|  1770                 didAnimate = true; |  1772                 didAnimate = true; | 
|  1771             } |  1773             } | 
|  1772         } |  1774         } | 
|  1773     } |  1775     } | 
|  1774  |  1776  | 
|  1775     if (property == CSSPropertyWebkitTransform && m_owningLayer->hasTransform())
       { |  1777     if (property == CSSPropertyWebkitTransform && m_owningLayer->hasTransform())
       { | 
|  1776         const CSSAnimationData* transformAnim = toStyle->transitionForProperty(C
      SSPropertyWebkitTransform); |  1778         const CSSAnimationData* transformAnim = toStyle->transitionForProperty(C
      SSPropertyWebkitTransform); | 
|  1777         if (transformAnim && !transformAnim->isEmptyOrZeroDuration()) { |  1779         if (transformAnim && !transformAnim->isEmptyOrZeroDuration()) { | 
|  1778             KeyframeValueList transformVector(AnimatedPropertyWebkitTransform); |  1780             KeyframeValueList transformVector(AnimatedPropertyWebkitTransform); | 
|  1779             transformVector.insert(adoptPtr(new TransformAnimationValue(0, &from
      Style->transform()))); |  1781             transformVector.insert(adoptPtr(new TransformAnimationValue(0, &from
      Style->transform()))); | 
|  1780             transformVector.insert(adoptPtr(new TransformAnimationValue(1, &toSt
      yle->transform()))); |  1782             transformVector.insert(adoptPtr(new TransformAnimationValue(1, &toSt
      yle->transform()))); | 
|  1781             if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(rende
      rer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animat
      ionNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) { |  1783             if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(rende
      rer())->pixelSnappedBorderBoxRect().size(), transformAnim, GraphicsLayer::animat
      ionNameForTransition(AnimatedPropertyWebkitTransform), timeOffset, view)) { | 
|  1782                 // To ensure that the correct transform is visible when the anim
      ation ends, also set the final transform. |  1784                 // To ensure that the correct transform is visible when the anim
      ation ends, also set the final transform. | 
|  1783                 updateTransform(toStyle); |  1785                 updateTransform(toStyle); | 
|  1784                 didAnimate = true; |  1786                 didAnimate = true; | 
|  1785             } |  1787             } | 
|  1786         } |  1788         } | 
|  1787     } |  1789     } | 
|  1788  |  1790  | 
|  1789     if (property == CSSPropertyWebkitFilter && m_owningLayer->hasFilter()) { |  1791     if (property == CSSPropertyWebkitFilter && m_owningLayer->hasFilter()) { | 
|  1790         const CSSAnimationData* filterAnim = toStyle->transitionForProperty(CSSP
      ropertyWebkitFilter); |  1792         const CSSAnimationData* filterAnim = toStyle->transitionForProperty(CSSP
      ropertyWebkitFilter); | 
|  1791         if (filterAnim && !filterAnim->isEmptyOrZeroDuration()) { |  1793         if (filterAnim && !filterAnim->isEmptyOrZeroDuration()) { | 
|  1792             KeyframeValueList filterVector(AnimatedPropertyWebkitFilter); |  1794             KeyframeValueList filterVector(AnimatedPropertyWebkitFilter); | 
|  1793             filterVector.insert(adoptPtr(new FilterAnimationValue(0, &fromStyle-
      >filter()))); |  1795             filterVector.insert(adoptPtr(new FilterAnimationValue(0, &fromStyle-
      >filter()))); | 
|  1794             filterVector.insert(adoptPtr(new FilterAnimationValue(1, &toStyle->f
      ilter()))); |  1796             filterVector.insert(adoptPtr(new FilterAnimationValue(1, &toStyle->f
      ilter()))); | 
|  1795             if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAni
      m, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), time
      Offset)) { |  1797             if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAni
      m, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), time
      Offset, view)) { | 
|  1796                 // To ensure that the correct filter is visible when the animati
      on ends, also set the final filter. |  1798                 // To ensure that the correct filter is visible when the animati
      on ends, also set the final filter. | 
|  1797                 updateFilters(toStyle); |  1799                 updateFilters(toStyle); | 
|  1798                 didAnimate = true; |  1800                 didAnimate = true; | 
|  1799             } |  1801             } | 
|  1800         } |  1802         } | 
|  1801     } |  1803     } | 
|  1802  |  1804  | 
|  1803     return didAnimate; |  1805     return didAnimate; | 
|  1804 } |  1806 } | 
|  1805  |  1807  | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1916     if (m_layerForVerticalScrollbar) |  1918     if (m_layerForVerticalScrollbar) | 
|  1917         backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate
      (); |  1919         backingMemory += m_layerForVerticalScrollbar->backingStoreMemoryEstimate
      (); | 
|  1918  |  1920  | 
|  1919     if (m_layerForScrollCorner) |  1921     if (m_layerForScrollCorner) | 
|  1920         backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); |  1922         backingMemory += m_layerForScrollCorner->backingStoreMemoryEstimate(); | 
|  1921  |  1923  | 
|  1922     return backingMemory; |  1924     return backingMemory; | 
|  1923 } |  1925 } | 
|  1924  |  1926  | 
|  1925 } // namespace WebCore |  1927 } // namespace WebCore | 
| OLD | NEW |