| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 void SVGImageChromeClient::chromeDestroyed() | 57 void SVGImageChromeClient::chromeDestroyed() |
| 58 { | 58 { |
| 59 m_image = nullptr; | 59 m_image = nullptr; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void SVGImageChromeClient::invalidateRect(const IntRect& r) | 62 void SVGImageChromeClient::invalidateRect(const IntRect& r) |
| 63 { | 63 { |
| 64 // If m_image->m_page is null, we're being destructed, don't fire changedInR
ect() in that case. | 64 // If m_image->m_page is null, we're being destructed, don't fire changedInR
ect() in that case. |
| 65 if (m_image && m_image->imageObserver() && m_image->m_page) | 65 if (m_image && m_image->getImageObserver() && m_image->m_page) |
| 66 m_image->imageObserver()->changedInRect(m_image, r); | 66 m_image->getImageObserver()->changedInRect(m_image, r); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SVGImageChromeClient::scheduleAnimation(Widget*) | 69 void SVGImageChromeClient::scheduleAnimation(Widget*) |
| 70 { | 70 { |
| 71 // Because a single SVGImage can be shared by multiple pages, we can't key | 71 // Because a single SVGImage can be shared by multiple pages, we can't key |
| 72 // our svg image layout on the page's real animation frame. Therefore, we | 72 // our svg image layout on the page's real animation frame. Therefore, we |
| 73 // run this fake animation timer to trigger layout in SVGImages. The name, | 73 // run this fake animation timer to trigger layout in SVGImages. The name, |
| 74 // "animationTimer", is to match the new requestAnimationFrame-based layout | 74 // "animationTimer", is to match the new requestAnimationFrame-based layout |
| 75 // approach. | 75 // approach. |
| 76 if (m_animationTimer.isActive()) | 76 if (m_animationTimer.isActive()) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 88 if (!m_image) | 88 if (!m_image) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 #if ENABLE(OILPAN) | 91 #if ENABLE(OILPAN) |
| 92 // The SVGImageChromeClient object's lifetime is dependent on | 92 // The SVGImageChromeClient object's lifetime is dependent on |
| 93 // the ImageObserver (an ImageResource) of its image. Should it | 93 // the ImageObserver (an ImageResource) of its image. Should it |
| 94 // be dead and about to be lazily swept out, do not proceed. | 94 // be dead and about to be lazily swept out, do not proceed. |
| 95 // | 95 // |
| 96 // TODO(Oilpan): move (SVG)Image to the Oilpan heap, and avoid | 96 // TODO(Oilpan): move (SVG)Image to the Oilpan heap, and avoid |
| 97 // this explicit lifetime check. | 97 // this explicit lifetime check. |
| 98 if (Heap::willObjectBeLazilySwept(m_image->imageObserver())) | 98 if (Heap::willObjectBeLazilySwept(m_image->getImageObserver())) |
| 99 return; | 99 return; |
| 100 #endif | 100 #endif |
| 101 | 101 |
| 102 // serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG | 102 // serviceScriptedAnimations runs requestAnimationFrame callbacks, but SVG |
| 103 // images can't have any so we assert there's no script. | 103 // images can't have any so we assert there's no script. |
| 104 ScriptForbiddenScope forbidScript; | 104 ScriptForbiddenScope forbidScript; |
| 105 | 105 |
| 106 // The calls below may trigger GCs, so set up the required persistent | 106 // The calls below may trigger GCs, so set up the required persistent |
| 107 // reference on the ImageResource which owns this SVGImage. By transitivity, | 107 // reference on the ImageResource which owns this SVGImage. By transitivity, |
| 108 // that will keep this SVGImageChromeClient object alive. | 108 // that will keep this SVGImageChromeClient object alive. |
| 109 RawPtrWillBePersistent<ImageObserver> protect(m_image->imageObserver()); | 109 RawPtrWillBePersistent<ImageObserver> protect(m_image->getImageObserver()); |
| 110 m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonic
allyIncreasingTime()); | 110 m_image->frameView()->page()->animator().serviceScriptedAnimations(monotonic
allyIncreasingTime()); |
| 111 m_image->frameView()->updateAllLifecyclePhases(); | 111 m_image->frameView()->updateAllLifecyclePhases(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |