OLD | NEW |
| (Empty) |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "config.h" | |
6 | |
7 #if USE(ACCELERATED_COMPOSITING) | |
8 | |
9 #include "CCLayerImpl.h" | |
10 | |
11 #include "base/stringprintf.h" | |
12 #include "CCDebugBorderDrawQuad.h" | |
13 #include "CCLayerSorter.h" | |
14 #include "CCMathUtil.h" | |
15 #include "CCProxy.h" | |
16 #include "CCQuadSink.h" | |
17 #include "CCScrollbarAnimationController.h" | |
18 #include "CCSettings.h" | |
19 #include "TraceEvent.h" | |
20 | |
21 using WebKit::WebTransformationMatrix; | |
22 | |
23 namespace cc { | |
24 | |
25 CCLayerImpl::CCLayerImpl(int id) | |
26 : m_parent(0) | |
27 , m_maskLayerId(-1) | |
28 , m_replicaLayerId(-1) | |
29 , m_layerId(id) | |
30 , m_layerTreeHostImpl(0) | |
31 , m_anchorPoint(0.5, 0.5) | |
32 , m_anchorPointZ(0) | |
33 , m_scrollable(false) | |
34 , m_shouldScrollOnMainThread(false) | |
35 , m_haveWheelEventHandlers(false) | |
36 , m_backgroundColor(0) | |
37 , m_doubleSided(true) | |
38 , m_layerPropertyChanged(false) | |
39 , m_layerSurfacePropertyChanged(false) | |
40 , m_masksToBounds(false) | |
41 , m_contentsOpaque(false) | |
42 , m_opacity(1.0) | |
43 , m_preserves3D(false) | |
44 , m_useParentBackfaceVisibility(false) | |
45 , m_drawCheckerboardForMissingTiles(false) | |
46 , m_useLCDText(false) | |
47 , m_drawsContent(false) | |
48 , m_forceRenderSurface(false) | |
49 , m_isContainerForFixedPositionLayers(false) | |
50 , m_fixedToContainerLayer(false) | |
51 , m_renderTarget(0) | |
52 , m_drawDepth(0) | |
53 , m_drawOpacity(0) | |
54 , m_drawOpacityIsAnimating(false) | |
55 , m_debugBorderColor(0) | |
56 , m_debugBorderWidth(0) | |
57 , m_drawTransformIsAnimating(false) | |
58 , m_screenSpaceTransformIsAnimating(false) | |
59 #ifndef NDEBUG | |
60 , m_betweenWillDrawAndDidDraw(false) | |
61 #endif | |
62 , m_layerAnimationController(CCLayerAnimationController::create(this)) | |
63 { | |
64 ASSERT(CCProxy::isImplThread()); | |
65 ASSERT(m_layerId > 0); | |
66 } | |
67 | |
68 CCLayerImpl::~CCLayerImpl() | |
69 { | |
70 ASSERT(CCProxy::isImplThread()); | |
71 #ifndef NDEBUG | |
72 ASSERT(!m_betweenWillDrawAndDidDraw); | |
73 #endif | |
74 } | |
75 | |
76 void CCLayerImpl::addChild(scoped_ptr<CCLayerImpl> child) | |
77 { | |
78 child->setParent(this); | |
79 m_children.append(child.Pass()); | |
80 } | |
81 | |
82 void CCLayerImpl::removeFromParent() | |
83 { | |
84 if (!m_parent) | |
85 return; | |
86 | |
87 CCLayerImpl* parent = m_parent; | |
88 m_parent = 0; | |
89 | |
90 for (size_t i = 0; i < parent->m_children.size(); ++i) { | |
91 if (parent->m_children[i] == this) { | |
92 parent->m_children.remove(i); | |
93 return; | |
94 } | |
95 } | |
96 } | |
97 | |
98 void CCLayerImpl::removeAllChildren() | |
99 { | |
100 while (m_children.size()) | |
101 m_children[0]->removeFromParent(); | |
102 } | |
103 | |
104 void CCLayerImpl::clearChildList() | |
105 { | |
106 m_children.clear(); | |
107 } | |
108 | |
109 void CCLayerImpl::createRenderSurface() | |
110 { | |
111 ASSERT(!m_renderSurface); | |
112 m_renderSurface = adoptPtr(new CCRenderSurface(this)); | |
113 setRenderTarget(this); | |
114 } | |
115 | |
116 bool CCLayerImpl::descendantDrawsContent() | |
117 { | |
118 for (size_t i = 0; i < m_children.size(); ++i) { | |
119 if (m_children[i]->drawsContent() || m_children[i]->descendantDrawsConte
nt()) | |
120 return true; | |
121 } | |
122 return false; | |
123 } | |
124 | |
125 scoped_ptr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const | |
126 { | |
127 return CCSharedQuadState::create(m_drawTransform, m_visibleContentRect, m_dr
awableContentRect, m_drawOpacity, m_contentsOpaque); | |
128 } | |
129 | |
130 void CCLayerImpl::willDraw(CCResourceProvider*) | |
131 { | |
132 #ifndef NDEBUG | |
133 // willDraw/didDraw must be matched. | |
134 ASSERT(!m_betweenWillDrawAndDidDraw); | |
135 m_betweenWillDrawAndDidDraw = true; | |
136 #endif | |
137 } | |
138 | |
139 void CCLayerImpl::didDraw(CCResourceProvider*) | |
140 { | |
141 #ifndef NDEBUG | |
142 ASSERT(m_betweenWillDrawAndDidDraw); | |
143 m_betweenWillDrawAndDidDraw = false; | |
144 #endif | |
145 } | |
146 | |
147 void CCLayerImpl::appendDebugBorderQuad(CCQuadSink& quadList, const CCSharedQuad
State* sharedQuadState, CCAppendQuadsData& appendQuadsData) const | |
148 { | |
149 if (!hasDebugBorders()) | |
150 return; | |
151 | |
152 IntRect contentRect(IntPoint(), contentBounds()); | |
153 quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect,
debugBorderColor(), debugBorderWidth()).PassAs<CCDrawQuad>(), appendQuadsData); | |
154 } | |
155 | |
156 bool CCLayerImpl::hasContributingDelegatedRenderPasses() const | |
157 { | |
158 return false; | |
159 } | |
160 | |
161 CCRenderPass::Id CCLayerImpl::firstContributingRenderPassId() const | |
162 { | |
163 return CCRenderPass::Id(0, 0); | |
164 } | |
165 | |
166 CCRenderPass::Id CCLayerImpl::nextContributingRenderPassId(CCRenderPass::Id) con
st | |
167 { | |
168 return CCRenderPass::Id(0, 0); | |
169 } | |
170 | |
171 CCResourceProvider::ResourceId CCLayerImpl::contentsResourceId() const | |
172 { | |
173 ASSERT_NOT_REACHED(); | |
174 return 0; | |
175 } | |
176 | |
177 FloatSize CCLayerImpl::scrollBy(const FloatSize& scroll) | |
178 { | |
179 IntSize minDelta = -toSize(m_scrollPosition); | |
180 IntSize maxDelta = m_maxScrollPosition - toSize(m_scrollPosition); | |
181 // Clamp newDelta so that position + delta stays within scroll bounds. | |
182 FloatSize newDelta = (m_scrollDelta + scroll).expandedTo(minDelta).shrunkTo(
maxDelta); | |
183 FloatSize unscrolled = m_scrollDelta + scroll - newDelta; | |
184 | |
185 if (m_scrollDelta == newDelta) | |
186 return unscrolled; | |
187 | |
188 m_scrollDelta = newDelta; | |
189 if (m_scrollbarAnimationController) | |
190 m_scrollbarAnimationController->updateScrollOffset(this); | |
191 noteLayerPropertyChangedForSubtree(); | |
192 | |
193 return unscrolled; | |
194 } | |
195 | |
196 CCInputHandlerClient::ScrollStatus CCLayerImpl::tryScroll(const IntPoint& viewpo
rtPoint, CCInputHandlerClient::ScrollInputType type) const | |
197 { | |
198 if (shouldScrollOnMainThread()) { | |
199 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed shouldScrollOnMainThr
ead"); | |
200 return CCInputHandlerClient::ScrollOnMainThread; | |
201 } | |
202 | |
203 if (!screenSpaceTransform().isInvertible()) { | |
204 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Ignored nonInvertibleTransfo
rm"); | |
205 return CCInputHandlerClient::ScrollIgnored; | |
206 } | |
207 | |
208 if (!nonFastScrollableRegion().isEmpty()) { | |
209 bool clipped = false; | |
210 FloatPoint hitTestPointInLocalSpace = CCMathUtil::projectPoint(screenSpa
ceTransform().inverse(), FloatPoint(viewportPoint), clipped); | |
211 if (!clipped && nonFastScrollableRegion().contains(flooredIntPoint(hitTe
stPointInLocalSpace))) { | |
212 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed nonFastScrollable
Region"); | |
213 return CCInputHandlerClient::ScrollOnMainThread; | |
214 } | |
215 } | |
216 | |
217 if (type == CCInputHandlerClient::Wheel && haveWheelEventHandlers()) { | |
218 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Failed wheelEventHandlers"); | |
219 return CCInputHandlerClient::ScrollOnMainThread; | |
220 } | |
221 | |
222 if (!scrollable()) { | |
223 TRACE_EVENT0("cc", "CCLayerImpl::tryScroll: Ignored not scrollable"); | |
224 return CCInputHandlerClient::ScrollIgnored; | |
225 } | |
226 | |
227 return CCInputHandlerClient::ScrollStarted; | |
228 } | |
229 | |
230 bool CCLayerImpl::drawCheckerboardForMissingTiles() const | |
231 { | |
232 return m_drawCheckerboardForMissingTiles && !CCSettings::backgroundColorInst
eadOfCheckerboard(); | |
233 } | |
234 | |
235 IntRect CCLayerImpl::layerRectToContentRect(const WebKit::WebRect& layerRect) | |
236 { | |
237 float widthScale = static_cast<float>(contentBounds().width()) / bounds().wi
dth(); | |
238 float heightScale = static_cast<float>(contentBounds().height()) / bounds().
height(); | |
239 FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.h
eight); | |
240 contentRect.scale(widthScale, heightScale); | |
241 return enclosingIntRect(contentRect); | |
242 } | |
243 | |
244 std::string CCLayerImpl::indentString(int indent) | |
245 { | |
246 std::string str; | |
247 for (int i = 0; i != indent; ++i) | |
248 str.append(" "); | |
249 return str; | |
250 } | |
251 | |
252 void CCLayerImpl::dumpLayerProperties(std::string* str, int indent) const | |
253 { | |
254 std::string indentStr = indentString(indent); | |
255 str->append(indentStr); | |
256 base::StringAppendF(str, "layer ID: %d\n", m_layerId); | |
257 | |
258 str->append(indentStr); | |
259 base::StringAppendF(str, "bounds: %d, %d\n", bounds().width(), bounds().heig
ht()); | |
260 | |
261 if (m_renderTarget) { | |
262 str->append(indentStr); | |
263 base::StringAppendF(str, "renderTarget: %d\n", m_renderTarget->m_layerId
); | |
264 } | |
265 | |
266 str->append(indentStr); | |
267 base::StringAppendF(str, "drawTransform: %f, %f, %f, %f // %f, %f, %f, %f
// %f, %f, %f, %f // %f, %f, %f, %f\n", | |
268 m_drawTransform.m11(), m_drawTransform.m12(), m_drawTransform.m13(), m_d
rawTransform.m14(), | |
269 m_drawTransform.m21(), m_drawTransform.m22(), m_drawTransform.m23(), m_d
rawTransform.m24(), | |
270 m_drawTransform.m31(), m_drawTransform.m32(), m_drawTransform.m33(), m_d
rawTransform.m34(), | |
271 m_drawTransform.m41(), m_drawTransform.m42(), m_drawTransform.m43(), m_d
rawTransform.m44()); | |
272 | |
273 str->append(indentStr); | |
274 base::StringAppendF(str, "drawsContent: %s\n", m_drawsContent ? "yes" : "no"
); | |
275 } | |
276 | |
277 void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerIm
pl*>::iterator end, CCLayerSorter* layerSorter) | |
278 { | |
279 TRACE_EVENT0("cc", "CCLayerImpl::sortLayers"); | |
280 layerSorter->sort(first, end); | |
281 } | |
282 | |
283 std::string CCLayerImpl::layerTreeAsText() const | |
284 { | |
285 std::string str; | |
286 dumpLayer(&str, 0); | |
287 return str; | |
288 } | |
289 | |
290 void CCLayerImpl::dumpLayer(std::string* str, int indent) const | |
291 { | |
292 str->append(indentString(indent)); | |
293 base::StringAppendF(str, "%s(%s)\n", layerTypeAsString(), m_debugName.data()
); | |
294 dumpLayerProperties(str, indent+2); | |
295 if (m_replicaLayer) { | |
296 str->append(indentString(indent+2)); | |
297 str->append("Replica:\n"); | |
298 m_replicaLayer->dumpLayer(str, indent+3); | |
299 } | |
300 if (m_maskLayer) { | |
301 str->append(indentString(indent+2)); | |
302 str->append("Mask:\n"); | |
303 m_maskLayer->dumpLayer(str, indent+3); | |
304 } | |
305 for (size_t i = 0; i < m_children.size(); ++i) | |
306 m_children[i]->dumpLayer(str, indent+1); | |
307 } | |
308 | |
309 void CCLayerImpl::setStackingOrderChanged(bool stackingOrderChanged) | |
310 { | |
311 // We don't need to store this flag; we only need to track that the change o
ccurred. | |
312 if (stackingOrderChanged) | |
313 noteLayerPropertyChangedForSubtree(); | |
314 } | |
315 | |
316 bool CCLayerImpl::layerSurfacePropertyChanged() const | |
317 { | |
318 if (m_layerSurfacePropertyChanged) | |
319 return true; | |
320 | |
321 // If this layer's surface property hasn't changed, we want to see if | |
322 // some layer above us has changed this property. This is done for the | |
323 // case when such parent layer does not draw content, and therefore will | |
324 // not be traversed by the damage tracker. We need to make sure that | |
325 // property change on such layer will be caught by its descendants. | |
326 CCLayerImpl* current = this->m_parent; | |
327 while (current && !current->m_renderSurface) { | |
328 if (current->m_layerSurfacePropertyChanged) | |
329 return true; | |
330 current = current->m_parent; | |
331 } | |
332 | |
333 return false; | |
334 } | |
335 | |
336 void CCLayerImpl::noteLayerPropertyChangedForSubtree() | |
337 { | |
338 m_layerPropertyChanged = true; | |
339 noteLayerPropertyChangedForDescendants(); | |
340 } | |
341 | |
342 void CCLayerImpl::noteLayerPropertyChangedForDescendants() | |
343 { | |
344 for (size_t i = 0; i < m_children.size(); ++i) | |
345 m_children[i]->noteLayerPropertyChangedForSubtree(); | |
346 } | |
347 | |
348 const char* CCLayerImpl::layerTypeAsString() const | |
349 { | |
350 return "LayerChromium"; | |
351 } | |
352 | |
353 void CCLayerImpl::resetAllChangeTrackingForSubtree() | |
354 { | |
355 m_layerPropertyChanged = false; | |
356 m_layerSurfacePropertyChanged = false; | |
357 | |
358 m_updateRect = FloatRect(); | |
359 | |
360 if (m_renderSurface) | |
361 m_renderSurface->resetPropertyChangedFlag(); | |
362 | |
363 if (m_maskLayer) | |
364 m_maskLayer->resetAllChangeTrackingForSubtree(); | |
365 | |
366 if (m_replicaLayer) | |
367 m_replicaLayer->resetAllChangeTrackingForSubtree(); // also resets the r
eplica mask, if it exists. | |
368 | |
369 for (size_t i = 0; i < m_children.size(); ++i) | |
370 m_children[i]->resetAllChangeTrackingForSubtree(); | |
371 } | |
372 | |
373 bool CCLayerImpl::layerIsAlwaysDamaged() const | |
374 { | |
375 return false; | |
376 } | |
377 | |
378 int CCLayerImpl::id() const | |
379 { | |
380 return m_layerId; | |
381 } | |
382 | |
383 float CCLayerImpl::opacity() const | |
384 { | |
385 return m_opacity; | |
386 } | |
387 | |
388 void CCLayerImpl::setOpacityFromAnimation(float opacity) | |
389 { | |
390 setOpacity(opacity); | |
391 } | |
392 | |
393 const WebKit::WebTransformationMatrix& CCLayerImpl::transform() const | |
394 { | |
395 return m_transform; | |
396 } | |
397 | |
398 void CCLayerImpl::setTransformFromAnimation(const WebTransformationMatrix& trans
form) | |
399 { | |
400 setTransform(transform); | |
401 } | |
402 | |
403 void CCLayerImpl::setBounds(const IntSize& bounds) | |
404 { | |
405 if (m_bounds == bounds) | |
406 return; | |
407 | |
408 m_bounds = bounds; | |
409 | |
410 if (masksToBounds()) | |
411 noteLayerPropertyChangedForSubtree(); | |
412 else | |
413 m_layerPropertyChanged = true; | |
414 } | |
415 | |
416 void CCLayerImpl::setMaskLayer(scoped_ptr<CCLayerImpl> maskLayer) | |
417 { | |
418 m_maskLayer = maskLayer.Pass(); | |
419 | |
420 int newLayerId = m_maskLayer ? m_maskLayer->id() : -1; | |
421 if (newLayerId == m_maskLayerId) | |
422 return; | |
423 | |
424 m_maskLayerId = newLayerId; | |
425 noteLayerPropertyChangedForSubtree(); | |
426 } | |
427 | |
428 void CCLayerImpl::setReplicaLayer(scoped_ptr<CCLayerImpl> replicaLayer) | |
429 { | |
430 m_replicaLayer = replicaLayer.Pass(); | |
431 | |
432 int newLayerId = m_replicaLayer ? m_replicaLayer->id() : -1; | |
433 if (newLayerId == m_replicaLayerId) | |
434 return; | |
435 | |
436 m_replicaLayerId = newLayerId; | |
437 noteLayerPropertyChangedForSubtree(); | |
438 } | |
439 | |
440 void CCLayerImpl::setDrawsContent(bool drawsContent) | |
441 { | |
442 if (m_drawsContent == drawsContent) | |
443 return; | |
444 | |
445 m_drawsContent = drawsContent; | |
446 m_layerPropertyChanged = true; | |
447 } | |
448 | |
449 void CCLayerImpl::setAnchorPoint(const FloatPoint& anchorPoint) | |
450 { | |
451 if (m_anchorPoint == anchorPoint) | |
452 return; | |
453 | |
454 m_anchorPoint = anchorPoint; | |
455 noteLayerPropertyChangedForSubtree(); | |
456 } | |
457 | |
458 void CCLayerImpl::setAnchorPointZ(float anchorPointZ) | |
459 { | |
460 if (m_anchorPointZ == anchorPointZ) | |
461 return; | |
462 | |
463 m_anchorPointZ = anchorPointZ; | |
464 noteLayerPropertyChangedForSubtree(); | |
465 } | |
466 | |
467 void CCLayerImpl::setBackgroundColor(SkColor backgroundColor) | |
468 { | |
469 if (m_backgroundColor == backgroundColor) | |
470 return; | |
471 | |
472 m_backgroundColor = backgroundColor; | |
473 m_layerPropertyChanged = true; | |
474 } | |
475 | |
476 void CCLayerImpl::setFilters(const WebKit::WebFilterOperations& filters) | |
477 { | |
478 if (m_filters == filters) | |
479 return; | |
480 | |
481 m_filters = filters; | |
482 noteLayerPropertyChangedForSubtree(); | |
483 } | |
484 | |
485 void CCLayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgr
oundFilters) | |
486 { | |
487 if (m_backgroundFilters == backgroundFilters) | |
488 return; | |
489 | |
490 m_backgroundFilters = backgroundFilters; | |
491 m_layerPropertyChanged = true; | |
492 } | |
493 | |
494 void CCLayerImpl::setMasksToBounds(bool masksToBounds) | |
495 { | |
496 if (m_masksToBounds == masksToBounds) | |
497 return; | |
498 | |
499 m_masksToBounds = masksToBounds; | |
500 noteLayerPropertyChangedForSubtree(); | |
501 } | |
502 | |
503 void CCLayerImpl::setContentsOpaque(bool opaque) | |
504 { | |
505 if (m_contentsOpaque == opaque) | |
506 return; | |
507 | |
508 m_contentsOpaque = opaque; | |
509 noteLayerPropertyChangedForSubtree(); | |
510 } | |
511 | |
512 void CCLayerImpl::setOpacity(float opacity) | |
513 { | |
514 if (m_opacity == opacity) | |
515 return; | |
516 | |
517 m_opacity = opacity; | |
518 m_layerSurfacePropertyChanged = true; | |
519 } | |
520 | |
521 bool CCLayerImpl::opacityIsAnimating() const | |
522 { | |
523 return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Op
acity); | |
524 } | |
525 | |
526 void CCLayerImpl::setPosition(const FloatPoint& position) | |
527 { | |
528 if (m_position == position) | |
529 return; | |
530 | |
531 m_position = position; | |
532 noteLayerPropertyChangedForSubtree(); | |
533 } | |
534 | |
535 void CCLayerImpl::setPreserves3D(bool preserves3D) | |
536 { | |
537 if (m_preserves3D == preserves3D) | |
538 return; | |
539 | |
540 m_preserves3D = preserves3D; | |
541 noteLayerPropertyChangedForSubtree(); | |
542 } | |
543 | |
544 void CCLayerImpl::setSublayerTransform(const WebTransformationMatrix& sublayerTr
ansform) | |
545 { | |
546 if (m_sublayerTransform == sublayerTransform) | |
547 return; | |
548 | |
549 m_sublayerTransform = sublayerTransform; | |
550 // sublayer transform does not affect the current layer; it affects only its
children. | |
551 noteLayerPropertyChangedForDescendants(); | |
552 } | |
553 | |
554 void CCLayerImpl::setTransform(const WebTransformationMatrix& transform) | |
555 { | |
556 if (m_transform == transform) | |
557 return; | |
558 | |
559 m_transform = transform; | |
560 m_layerSurfacePropertyChanged = true; | |
561 } | |
562 | |
563 bool CCLayerImpl::transformIsAnimating() const | |
564 { | |
565 return m_layerAnimationController->isAnimatingProperty(CCActiveAnimation::Tr
ansform); | |
566 } | |
567 | |
568 void CCLayerImpl::setDebugBorderColor(SkColor debugBorderColor) | |
569 { | |
570 if (m_debugBorderColor == debugBorderColor) | |
571 return; | |
572 | |
573 m_debugBorderColor = debugBorderColor; | |
574 m_layerPropertyChanged = true; | |
575 } | |
576 | |
577 void CCLayerImpl::setDebugBorderWidth(float debugBorderWidth) | |
578 { | |
579 if (m_debugBorderWidth == debugBorderWidth) | |
580 return; | |
581 | |
582 m_debugBorderWidth = debugBorderWidth; | |
583 m_layerPropertyChanged = true; | |
584 } | |
585 | |
586 bool CCLayerImpl::hasDebugBorders() const | |
587 { | |
588 return SkColorGetA(m_debugBorderColor) && debugBorderWidth() > 0; | |
589 } | |
590 | |
591 void CCLayerImpl::setContentBounds(const IntSize& contentBounds) | |
592 { | |
593 if (m_contentBounds == contentBounds) | |
594 return; | |
595 | |
596 m_contentBounds = contentBounds; | |
597 m_layerPropertyChanged = true; | |
598 } | |
599 | |
600 void CCLayerImpl::setScrollPosition(const IntPoint& scrollPosition) | |
601 { | |
602 if (m_scrollPosition == scrollPosition) | |
603 return; | |
604 | |
605 m_scrollPosition = scrollPosition; | |
606 noteLayerPropertyChangedForSubtree(); | |
607 } | |
608 | |
609 void CCLayerImpl::setScrollDelta(const FloatSize& scrollDelta) | |
610 { | |
611 if (m_scrollDelta == scrollDelta) | |
612 return; | |
613 | |
614 m_scrollDelta = scrollDelta; | |
615 noteLayerPropertyChangedForSubtree(); | |
616 } | |
617 | |
618 void CCLayerImpl::setImplTransform(const WebKit::WebTransformationMatrix& transf
orm) | |
619 { | |
620 if (m_implTransform == transform) | |
621 return; | |
622 | |
623 m_implTransform = transform; | |
624 noteLayerPropertyChangedForSubtree(); | |
625 } | |
626 | |
627 void CCLayerImpl::setDoubleSided(bool doubleSided) | |
628 { | |
629 if (m_doubleSided == doubleSided) | |
630 return; | |
631 | |
632 m_doubleSided = doubleSided; | |
633 noteLayerPropertyChangedForSubtree(); | |
634 } | |
635 | |
636 Region CCLayerImpl::visibleContentOpaqueRegion() const | |
637 { | |
638 if (contentsOpaque()) | |
639 return visibleContentRect(); | |
640 return Region(); | |
641 } | |
642 | |
643 void CCLayerImpl::didLoseContext() | |
644 { | |
645 } | |
646 | |
647 void CCLayerImpl::setMaxScrollPosition(const IntSize& maxScrollPosition) | |
648 { | |
649 m_maxScrollPosition = maxScrollPosition; | |
650 | |
651 if (!m_scrollbarAnimationController) | |
652 return; | |
653 m_scrollbarAnimationController->updateScrollOffset(this); | |
654 } | |
655 | |
656 CCScrollbarLayerImpl* CCLayerImpl::horizontalScrollbarLayer() const | |
657 { | |
658 return m_scrollbarAnimationController ? m_scrollbarAnimationController->hori
zontalScrollbarLayer() : 0; | |
659 } | |
660 | |
661 void CCLayerImpl::setHorizontalScrollbarLayer(CCScrollbarLayerImpl* scrollbarLay
er) | |
662 { | |
663 if (!m_scrollbarAnimationController) | |
664 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); | |
665 m_scrollbarAnimationController->setHorizontalScrollbarLayer(scrollbarLayer); | |
666 m_scrollbarAnimationController->updateScrollOffset(this); | |
667 } | |
668 | |
669 CCScrollbarLayerImpl* CCLayerImpl::verticalScrollbarLayer() const | |
670 { | |
671 return m_scrollbarAnimationController ? m_scrollbarAnimationController->vert
icalScrollbarLayer() : 0; | |
672 } | |
673 | |
674 void CCLayerImpl::setVerticalScrollbarLayer(CCScrollbarLayerImpl* scrollbarLayer
) | |
675 { | |
676 if (!m_scrollbarAnimationController) | |
677 m_scrollbarAnimationController = CCScrollbarAnimationController::create(
this); | |
678 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | |
679 m_scrollbarAnimationController->updateScrollOffset(this); | |
680 } | |
681 | |
682 } | |
683 | |
684 | |
685 #endif // USE(ACCELERATED_COMPOSITING) | |
OLD | NEW |