|
Lines 29-34
a/Source/WebCore/page/FrameView.cpp_sec1
|
| 29 |
|
29 |
|
| 30 |
#include "AXObjectCache.h" |
30 |
#include "AXObjectCache.h" |
| 31 |
#include "BackForwardController.h" |
31 |
#include "BackForwardController.h" |
|
|
32 |
#include "BitmapImage.h" |
| 32 |
#include "CachedImage.h" |
33 |
#include "CachedImage.h" |
| 33 |
#include "CachedResourceLoader.h" |
34 |
#include "CachedResourceLoader.h" |
| 34 |
#include "Chrome.h" |
35 |
#include "Chrome.h" |
|
Lines 58-63
a/Source/WebCore/page/FrameView.cpp_sec2
|
| 58 |
#include "RenderEmbeddedObject.h" |
59 |
#include "RenderEmbeddedObject.h" |
| 59 |
#include "RenderFullScreen.h" |
60 |
#include "RenderFullScreen.h" |
| 60 |
#include "RenderIFrame.h" |
61 |
#include "RenderIFrame.h" |
|
|
62 |
#include "RenderImage.h" |
| 61 |
#include "RenderLayer.h" |
63 |
#include "RenderLayer.h" |
| 62 |
#include "RenderLayerBacking.h" |
64 |
#include "RenderLayerBacking.h" |
| 63 |
#include "RenderPart.h" |
65 |
#include "RenderPart.h" |
|
Lines 3555-3560
void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
a/Source/WebCore/page/FrameView.cpp_sec3
|
| 3555 |
|
3557 |
|
| 3556 |
m_isPainting = false; |
3558 |
m_isPainting = false; |
| 3557 |
|
3559 |
|
|
|
3560 |
// resume animations after painting |
| 3561 |
resumeAnimatingImagesIfNeeded(rect); |
| 3562 |
|
| 3558 |
if (flatteningPaint && isRootFrame) |
3563 |
if (flatteningPaint && isRootFrame) |
| 3559 |
notifyWidgetsInAllFrames(DidPaintFlattened); |
3564 |
notifyWidgetsInAllFrames(DidPaintFlattened); |
| 3560 |
|
3565 |
|
|
Lines 4041-4046
void FrameView::removeChild(Widget* widget)
a/Source/WebCore/page/FrameView.cpp_sec4
|
| 4041 |
ScrollView::removeChild(widget); |
4046 |
ScrollView::removeChild(widget); |
| 4042 |
} |
4047 |
} |
| 4043 |
|
4048 |
|
|
|
4049 |
// place animation in the vector of stopped animations |
| 4050 |
void FrameView::saveStoppedAnimation(RenderObject* animation) |
| 4051 |
{ |
| 4052 |
const size_t index = m_animationsToResume.find(animation); |
| 4053 |
ASSERT(index > -1); |
| 4054 |
m_animationsToResume.remove(index); |
| 4055 |
m_stoppedAnimations.append(animation); |
| 4056 |
} |
| 4057 |
|
| 4058 |
// remember animation, it may be saved already |
| 4059 |
void FrameView::animateLater(RenderObject* animation) |
| 4060 |
{ |
| 4061 |
if (m_animationsToResume.contains(animation)) |
| 4062 |
return; |
| 4063 |
|
| 4064 |
if (m_stoppedAnimations.contains(animation)) |
| 4065 |
return; |
| 4066 |
|
| 4067 |
// we didn't deal with it yet |
| 4068 |
m_stoppedAnimations.append(animation); |
| 4069 |
} |
| 4070 |
|
| 4071 |
void FrameView::removeSavedAnimation(RenderObject* animation) |
| 4072 |
{ |
| 4073 |
size_t index = m_animationsToResume.find(animation); |
| 4074 |
if (index != WTF::notFound) { |
| 4075 |
m_animationsToResume.remove(index); |
| 4076 |
return; |
| 4077 |
} |
| 4078 |
|
| 4079 |
index = m_stoppedAnimations.find(animation); |
| 4080 |
if (index != WTF::notFound) |
| 4081 |
m_stoppedAnimations.remove(index); |
| 4082 |
} |
| 4083 |
|
| 4084 |
void FrameView::resumeAnimatingImagesIfNeeded(const IntRect& area) |
| 4085 |
{ |
| 4086 |
RenderObject* stoppedAnimation; |
| 4087 |
IntRect stoppedAnimationBoundingBox; |
| 4088 |
bool intersectsArea; |
| 4089 |
|
| 4090 |
// search for animations that are now stopped but should be resumed |
| 4091 |
unsigned lastElementNeedToKeep = 0; |
| 4092 |
while (m_stoppedAnimations.size() != lastElementNeedToKeep) { |
| 4093 |
stoppedAnimation = m_stoppedAnimations[lastElementNeedToKeep]; |
| 4094 |
stoppedAnimationBoundingBox = stoppedAnimation->absoluteBoundingBoxRect(); |
| 4095 |
intersectsArea = stoppedAnimationBoundingBox.intersects(area); |
| 4096 |
if (intersectsArea) { |
| 4097 |
m_stoppedAnimations.remove(lastElementNeedToKeep); |
| 4098 |
m_animationsToResume.append(stoppedAnimation); |
| 4099 |
} else { |
| 4100 |
// skip actual animation |
| 4101 |
lastElementNeedToKeep++; |
| 4102 |
} |
| 4103 |
} |
| 4104 |
|
| 4105 |
RenderObject* animationToResume; |
| 4106 |
IntRect animationToResumeBoundingBox; |
| 4107 |
unsigned size = m_animationsToResume.size(); |
| 4108 |
for (unsigned n = 0; n < size; ++n) { |
| 4109 |
animationToResume = m_animationsToResume[n]; |
| 4110 |
animationToResumeBoundingBox = animationToResume->absoluteBoundingBoxRect(); |
| 4111 |
intersectsArea = animationToResumeBoundingBox.intersects(area); |
| 4112 |
// start every animation that should be resumed |
| 4113 |
if (intersectsArea) { |
| 4114 |
CachedImage* cachedImage = toRenderImage(animationToResume)->cachedImage(); |
| 4115 |
if (!cachedImage) |
| 4116 |
continue; |
| 4117 |
if (!cachedImage->hasImage()) |
| 4118 |
continue; |
| 4119 |
Image* image = cachedImage->image(); |
| 4120 |
if (!image->isBitmapImage()) |
| 4121 |
continue; |
| 4122 |
BitmapImage* bitmapImage = static_cast<BitmapImage*>(image); |
| 4123 |
if (!bitmapImage->canAnimate()) |
| 4124 |
continue; |
| 4125 |
image->startAnimation(); |
| 4126 |
} |
| 4127 |
} |
| 4128 |
} |
| 4129 |
|
| 4130 |
bool FrameView::shouldRenderAnimation(RenderObject* animation) |
| 4131 |
{ |
| 4132 |
bool visible = visibleContentRect().intersects(animation->absoluteBoundingBoxRect()); |
| 4133 |
if (m_isViewPortScrolled) |
| 4134 |
visible = m_scrolledViewPort.intersects(animation->absoluteBoundingBoxRect()); |
| 4135 |
|
| 4136 |
bool animationShouldResume = m_animationsToResume.find(animation) != WTF::notFound; |
| 4137 |
if (visible && animationShouldResume) |
| 4138 |
return true; |
| 4139 |
|
| 4140 |
// save animation in order to deal with it later |
| 4141 |
saveStoppedAnimation(animation); |
| 4142 |
|
| 4143 |
return false; |
| 4144 |
} |
| 4145 |
|
| 4146 |
IntRect FrameView::computeScrolledViewPort(float deltaX, float deltaY) |
| 4147 |
{ |
| 4148 |
IntRect viewPort = visibleContentRect(); |
| 4149 |
int newX = viewPort.x() - deltaX; |
| 4150 |
int newY = viewPort.y() - deltaY; |
| 4151 |
IntRect scrolledViewPort(IntPoint(newX, newY), viewPort.size()); |
| 4152 |
|
| 4153 |
return scrolledViewPort; |
| 4154 |
} |
| 4155 |
|
| 4044 |
bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) |
4156 |
bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent) |
| 4045 |
{ |
4157 |
{ |
| 4046 |
// Note that to allow for rubber-band over-scroll behavior, even non-scrollable views |
4158 |
// Note that to allow for rubber-band over-scroll behavior, even non-scrollable views |
|
Lines 4052-4060
bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
a/Source/WebCore/page/FrameView.cpp_sec5
|
| 4052 |
|
4164 |
|
| 4053 |
if (delegatesScrolling()) { |
4165 |
if (delegatesScrolling()) { |
| 4054 |
IntSize offset = scrollOffset(); |
4166 |
IntSize offset = scrollOffset(); |
| 4055 |
IntSize newOffset = IntSize(offset.width() - wheelEvent.deltaX(), offset.height() - wheelEvent.deltaY()); |
4167 |
float deltaX = wheelEvent.deltaX(); |
|
|
4168 |
float deltaY = wheelEvent.deltaY(); |
| 4169 |
IntSize newOffset = IntSize(offset.width() - deltaX, offset.height() - deltaY); |
| 4056 |
if (offset != newOffset) { |
4170 |
if (offset != newOffset) { |
| 4057 |
ScrollView::scrollTo(newOffset); |
4171 |
ScrollView::scrollTo(newOffset); |
|
|
4172 |
|
| 4173 |
m_isViewPortScrolled = true; |
| 4174 |
m_scrolledViewPort = computeScrolledViewPort(deltaX, deltaY); |
| 4175 |
const IntRect scrolledViewPort(m_scrolledViewPort.location(), m_scrolledViewPort.size()); |
| 4176 |
// it is needed to resume animations before scrolling |
| 4177 |
resumeAnimatingImagesIfNeeded(scrolledViewPort); |
| 4178 |
m_isViewPortScrolled = false; |
| 4179 |
|
| 4058 |
scrollPositionChanged(); |
4180 |
scrollPositionChanged(); |
| 4059 |
frame()->loader()->client()->didChangeScrollOffset(); |
4181 |
frame()->loader()->client()->didChangeScrollOffset(); |
| 4060 |
} |
4182 |
} |