OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (!renderer->slowFirstChild() && renderer->style()) { | 146 if (!renderer->slowFirstChild() && renderer->style()) { |
147 m_visibleContentStatusDirty = false; | 147 m_visibleContentStatusDirty = false; |
148 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; | 148 m_hasVisibleContent = renderer->style()->visibility() == VISIBLE; |
149 } | 149 } |
150 | 150 |
151 updateScrollableArea(); | 151 updateScrollableArea(); |
152 } | 152 } |
153 | 153 |
154 Layer::~Layer() | 154 Layer::~Layer() |
155 { | 155 { |
156 if (renderer()->frame() && renderer()->frame()->page()) { | 156 if (layoutObject()->frame() && layoutObject()->frame()->page()) { |
157 if (ScrollingCoordinator* scrollingCoordinator = renderer()->frame()->pa
ge()->scrollingCoordinator()) | 157 if (ScrollingCoordinator* scrollingCoordinator = layoutObject()->frame()
->page()->scrollingCoordinator()) |
158 scrollingCoordinator->willDestroyLayer(this); | 158 scrollingCoordinator->willDestroyLayer(this); |
159 } | 159 } |
160 | 160 |
161 removeFilterInfoIfNeeded(); | 161 removeFilterInfoIfNeeded(); |
162 | 162 |
163 if (groupedMapping()) { | 163 if (groupedMapping()) { |
164 DisableCompositingQueryAsserts disabler; | 164 DisableCompositingQueryAsserts disabler; |
165 groupedMapping()->removeLayerFromSquashingGraphicsLayer(this); | 165 groupedMapping()->removeLayerFromSquashingGraphicsLayer(this); |
166 setGroupedMapping(0); | 166 setGroupedMapping(0); |
167 } | 167 } |
168 | 168 |
169 // Child layers will be deleted by their corresponding render objects, so | 169 // Child layers will be deleted by their corresponding render objects, so |
170 // we don't need to delete them ourselves. | 170 // we don't need to delete them ourselves. |
171 | 171 |
172 clearCompositedLayerMapping(true); | 172 clearCompositedLayerMapping(true); |
173 | 173 |
174 if (m_reflectionInfo) | 174 if (m_reflectionInfo) |
175 m_reflectionInfo->destroy(); | 175 m_reflectionInfo->destroy(); |
176 } | 176 } |
177 | 177 |
178 String Layer::debugName() const | 178 String Layer::debugName() const |
179 { | 179 { |
180 if (isReflection()) { | 180 if (isReflection()) { |
181 return renderer()->parent()->debugName() + " (reflection)"; | 181 return layoutObject()->parent()->debugName() + " (reflection)"; |
182 } | 182 } |
183 return renderer()->debugName(); | 183 return layoutObject()->debugName(); |
184 } | 184 } |
185 | 185 |
186 LayerCompositor* Layer::compositor() const | 186 LayerCompositor* Layer::compositor() const |
187 { | 187 { |
188 if (!renderer()->view()) | 188 if (!layoutObject()->view()) |
189 return 0; | 189 return 0; |
190 return renderer()->view()->compositor(); | 190 return layoutObject()->view()->compositor(); |
191 } | 191 } |
192 | 192 |
193 void Layer::contentChanged(ContentChangeType changeType) | 193 void Layer::contentChanged(ContentChangeType changeType) |
194 { | 194 { |
195 // updateLayerCompositingState will query compositingReasons for accelerated
overflow scrolling. | 195 // updateLayerCompositingState will query compositingReasons for accelerated
overflow scrolling. |
196 // This is tripped by LayoutTests/compositing/content-changed-chicken-egg.ht
ml | 196 // This is tripped by LayoutTests/compositing/content-changed-chicken-egg.ht
ml |
197 DisableCompositingQueryAsserts disabler; | 197 DisableCompositingQueryAsserts disabler; |
198 | 198 |
199 if (changeType == CanvasChanged) | 199 if (changeType == CanvasChanged) |
200 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); | 200 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); |
201 | 201 |
202 if (changeType == CanvasContextChanged) { | 202 if (changeType == CanvasContextChanged) { |
203 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); | 203 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositin
gInputChange); |
204 | 204 |
205 // Although we're missing test coverage, we need to call | 205 // Although we're missing test coverage, we need to call |
206 // GraphicsLayer::setContentsToPlatformLayer with the new platform | 206 // GraphicsLayer::setContentsToPlatformLayer with the new platform |
207 // layer for this canvas. | 207 // layer for this canvas. |
208 // See http://crbug.com/349195 | 208 // See http://crbug.com/349195 |
209 if (hasCompositedLayerMapping()) | 209 if (hasCompositedLayerMapping()) |
210 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); | 210 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerU
pdateSubtree); |
211 } | 211 } |
212 | 212 |
213 if (m_compositedLayerMapping) | 213 if (m_compositedLayerMapping) |
214 m_compositedLayerMapping->contentChanged(changeType); | 214 m_compositedLayerMapping->contentChanged(changeType); |
215 } | 215 } |
216 | 216 |
217 bool Layer::paintsWithFilters() const | 217 bool Layer::paintsWithFilters() const |
218 { | 218 { |
219 if (!renderer()->hasFilter()) | 219 if (!layoutObject()->hasFilter()) |
220 return false; | 220 return false; |
221 | 221 |
222 // https://code.google.com/p/chromium/issues/detail?id=343759 | 222 // https://code.google.com/p/chromium/issues/detail?id=343759 |
223 DisableCompositingQueryAsserts disabler; | 223 DisableCompositingQueryAsserts disabler; |
224 return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacki
ng; | 224 return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacki
ng; |
225 } | 225 } |
226 | 226 |
227 LayoutSize Layer::subpixelAccumulation() const | 227 LayoutSize Layer::subpixelAccumulation() const |
228 { | 228 { |
229 return m_subpixelAccumulation; | 229 return m_subpixelAccumulation; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // in this case, there is no need to dirty our ancestors further. | 297 // in this case, there is no need to dirty our ancestors further. |
298 if (layer->isSelfPaintingLayer()) { | 298 if (layer->isSelfPaintingLayer()) { |
299 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); | 299 ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty
|| parent()->m_hasSelfPaintingLayerDescendant); |
300 break; | 300 break; |
301 } | 301 } |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 bool Layer::scrollsWithViewport() const | 305 bool Layer::scrollsWithViewport() const |
306 { | 306 { |
307 return renderer()->style()->position() == FixedPosition && renderer()->conta
inerForFixedPosition() == renderer()->view(); | 307 return layoutObject()->style()->position() == FixedPosition && layoutObject(
)->containerForFixedPosition() == layoutObject()->view(); |
308 } | 308 } |
309 | 309 |
310 bool Layer::scrollsWithRespectTo(const Layer* other) const | 310 bool Layer::scrollsWithRespectTo(const Layer* other) const |
311 { | 311 { |
312 if (scrollsWithViewport() != other->scrollsWithViewport()) | 312 if (scrollsWithViewport() != other->scrollsWithViewport()) |
313 return true; | 313 return true; |
314 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); | 314 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); |
315 } | 315 } |
316 | 316 |
317 void Layer::updateLayerPositionsAfterOverflowScroll() | 317 void Layer::updateLayerPositionsAfterOverflowScroll() |
(...skipping 22 matching lines...) Expand all Loading... |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 void Layer::updateTransform(const LayoutStyle* oldStyle, const LayoutStyle& newS
tyle) | 343 void Layer::updateTransform(const LayoutStyle* oldStyle, const LayoutStyle& newS
tyle) |
344 { | 344 { |
345 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) | 345 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) |
346 return; | 346 return; |
347 | 347 |
348 // hasTransform() on the renderer is also true when there is transform-style
: preserve-3d or perspective set, | 348 // hasTransform() on the renderer is also true when there is transform-style
: preserve-3d or perspective set, |
349 // so check style too. | 349 // so check style too. |
350 bool hasTransform = renderer()->hasTransformRelatedProperty() && newStyle.ha
sTransform(); | 350 bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyl
e.hasTransform(); |
351 bool had3DTransform = has3DTransform(); | 351 bool had3DTransform = has3DTransform(); |
352 | 352 |
353 bool hadTransform = m_transform; | 353 bool hadTransform = m_transform; |
354 if (hasTransform != hadTransform) { | 354 if (hasTransform != hadTransform) { |
355 if (hasTransform) | 355 if (hasTransform) |
356 m_transform = adoptPtr(new TransformationMatrix); | 356 m_transform = adoptPtr(new TransformationMatrix); |
357 else | 357 else |
358 m_transform.clear(); | 358 m_transform.clear(); |
359 | 359 |
360 // Layers with transforms act as clip rects roots, so clear the cached c
lip rects here. | 360 // Layers with transforms act as clip rects roots, so clear the cached c
lip rects here. |
361 m_clipper.clearClipRectsIncludingDescendants(); | 361 m_clipper.clearClipRectsIncludingDescendants(); |
362 } else if (hasTransform) { | 362 } else if (hasTransform) { |
363 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects); | 363 m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects); |
364 } | 364 } |
365 | 365 |
366 updateTransformationMatrix(); | 366 updateTransformationMatrix(); |
367 | 367 |
368 if (had3DTransform != has3DTransform()) | 368 if (had3DTransform != has3DTransform()) |
369 dirty3DTransformedDescendantStatus(); | 369 dirty3DTransformedDescendantStatus(); |
370 } | 370 } |
371 | 371 |
372 static Layer* enclosingLayerForContainingBlock(Layer* layer) | 372 static Layer* enclosingLayerForContainingBlock(Layer* layer) |
373 { | 373 { |
374 if (LayoutObject* containingBlock = layer->renderer()->containingBlock()) | 374 if (LayoutObject* containingBlock = layer->layoutObject()->containingBlock()
) |
375 return containingBlock->enclosingLayer(); | 375 return containingBlock->enclosingLayer(); |
376 return 0; | 376 return 0; |
377 } | 377 } |
378 | 378 |
379 Layer* Layer::renderingContextRoot() | 379 Layer* Layer::renderingContextRoot() |
380 { | 380 { |
381 Layer* renderingContext = 0; | 381 Layer* renderingContext = 0; |
382 | 382 |
383 if (shouldPreserve3D()) | 383 if (shouldPreserve3D()) |
384 renderingContext = this; | 384 renderingContext = this; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Otherwise we are paginated by the columns block. | 441 // Otherwise we are paginated by the columns block. |
442 return true; | 442 return true; |
443 } | 443 } |
444 | 444 |
445 // Convert a bounding box from flow thread coordinates, relative to |layer|, to
visual coordinates, relative to |ancestorLayer|. | 445 // Convert a bounding box from flow thread coordinates, relative to |layer|, to
visual coordinates, relative to |ancestorLayer|. |
446 // See http://www.chromium.org/developers/design-documents/multi-column-layout f
or more info on these coordinate types. | 446 // See http://www.chromium.org/developers/design-documents/multi-column-layout f
or more info on these coordinate types. |
447 static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const Layer* laye
r, const Layer* ancestorLayer, LayoutRect& rect) | 447 static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const Layer* laye
r, const Layer* ancestorLayer, LayoutRect& rect) |
448 { | 448 { |
449 Layer* paginationLayer = layer->enclosingPaginationLayer(); | 449 Layer* paginationLayer = layer->enclosingPaginationLayer(); |
450 ASSERT(paginationLayer); | 450 ASSERT(paginationLayer); |
451 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->renderer(
)); | 451 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObj
ect()); |
452 | 452 |
453 // First make the flow thread rectangle relative to the flow thread, not to
|layer|. | 453 // First make the flow thread rectangle relative to the flow thread, not to
|layer|. |
454 LayoutPoint offsetWithinPaginationLayer; | 454 LayoutPoint offsetWithinPaginationLayer; |
455 layer->convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer); | 455 layer->convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer); |
456 rect.moveBy(offsetWithinPaginationLayer); | 456 rect.moveBy(offsetWithinPaginationLayer); |
457 | 457 |
458 // Then make the rectangle visual, relative to the fragmentation context. Sp
lit our box up into | 458 // Then make the rectangle visual, relative to the fragmentation context. Sp
lit our box up into |
459 // the actual fragment boxes that render in the columns/pages and unite thos
e together to get | 459 // the actual fragment boxes that render in the columns/pages and unite thos
e together to get |
460 // our true bounding box. | 460 // our true bounding box. |
461 rect = flowThread->fragmentsBoundingBox(rect); | 461 rect = flowThread->fragmentsBoundingBox(rect); |
462 | 462 |
463 // Finally, make the visual rectangle relative to |ancestorLayer|. | 463 // Finally, make the visual rectangle relative to |ancestorLayer|. |
464 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) { | 464 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) { |
465 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); | 465 rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); |
466 return; | 466 return; |
467 } | 467 } |
468 // The ancestor layer is inside the same pagination layer as |layer|, so we
need to subtract | 468 // The ancestor layer is inside the same pagination layer as |layer|, so we
need to subtract |
469 // the visual distance from the ancestor layer to the pagination layer. | 469 // the visual distance from the ancestor layer to the pagination layer. |
470 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); | 470 rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); |
471 } | 471 } |
472 | 472 |
473 bool Layer::useRegionBasedColumns() const | 473 bool Layer::useRegionBasedColumns() const |
474 { | 474 { |
475 return renderer()->document().regionBasedColumnsEnabled(); | 475 return layoutObject()->document().regionBasedColumnsEnabled(); |
476 } | 476 } |
477 | 477 |
478 void Layer::updatePaginationRecursive(bool needsPaginationUpdate) | 478 void Layer::updatePaginationRecursive(bool needsPaginationUpdate) |
479 { | 479 { |
480 m_isPaginated = false; | 480 m_isPaginated = false; |
481 m_enclosingPaginationLayer = 0; | 481 m_enclosingPaginationLayer = 0; |
482 | 482 |
483 if (useRegionBasedColumns() && renderer()->isLayoutFlowThread()) | 483 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) |
484 needsPaginationUpdate = true; | 484 needsPaginationUpdate = true; |
485 | 485 |
486 if (needsPaginationUpdate) | 486 if (needsPaginationUpdate) |
487 updatePagination(); | 487 updatePagination(); |
488 | 488 |
489 if (renderer()->hasColumns()) | 489 if (layoutObject()->hasColumns()) |
490 needsPaginationUpdate = true; | 490 needsPaginationUpdate = true; |
491 | 491 |
492 for (Layer* child = firstChild(); child; child = child->nextSibling()) | 492 for (Layer* child = firstChild(); child; child = child->nextSibling()) |
493 child->updatePaginationRecursive(needsPaginationUpdate); | 493 child->updatePaginationRecursive(needsPaginationUpdate); |
494 } | 494 } |
495 | 495 |
496 void Layer::updatePagination() | 496 void Layer::updatePagination() |
497 { | 497 { |
498 bool usesRegionBasedColumns = useRegionBasedColumns(); | 498 bool usesRegionBasedColumns = useRegionBasedColumns(); |
499 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par
ent()) | 499 if ((!usesRegionBasedColumns && compositingState() != NotComposited) || !par
ent()) |
500 return; // FIXME: For now the LayoutView can't be paginated. Eventually
printing will move to a model where it is though. | 500 return; // FIXME: For now the LayoutView can't be paginated. Eventually
printing will move to a model where it is though. |
501 | 501 |
502 // The main difference between the paginated booleans for the old column cod
e and the new column code | 502 // The main difference between the paginated booleans for the old column cod
e and the new column code |
503 // is that each paginated layer has to paint on its own with the new code. T
here is no | 503 // is that each paginated layer has to paint on its own with the new code. T
here is no |
504 // recurring into child layers. This means that the m_isPaginated bits for t
he new column code can't just be set on | 504 // recurring into child layers. This means that the m_isPaginated bits for t
he new column code can't just be set on |
505 // "roots" that get split and paint all their descendants. Instead each laye
r has to be checked individually and | 505 // "roots" that get split and paint all their descendants. Instead each laye
r has to be checked individually and |
506 // genuinely know if it is going to have to split itself up when painting on
ly its contents (and not any other descendant | 506 // genuinely know if it is going to have to split itself up when painting on
ly its contents (and not any other descendant |
507 // layers). We track an enclosingPaginationLayer instead of using a simple b
it, since we want to be able to get back | 507 // layers). We track an enclosingPaginationLayer instead of using a simple b
it, since we want to be able to get back |
508 // to that layer easily. | 508 // to that layer easily. |
509 if (usesRegionBasedColumns && renderer()->isLayoutFlowThread()) { | 509 if (usesRegionBasedColumns && layoutObject()->isLayoutFlowThread()) { |
510 m_enclosingPaginationLayer = this; | 510 m_enclosingPaginationLayer = this; |
511 return; | 511 return; |
512 } | 512 } |
513 | 513 |
514 if (m_stackingNode->isNormalFlowOnly()) { | 514 if (m_stackingNode->isNormalFlowOnly()) { |
515 if (usesRegionBasedColumns) { | 515 if (usesRegionBasedColumns) { |
516 // Content inside a transform is not considered to be paginated, sin
ce we simply | 516 // Content inside a transform is not considered to be paginated, sin
ce we simply |
517 // paint the transform multiple times in each column, so we don't ha
ve to use | 517 // paint the transform multiple times in each column, so we don't ha
ve to use |
518 // fragments for the transformed content. | 518 // fragments for the transformed content. |
519 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); | 519 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); |
520 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra
nsformRelatedProperty()) | 520 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra
nsformRelatedProperty()) |
521 m_enclosingPaginationLayer = 0; | 521 m_enclosingPaginationLayer = 0; |
522 } else { | 522 } else { |
523 m_isPaginated = parent()->renderer()->hasColumns(); | 523 m_isPaginated = parent()->layoutObject()->hasColumns(); |
524 } | 524 } |
525 return; | 525 return; |
526 } | 526 } |
527 | 527 |
528 // For the new columns code, we want to walk up our containing block chain l
ooking for an enclosing layer. Once | 528 // For the new columns code, we want to walk up our containing block chain l
ooking for an enclosing layer. Once |
529 // we find one, then we just check its pagination status. | 529 // we find one, then we just check its pagination status. |
530 if (usesRegionBasedColumns) { | 530 if (usesRegionBasedColumns) { |
531 LayoutView* view = renderer()->view(); | 531 LayoutView* view = layoutObject()->view(); |
532 LayoutBlock* containingBlock; | 532 LayoutBlock* containingBlock; |
533 for (containingBlock = renderer()->containingBlock(); | 533 for (containingBlock = layoutObject()->containingBlock(); |
534 containingBlock && containingBlock != view; | 534 containingBlock && containingBlock != view; |
535 containingBlock = containingBlock->containingBlock()) { | 535 containingBlock = containingBlock->containingBlock()) { |
536 if (containingBlock->hasLayer()) { | 536 if (containingBlock->hasLayer()) { |
537 // Content inside a transform is not considered to be paginated,
since we simply | 537 // Content inside a transform is not considered to be paginated,
since we simply |
538 // paint the transform multiple times in each column, so we don'
t have to use | 538 // paint the transform multiple times in each column, so we don'
t have to use |
539 // fragments for the transformed content. | 539 // fragments for the transformed content. |
540 m_enclosingPaginationLayer = containingBlock->layer()->enclosing
PaginationLayer(); | 540 m_enclosingPaginationLayer = containingBlock->layer()->enclosing
PaginationLayer(); |
541 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->ha
sTransformRelatedProperty()) | 541 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->ha
sTransformRelatedProperty()) |
542 m_enclosingPaginationLayer = 0; | 542 m_enclosingPaginationLayer = 0; |
543 return; | 543 return; |
544 } | 544 } |
545 } | 545 } |
546 return; | 546 return; |
547 } | 547 } |
548 | 548 |
549 // If we're not normal flow, then we need to look for a multi-column object
between us and our stacking container. | 549 // If we're not normal flow, then we need to look for a multi-column object
between us and our stacking container. |
550 LayerStackingNode* ancestorStackingContextNode = m_stackingNode->ancestorSta
ckingContextNode(); | 550 LayerStackingNode* ancestorStackingContextNode = m_stackingNode->ancestorSta
ckingContextNode(); |
551 for (Layer* curr = parent(); curr; curr = curr->parent()) { | 551 for (Layer* curr = parent(); curr; curr = curr->parent()) { |
552 if (curr->renderer()->hasColumns()) { | 552 if (curr->layoutObject()->hasColumns()) { |
553 m_isPaginated = checkContainingBlockChainForPagination(renderer(), c
urr->layoutBox()); | 553 m_isPaginated = checkContainingBlockChainForPagination(layoutObject(
), curr->layoutBox()); |
554 return; | 554 return; |
555 } | 555 } |
556 if (curr->stackingNode() == ancestorStackingContextNode) | 556 if (curr->stackingNode() == ancestorStackingContextNode) |
557 return; | 557 return; |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 void Layer::clearPaginationRecursive() | 561 void Layer::clearPaginationRecursive() |
562 { | 562 { |
563 m_enclosingPaginationLayer = 0; | 563 m_enclosingPaginationLayer = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
577 } | 577 } |
578 | 578 |
579 void Layer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintI
nvalidationContainer, FloatPoint& point) | 579 void Layer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintI
nvalidationContainer, FloatPoint& point) |
580 { | 580 { |
581 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); | 581 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); |
582 if (!paintInvalidationLayer->groupedMapping()) { | 582 if (!paintInvalidationLayer->groupedMapping()) { |
583 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs
etInCompositingLayer()); | 583 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs
etInCompositingLayer()); |
584 return; | 584 return; |
585 } | 585 } |
586 | 586 |
587 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->renderer(); | 587 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); |
588 if (!transformedAncestor) | 588 if (!transformedAncestor) |
589 return; | 589 return; |
590 | 590 |
591 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the | 591 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the |
592 // transformed ancestor. | 592 // transformed ancestor. |
593 point = paintInvalidationContainer->localToContainerPoint(point, transformed
Ancestor); | 593 point = paintInvalidationContainer->localToContainerPoint(point, transformed
Ancestor); |
594 | 594 |
595 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT
ransformedAncestor()); | 595 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT
ransformedAncestor()); |
596 } | 596 } |
597 | 597 |
598 void Layer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintIn
validationContainer, LayoutRect& rect) | 598 void Layer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintIn
validationContainer, LayoutRect& rect) |
599 { | 599 { |
600 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); | 600 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); |
601 if (!paintInvalidationLayer->groupedMapping()) { | 601 if (!paintInvalidationLayer->groupedMapping()) { |
602 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse
tInCompositingLayer()); | 602 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse
tInCompositingLayer()); |
603 return; | 603 return; |
604 } | 604 } |
605 | 605 |
606 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->renderer(); | 606 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); |
607 if (!transformedAncestor) | 607 if (!transformedAncestor) |
608 return; | 608 return; |
609 | 609 |
610 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the | 610 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the |
611 // transformed ancestor. | 611 // transformed ancestor. |
612 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect
(rect), transformedAncestor).boundingBox()); | 612 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect
(rect), transformedAncestor).boundingBox()); |
613 | 613 |
614 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); | 614 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); |
615 } | 615 } |
616 | 616 |
617 void Layer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject,
const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, const
PaintInvalidationState* paintInvalidationState) | 617 void Layer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject,
const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, const
PaintInvalidationState* paintInvalidationState) |
618 { | 618 { |
619 if (!paintInvalidationContainer->layer()->groupedMapping()) { | 619 if (!paintInvalidationContainer->layer()->groupedMapping()) { |
620 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContain
er, rect, paintInvalidationState); | 620 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContain
er, rect, paintInvalidationState); |
621 return; | 621 return; |
622 } | 622 } |
623 | 623 |
624 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) | 624 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) |
625 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is | 625 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is |
626 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. | 626 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. |
627 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. | 627 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. |
628 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer,
rect, paintInvalidationState); | 628 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer,
rect, paintInvalidationState); |
629 | 629 |
630 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); | 630 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); |
631 } | 631 } |
632 | 632 |
633 LayoutRect Layer::computePaintInvalidationRect(const LayoutObject* layoutObject,
const Layer* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) | 633 LayoutRect Layer::computePaintInvalidationRect(const LayoutObject* layoutObject,
const Layer* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) |
634 { | 634 { |
635 if (!paintInvalidationContainer->groupedMapping()) | 635 if (!paintInvalidationContainer->groupedMapping()) |
636 return layoutObject->computePaintInvalidationRect(paintInvalidationConta
iner->renderer(), paintInvalidationState); | 636 return layoutObject->computePaintInvalidationRect(paintInvalidationConta
iner->layoutObject(), paintInvalidationState); |
637 | 637 |
638 LayoutRect rect = layoutObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->renderer(), paintInvalidationState); | 638 LayoutRect rect = layoutObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->layoutObject(), paintInvalidationState); |
639 mapRectToPaintBackingCoordinates(paintInvalidationContainer->renderer(), rec
t); | 639 mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(),
rect); |
640 return rect; | 640 return rect; |
641 } | 641 } |
642 | 642 |
643 void Layer::dirtyVisibleContentStatus() | 643 void Layer::dirtyVisibleContentStatus() |
644 { | 644 { |
645 m_visibleContentStatusDirty = true; | 645 m_visibleContentStatusDirty = true; |
646 if (parent()) | 646 if (parent()) |
647 parent()->dirtyAncestorChainVisibleDescendantStatus(); | 647 parent()->dirtyAncestorChainVisibleDescendantStatus(); |
648 } | 648 } |
649 | 649 |
(...skipping 15 matching lines...) Expand all Loading... |
665 layer->m_visibleDescendantStatusDirty = true; | 665 layer->m_visibleDescendantStatusDirty = true; |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 // FIXME: this is quite brute-force. We could be more efficient if we were to | 669 // FIXME: this is quite brute-force. We could be more efficient if we were to |
670 // track state and update it as appropriate as changes are made in the Render tr
ee. | 670 // track state and update it as appropriate as changes are made in the Render tr
ee. |
671 void Layer::updateScrollingStateAfterCompositingChange() | 671 void Layer::updateScrollingStateAfterCompositingChange() |
672 { | 672 { |
673 TRACE_EVENT0("blink", "Layer::updateScrollingStateAfterCompositingChange"); | 673 TRACE_EVENT0("blink", "Layer::updateScrollingStateAfterCompositingChange"); |
674 m_hasVisibleNonLayerContent = false; | 674 m_hasVisibleNonLayerContent = false; |
675 for (LayoutObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { | 675 for (LayoutObject* r = layoutObject()->slowFirstChild(); r; r = r->nextSibli
ng()) { |
676 if (!r->hasLayer()) { | 676 if (!r->hasLayer()) { |
677 m_hasVisibleNonLayerContent = true; | 677 m_hasVisibleNonLayerContent = true; |
678 break; | 678 break; |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
682 m_hasNonCompositedChild = false; | 682 m_hasNonCompositedChild = false; |
683 for (Layer* child = firstChild(); child; child = child->nextSibling()) { | 683 for (Layer* child = firstChild(); child; child = child->nextSibling()) { |
684 if (child->compositingState() == NotComposited) { | 684 if (child->compositingState() == NotComposited) { |
685 m_hasNonCompositedChild = true; | 685 m_hasNonCompositedChild = true; |
(...skipping 30 matching lines...) Expand all Loading... |
716 m_hasVisibleDescendant = true; | 716 m_hasVisibleDescendant = true; |
717 break; | 717 break; |
718 } | 718 } |
719 } | 719 } |
720 | 720 |
721 m_visibleDescendantStatusDirty = false; | 721 m_visibleDescendantStatusDirty = false; |
722 } | 722 } |
723 | 723 |
724 if (m_visibleContentStatusDirty) { | 724 if (m_visibleContentStatusDirty) { |
725 bool previouslyHasVisibleContent = m_hasVisibleContent; | 725 bool previouslyHasVisibleContent = m_hasVisibleContent; |
726 if (renderer()->style()->visibility() == VISIBLE) { | 726 if (layoutObject()->style()->visibility() == VISIBLE) { |
727 m_hasVisibleContent = true; | 727 m_hasVisibleContent = true; |
728 } else { | 728 } else { |
729 // layer may be hidden but still have some visible content, check fo
r this | 729 // layer may be hidden but still have some visible content, check fo
r this |
730 m_hasVisibleContent = false; | 730 m_hasVisibleContent = false; |
731 LayoutObject* r = renderer()->slowFirstChild(); | 731 LayoutObject* r = layoutObject()->slowFirstChild(); |
732 while (r) { | 732 while (r) { |
733 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 733 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
734 m_hasVisibleContent = true; | 734 m_hasVisibleContent = true; |
735 break; | 735 break; |
736 } | 736 } |
737 LayoutObject* rendererFirstChild = r->slowFirstChild(); | 737 LayoutObject* rendererFirstChild = r->slowFirstChild(); |
738 if (rendererFirstChild && !r->hasLayer()) { | 738 if (rendererFirstChild && !r->hasLayer()) { |
739 r = rendererFirstChild; | 739 r = rendererFirstChild; |
740 } else if (r->nextSibling()) { | 740 } else if (r->nextSibling()) { |
741 r = r->nextSibling(); | 741 r = r->nextSibling(); |
742 } else { | 742 } else { |
743 do { | 743 do { |
744 r = r->parent(); | 744 r = r->parent(); |
745 if (r == renderer()) | 745 if (r == layoutObject()) |
746 r = 0; | 746 r = 0; |
747 } while (r && !r->nextSibling()); | 747 } while (r && !r->nextSibling()); |
748 if (r) | 748 if (r) |
749 r = r->nextSibling(); | 749 r = r->nextSibling(); |
750 } | 750 } |
751 } | 751 } |
752 } | 752 } |
753 m_visibleContentStatusDirty = false; | 753 m_visibleContentStatusDirty = false; |
754 | 754 |
755 if (hasVisibleContent() != previouslyHasVisibleContent) { | 755 if (hasVisibleContent() != previouslyHasVisibleContent) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 return has3DTransform() || m_has3DTransformedDescendant; | 802 return has3DTransform() || m_has3DTransformedDescendant; |
803 | 803 |
804 return has3DTransform(); | 804 return has3DTransform(); |
805 } | 805 } |
806 | 806 |
807 bool Layer::updateLayerPosition() | 807 bool Layer::updateLayerPosition() |
808 { | 808 { |
809 LayoutPoint localPoint; | 809 LayoutPoint localPoint; |
810 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. | 810 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y
for inlines, so we need to subtract it out when done. |
811 | 811 |
812 if (renderer()->isInline() && renderer()->isLayoutInline()) { | 812 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
813 LayoutInline* inlineFlow = toLayoutInline(renderer()); | 813 LayoutInline* inlineFlow = toLayoutInline(layoutObject()); |
814 IntRect lineBox = inlineFlow->linesBoundingBox(); | 814 IntRect lineBox = inlineFlow->linesBoundingBox(); |
815 m_size = lineBox.size(); | 815 m_size = lineBox.size(); |
816 inlineBoundingBoxOffset = lineBox.location(); | 816 inlineBoundingBoxOffset = lineBox.location(); |
817 localPoint.moveBy(inlineBoundingBoxOffset); | 817 localPoint.moveBy(inlineBoundingBoxOffset); |
818 } else if (LayoutBox* box = layoutBox()) { | 818 } else if (LayoutBox* box = layoutBox()) { |
819 m_size = pixelSnappedIntSize(box->size(), box->location()); | 819 m_size = pixelSnappedIntSize(box->size(), box->location()); |
820 localPoint.moveBy(box->topLeftLocation()); | 820 localPoint.moveBy(box->topLeftLocation()); |
821 } | 821 } |
822 | 822 |
823 if (!renderer()->isOutOfFlowPositioned() && !renderer()->isColumnSpanAll() &
& renderer()->parent()) { | 823 if (!layoutObject()->isOutOfFlowPositioned() && !layoutObject()->isColumnSpa
nAll() && layoutObject()->parent()) { |
824 // We must adjust our position by walking up the render tree looking for
the | 824 // We must adjust our position by walking up the render tree looking for
the |
825 // nearest enclosing object with a layer. | 825 // nearest enclosing object with a layer. |
826 LayoutObject* curr = renderer()->parent(); | 826 LayoutObject* curr = layoutObject()->parent(); |
827 while (curr && !curr->hasLayer()) { | 827 while (curr && !curr->hasLayer()) { |
828 if (curr->isBox() && !curr->isTableRow()) { | 828 if (curr->isBox() && !curr->isTableRow()) { |
829 // Rows and cells share the same coordinate space (that of the s
ection). | 829 // Rows and cells share the same coordinate space (that of the s
ection). |
830 // Omit them when computing our xpos/ypos. | 830 // Omit them when computing our xpos/ypos. |
831 localPoint.moveBy(toLayoutBox(curr)->topLeftLocation()); | 831 localPoint.moveBy(toLayoutBox(curr)->topLeftLocation()); |
832 } | 832 } |
833 curr = curr->parent(); | 833 curr = curr->parent(); |
834 } | 834 } |
835 if (curr->isBox() && curr->isTableRow()) { | 835 if (curr->isBox() && curr->isTableRow()) { |
836 // Put ourselves into the row coordinate space. | 836 // Put ourselves into the row coordinate space. |
837 localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation()); | 837 localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation()); |
838 } | 838 } |
839 } | 839 } |
840 | 840 |
841 // Subtract our parent's scroll offset. | 841 // Subtract our parent's scroll offset. |
842 if (renderer()->isOutOfFlowPositioned() && enclosingPositionedAncestor()) { | 842 if (layoutObject()->isOutOfFlowPositioned() && enclosingPositionedAncestor()
) { |
843 Layer* positionedParent = enclosingPositionedAncestor(); | 843 Layer* positionedParent = enclosingPositionedAncestor(); |
844 | 844 |
845 // For positioned layers, we subtract out the enclosing positioned layer
's scroll offset. | 845 // For positioned layers, we subtract out the enclosing positioned layer
's scroll offset. |
846 if (positionedParent->renderer()->hasOverflowClip()) { | 846 if (positionedParent->layoutObject()->hasOverflowClip()) { |
847 IntSize offset = positionedParent->layoutBox()->scrolledContentOffse
t(); | 847 IntSize offset = positionedParent->layoutBox()->scrolledContentOffse
t(); |
848 localPoint -= offset; | 848 localPoint -= offset; |
849 } | 849 } |
850 | 850 |
851 if (positionedParent->renderer()->isRelPositioned() && positionedParent-
>renderer()->isLayoutInline()) { | 851 if (positionedParent->layoutObject()->isRelPositioned() && positionedPar
ent->layoutObject()->isLayoutInline()) { |
852 LayoutSize offset = toLayoutInline(positionedParent->renderer())->of
fsetForInFlowPositionedInline(*toLayoutBox(renderer())); | 852 LayoutSize offset = toLayoutInline(positionedParent->layoutObject())
->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject())); |
853 localPoint += offset; | 853 localPoint += offset; |
854 } | 854 } |
855 } else if (parent()) { | 855 } else if (parent()) { |
856 // FIXME: This code is very wrong, but luckily only needed in the old/cu
rrent multicol | 856 // FIXME: This code is very wrong, but luckily only needed in the old/cu
rrent multicol |
857 // implementation. The compositing system doesn't understand columns and
we're hacking | 857 // implementation. The compositing system doesn't understand columns and
we're hacking |
858 // around that fact by faking the position of the Layers when we think w
e'll end up | 858 // around that fact by faking the position of the Layers when we think w
e'll end up |
859 // being composited. | 859 // being composited. |
860 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum
ns()) { | 860 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum
ns()) { |
861 // FIXME: Composited layers ignore pagination, so about the best we
can do is make sure they're offset into the appropriate column. | 861 // FIXME: Composited layers ignore pagination, so about the best we
can do is make sure they're offset into the appropriate column. |
862 // They won't split across columns properly. | 862 // They won't split across columns properly. |
863 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isD
ocumentElement() && renderer()->view()->hasColumns()) | 863 if (!parent()->layoutObject()->hasColumns() && parent()->layoutObjec
t()->isDocumentElement() && layoutObject()->view()->hasColumns()) |
864 localPoint += renderer()->view()->columnOffset(localPoint); | 864 localPoint += layoutObject()->view()->columnOffset(localPoint); |
865 else | 865 else |
866 localPoint += parent()->renderer()->columnOffset(localPoint); | 866 localPoint += parent()->layoutObject()->columnOffset(localPoint)
; |
867 } | 867 } |
868 | 868 |
869 if (parent()->renderer()->hasOverflowClip()) { | 869 if (parent()->layoutObject()->hasOverflowClip()) { |
870 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(
); | 870 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset(
); |
871 localPoint -= scrollOffset; | 871 localPoint -= scrollOffset; |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
875 bool positionOrOffsetChanged = false; | 875 bool positionOrOffsetChanged = false; |
876 if (renderer()->isRelPositioned()) { | 876 if (layoutObject()->isRelPositioned()) { |
877 LayoutSize newOffset = renderer()->offsetForInFlowPosition(); | 877 LayoutSize newOffset = layoutObject()->offsetForInFlowPosition(); |
878 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; | 878 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; |
879 m_offsetForInFlowPosition = newOffset; | 879 m_offsetForInFlowPosition = newOffset; |
880 localPoint.move(m_offsetForInFlowPosition); | 880 localPoint.move(m_offsetForInFlowPosition); |
881 } else { | 881 } else { |
882 m_offsetForInFlowPosition = LayoutSize(); | 882 m_offsetForInFlowPosition = LayoutSize(); |
883 } | 883 } |
884 | 884 |
885 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the renderers. | 885 // FIXME: We'd really like to just get rid of the concept of a layer rectang
le and rely on the renderers. |
886 localPoint.moveBy(-inlineBoundingBoxOffset); | 886 localPoint.moveBy(-inlineBoundingBoxOffset); |
887 | 887 |
888 if (m_location != localPoint) | 888 if (m_location != localPoint) |
889 positionOrOffsetChanged = true; | 889 positionOrOffsetChanged = true; |
890 m_location = localPoint; | 890 m_location = localPoint; |
891 | 891 |
892 #if ENABLE(ASSERT) | 892 #if ENABLE(ASSERT) |
893 m_needsPositionUpdate = false; | 893 m_needsPositionUpdate = false; |
894 #endif | 894 #endif |
895 return positionOrOffsetChanged; | 895 return positionOrOffsetChanged; |
896 } | 896 } |
897 | 897 |
898 TransformationMatrix Layer::perspectiveTransform() const | 898 TransformationMatrix Layer::perspectiveTransform() const |
899 { | 899 { |
900 if (!renderer()->hasTransformRelatedProperty()) | 900 if (!layoutObject()->hasTransformRelatedProperty()) |
901 return TransformationMatrix(); | 901 return TransformationMatrix(); |
902 | 902 |
903 const LayoutStyle& style = renderer()->styleRef(); | 903 const LayoutStyle& style = layoutObject()->styleRef(); |
904 if (!style.hasPerspective()) | 904 if (!style.hasPerspective()) |
905 return TransformationMatrix(); | 905 return TransformationMatrix(); |
906 | 906 |
907 // Maybe fetch the perspective from the backing? | 907 // Maybe fetch the perspective from the backing? |
908 const IntRect borderBox = toLayoutBox(renderer())->pixelSnappedBorderBoxRect
(); | 908 const IntRect borderBox = toLayoutBox(layoutObject())->pixelSnappedBorderBox
Rect(); |
909 const float boxWidth = borderBox.width(); | 909 const float boxWidth = borderBox.width(); |
910 const float boxHeight = borderBox.height(); | 910 const float boxHeight = borderBox.height(); |
911 | 911 |
912 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b
oxWidth); | 912 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b
oxWidth); |
913 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b
oxHeight); | 913 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b
oxHeight); |
914 | 914 |
915 // A perspective origin of 0,0 makes the vanishing point in the center of th
e element. | 915 // A perspective origin of 0,0 makes the vanishing point in the center of th
e element. |
916 // We want it to be in the top-left, so subtract half the height and width. | 916 // We want it to be in the top-left, so subtract half the height and width. |
917 perspectiveOriginX -= boxWidth / 2.0f; | 917 perspectiveOriginX -= boxWidth / 2.0f; |
918 perspectiveOriginY -= boxHeight / 2.0f; | 918 perspectiveOriginY -= boxHeight / 2.0f; |
919 | 919 |
920 TransformationMatrix t; | 920 TransformationMatrix t; |
921 t.translate(perspectiveOriginX, perspectiveOriginY); | 921 t.translate(perspectiveOriginX, perspectiveOriginY); |
922 t.applyPerspective(style.perspective()); | 922 t.applyPerspective(style.perspective()); |
923 t.translate(-perspectiveOriginX, -perspectiveOriginY); | 923 t.translate(-perspectiveOriginX, -perspectiveOriginY); |
924 | 924 |
925 return t; | 925 return t; |
926 } | 926 } |
927 | 927 |
928 FloatPoint Layer::perspectiveOrigin() const | 928 FloatPoint Layer::perspectiveOrigin() const |
929 { | 929 { |
930 if (!renderer()->hasTransformRelatedProperty()) | 930 if (!layoutObject()->hasTransformRelatedProperty()) |
931 return FloatPoint(); | 931 return FloatPoint(); |
932 | 932 |
933 const LayoutRect borderBox = toLayoutBox(renderer())->borderBoxRect(); | 933 const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect(); |
934 const LayoutStyle& style = renderer()->styleRef(); | 934 const LayoutStyle& style = layoutObject()->styleRef(); |
935 | 935 |
936 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.
width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he
ight().toFloat())); | 936 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.
width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he
ight().toFloat())); |
937 } | 937 } |
938 | 938 |
939 static inline bool isFixedPositionedContainer(Layer* layer) | 939 static inline bool isFixedPositionedContainer(Layer* layer) |
940 { | 940 { |
941 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); | 941 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); |
942 } | 942 } |
943 | 943 |
944 Layer* Layer::enclosingPositionedAncestor() const | 944 Layer* Layer::enclosingPositionedAncestor() const |
945 { | 945 { |
946 Layer* curr = parent(); | 946 Layer* curr = parent(); |
947 while (curr && !curr->isPositionedContainer()) | 947 while (curr && !curr->isPositionedContainer()) |
948 curr = curr->parent(); | 948 curr = curr->parent(); |
949 | 949 |
950 return curr; | 950 return curr; |
951 } | 951 } |
952 | 952 |
953 Layer* Layer::enclosingTransformedAncestor() const | 953 Layer* Layer::enclosingTransformedAncestor() const |
954 { | 954 { |
955 Layer* curr = parent(); | 955 Layer* curr = parent(); |
956 while (curr && !curr->isRootLayer() && !curr->renderer()->hasTransformRelate
dProperty()) | 956 while (curr && !curr->isRootLayer() && !curr->layoutObject()->hasTransformRe
latedProperty()) |
957 curr = curr->parent(); | 957 curr = curr->parent(); |
958 | 958 |
959 return curr; | 959 return curr; |
960 } | 960 } |
961 | 961 |
962 LayoutPoint Layer::computeOffsetFromTransformedAncestor() const | 962 LayoutPoint Layer::computeOffsetFromTransformedAncestor() const |
963 { | 963 { |
964 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); | 964 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); |
965 | 965 |
966 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 966 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
967 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. | 967 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. |
968 renderer()->mapLocalToContainer(properties.transformAncestor ? properties.tr
ansformAncestor->renderer() : 0, transformState, ApplyContainerFlip); | 968 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie
s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); |
969 transformState.flatten(); | 969 transformState.flatten(); |
970 return LayoutPoint(transformState.lastPlanarPoint()); | 970 return LayoutPoint(transformState.lastPlanarPoint()); |
971 } | 971 } |
972 | 972 |
973 const Layer* Layer::compositingContainer() const | 973 const Layer* Layer::compositingContainer() const |
974 { | 974 { |
975 if (stackingNode()->isNormalFlowOnly()) | 975 if (stackingNode()->isNormalFlowOnly()) |
976 return parent(); | 976 return parent(); |
977 if (LayerStackingNode* ancestorStackingNode = stackingNode()->ancestorStacki
ngContextNode()) | 977 if (LayerStackingNode* ancestorStackingNode = stackingNode()->ancestorStacki
ngContextNode()) |
978 return ancestorStackingNode->layer(); | 978 return ancestorStackingNode->layer(); |
(...skipping 24 matching lines...) Expand all Loading... |
1003 | 1003 |
1004 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer | 1004 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer |
1005 // including crossing frame boundaries. | 1005 // including crossing frame boundaries. |
1006 Layer* Layer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const | 1006 Layer* Layer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const |
1007 { | 1007 { |
1008 const Layer* layer = this; | 1008 const Layer* layer = this; |
1009 Layer* compositedLayer = 0; | 1009 Layer* compositedLayer = 0; |
1010 while (!compositedLayer) { | 1010 while (!compositedLayer) { |
1011 compositedLayer = layer->enclosingLayerForPaintInvalidation(); | 1011 compositedLayer = layer->enclosingLayerForPaintInvalidation(); |
1012 if (!compositedLayer) { | 1012 if (!compositedLayer) { |
1013 LayoutObject* owner = layer->renderer()->frame()->ownerLayoutObject(
); | 1013 LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObj
ect(); |
1014 if (!owner) | 1014 if (!owner) |
1015 break; | 1015 break; |
1016 layer = owner->enclosingLayer(); | 1016 layer = owner->enclosingLayer(); |
1017 } | 1017 } |
1018 } | 1018 } |
1019 return compositedLayer; | 1019 return compositedLayer; |
1020 } | 1020 } |
1021 | 1021 |
1022 Layer* Layer::enclosingLayerForPaintInvalidation() const | 1022 Layer* Layer::enclosingLayerForPaintInvalidation() const |
1023 { | 1023 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 ASSERT(!needsCompositingInputsUpdate()); | 1062 ASSERT(!needsCompositingInputsUpdate()); |
1063 m_childNeedsCompositingInputsUpdate = false; | 1063 m_childNeedsCompositingInputsUpdate = false; |
1064 if (m_scrollableArea) | 1064 if (m_scrollableArea) |
1065 m_scrollableArea->updateNeedsCompositedScrolling(); | 1065 m_scrollableArea->updateNeedsCompositedScrolling(); |
1066 } | 1066 } |
1067 | 1067 |
1068 bool Layer::hasNonIsolatedDescendantWithBlendMode() const | 1068 bool Layer::hasNonIsolatedDescendantWithBlendMode() const |
1069 { | 1069 { |
1070 if (descendantDependentCompositingInputs().hasNonIsolatedDescendantWithBlend
Mode) | 1070 if (descendantDependentCompositingInputs().hasNonIsolatedDescendantWithBlend
Mode) |
1071 return true; | 1071 return true; |
1072 if (renderer()->isSVGRoot()) | 1072 if (layoutObject()->isSVGRoot()) |
1073 return toLayoutSVGRoot(renderer())->hasNonIsolatedBlendingDescendants(); | 1073 return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendant
s(); |
1074 return false; | 1074 return false; |
1075 } | 1075 } |
1076 | 1076 |
1077 void Layer::setCompositingReasons(CompositingReasons reasons, CompositingReasons
mask) | 1077 void Layer::setCompositingReasons(CompositingReasons reasons, CompositingReasons
mask) |
1078 { | 1078 { |
1079 if ((compositingReasons() & mask) == (reasons & mask)) | 1079 if ((compositingReasons() & mask) == (reasons & mask)) |
1080 return; | 1080 return; |
1081 m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask); | 1081 m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask); |
1082 } | 1082 } |
1083 | 1083 |
(...skipping 15 matching lines...) Expand all Loading... |
1099 | 1099 |
1100 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants; | 1100 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants; |
1101 | 1101 |
1102 if (hasCompositedLayerMapping()) | 1102 if (hasCompositedLayerMapping()) |
1103 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); | 1103 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat
eLocal); |
1104 } | 1104 } |
1105 | 1105 |
1106 bool Layer::hasAncestorWithFilterOutsets() const | 1106 bool Layer::hasAncestorWithFilterOutsets() const |
1107 { | 1107 { |
1108 for (const Layer* curr = this; curr; curr = curr->parent()) { | 1108 for (const Layer* curr = this; curr; curr = curr->parent()) { |
1109 LayoutBoxModelObject* renderer = curr->renderer(); | 1109 LayoutBoxModelObject* renderer = curr->layoutObject(); |
1110 if (renderer->style()->hasFilterOutsets()) | 1110 if (renderer->style()->hasFilterOutsets()) |
1111 return true; | 1111 return true; |
1112 } | 1112 } |
1113 return false; | 1113 return false; |
1114 } | 1114 } |
1115 | 1115 |
1116 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
t Layer* layer, const Layer* rootLayer, | 1116 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons
t Layer* layer, const Layer* rootLayer, |
1117 Layer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& s
ubPixelAccumulation, PaintBehavior paintBehavior) | 1117 Layer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& s
ubPixelAccumulation, PaintBehavior paintBehavior) |
1118 { | 1118 { |
1119 // If we have a mask, then the clip is limited to the border box area (and t
here is | 1119 // If we have a mask, then the clip is limited to the border box area (and t
here is |
1120 // no need to examine child layers). | 1120 // no need to examine child layers). |
1121 if (!layer->renderer()->hasMask()) { | 1121 if (!layer->layoutObject()->hasMask()) { |
1122 // Note: we don't have to walk z-order lists since transparent elements
always establish | 1122 // Note: we don't have to walk z-order lists since transparent elements
always establish |
1123 // a stacking container. This means we can just walk the layer tree dire
ctly. | 1123 // a stacking container. This means we can just walk the layer tree dire
ctly. |
1124 for (Layer* curr = layer->firstChild(); curr; curr = curr->nextSibling()
) { | 1124 for (Layer* curr = layer->firstChild(); curr; curr = curr->nextSibling()
) { |
1125 if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionL
ayer() != curr) | 1125 if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionL
ayer() != curr) |
1126 clipRect.unite(Layer::transparencyClipBox(curr, rootLayer, trans
parencyBehavior, Layer::DescendantsOfTransparencyClipBox, subPixelAccumulation,
paintBehavior)); | 1126 clipRect.unite(Layer::transparencyClipBox(curr, rootLayer, trans
parencyBehavior, Layer::DescendantsOfTransparencyClipBox, subPixelAccumulation,
paintBehavior)); |
1127 } | 1127 } |
1128 } | 1128 } |
1129 | 1129 |
1130 // If we have a reflection, then we need to account for that when we push th
e clip. Reflect our entire | 1130 // If we have a reflection, then we need to account for that when we push th
e clip. Reflect our entire |
1131 // current transparencyClipBox to catch all child layers. | 1131 // current transparencyClipBox to catch all child layers. |
1132 // FIXME: Accelerated compositing will eventually want to do something smart
here to avoid incorporating this | 1132 // FIXME: Accelerated compositing will eventually want to do something smart
here to avoid incorporating this |
1133 // size into the parent layer. | 1133 // size into the parent layer. |
1134 if (layer->renderer()->hasReflection()) { | 1134 if (layer->layoutObject()->hasReflection()) { |
1135 LayoutPoint delta; | 1135 LayoutPoint delta; |
1136 layer->convertToLayerCoords(rootLayer, delta); | 1136 layer->convertToLayerCoords(rootLayer, delta); |
1137 clipRect.move(-delta.x(), -delta.y()); | 1137 clipRect.move(-delta.x(), -delta.y()); |
1138 clipRect.unite(layer->layoutBox()->reflectedRect(clipRect)); | 1138 clipRect.unite(layer->layoutBox()->reflectedRect(clipRect)); |
1139 clipRect.moveBy(delta); | 1139 clipRect.moveBy(delta); |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 LayoutRect Layer::transparencyClipBox(const Layer* layer, const Layer* rootLayer
, TransparencyClipBoxBehavior transparencyBehavior, | 1143 LayoutRect Layer::transparencyClipBox(const Layer* layer, const Layer* rootLayer
, TransparencyClipBoxBehavior transparencyBehavior, |
1144 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula
tion, PaintBehavior paintBehavior) | 1144 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula
tion, PaintBehavior paintBehavior) |
(...skipping 14 matching lines...) Expand all Loading... |
1159 delta.move(subPixelAccumulation); | 1159 delta.move(subPixelAccumulation); |
1160 IntPoint pixelSnappedDelta = roundedIntPoint(delta); | 1160 IntPoint pixelSnappedDelta = roundedIntPoint(delta); |
1161 TransformationMatrix transform; | 1161 TransformationMatrix transform; |
1162 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); | 1162 transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y()); |
1163 transform = transform * *layer->transform(); | 1163 transform = transform * *layer->transform(); |
1164 | 1164 |
1165 // We don't use fragment boxes when collecting a transformed layer's bou
nding box, since it always | 1165 // We don't use fragment boxes when collecting a transformed layer's bou
nding box, since it always |
1166 // paints unfragmented. | 1166 // paints unfragmented. |
1167 LayoutRect clipRect = layer->physicalBoundingBox(layer); | 1167 LayoutRect clipRect = layer->physicalBoundingBox(layer); |
1168 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); | 1168 expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); |
1169 clipRect.expand(layer->renderer()->style()->filterOutsets()); | 1169 clipRect.expand(layer->layoutObject()->style()->filterOutsets()); |
1170 LayoutRect result = transform.mapRect(clipRect); | 1170 LayoutRect result = transform.mapRect(clipRect); |
1171 if (!paginationLayer) | 1171 if (!paginationLayer) |
1172 return result; | 1172 return result; |
1173 | 1173 |
1174 // We have to break up the transformed extent across our columns. | 1174 // We have to break up the transformed extent across our columns. |
1175 // Split our box up into the actual fragment boxes that render in the co
lumns/pages and unite those together to | 1175 // Split our box up into the actual fragment boxes that render in the co
lumns/pages and unite those together to |
1176 // get our true bounding box. | 1176 // get our true bounding box. |
1177 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLay
er->renderer()); | 1177 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLay
er->layoutObject()); |
1178 result = enclosingFlowThread->fragmentsBoundingBox(result); | 1178 result = enclosingFlowThread->fragmentsBoundingBox(result); |
1179 | 1179 |
1180 LayoutPoint rootLayerDelta; | 1180 LayoutPoint rootLayerDelta; |
1181 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); | 1181 paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta); |
1182 result.moveBy(rootLayerDelta); | 1182 result.moveBy(rootLayerDelta); |
1183 return result; | 1183 return result; |
1184 } | 1184 } |
1185 | 1185 |
1186 LayoutRect clipRect = layer->fragmentsBoundingBox(rootLayer); | 1186 LayoutRect clipRect = layer->fragmentsBoundingBox(rootLayer); |
1187 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); | 1187 expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transp
arencyBehavior, subPixelAccumulation, paintBehavior); |
1188 clipRect.expand(layer->renderer()->style()->filterOutsets()); | 1188 clipRect.expand(layer->layoutObject()->style()->filterOutsets()); |
1189 clipRect.move(subPixelAccumulation); | 1189 clipRect.move(subPixelAccumulation); |
1190 return clipRect; | 1190 return clipRect; |
1191 } | 1191 } |
1192 | 1192 |
1193 LayoutRect Layer::paintingExtent(const Layer* rootLayer, const LayoutRect& paint
DirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior) | 1193 LayoutRect Layer::paintingExtent(const Layer* rootLayer, const LayoutRect& paint
DirtyRect, const LayoutSize& subPixelAccumulation, PaintBehavior paintBehavior) |
1194 { | 1194 { |
1195 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, subPixelAccumulation, paintBehavior), paint
DirtyRect); | 1195 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, subPixelAccumulation, paintBehavior), paint
DirtyRect); |
1196 } | 1196 } |
1197 | 1197 |
1198 void* Layer::operator new(size_t sz) | 1198 void* Layer::operator new(size_t sz) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 if (oldChild->stackingNode()->isNormalFlowOnly()) | 1259 if (oldChild->stackingNode()->isNormalFlowOnly()) |
1260 m_stackingNode->dirtyNormalFlowList(); | 1260 m_stackingNode->dirtyNormalFlowList(); |
1261 if (!oldChild->stackingNode()->isNormalFlowOnly() || oldChild->firstChild())
{ | 1261 if (!oldChild->stackingNode()->isNormalFlowOnly() || oldChild->firstChild())
{ |
1262 // Dirty the z-order list in which we are contained. When called via th
e | 1262 // Dirty the z-order list in which we are contained. When called via th
e |
1263 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected | 1263 // reattachment process in removeOnlyThisLayer, the layer may already be
disconnected |
1264 // from the main layer tree, so we need to null-check the | 1264 // from the main layer tree, so we need to null-check the |
1265 // |stackingContext| value. | 1265 // |stackingContext| value. |
1266 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); | 1266 oldChild->stackingNode()->dirtyStackingContextZOrderLists(); |
1267 } | 1267 } |
1268 | 1268 |
1269 if (renderer()->style()->visibility() != VISIBLE) | 1269 if (layoutObject()->style()->visibility() != VISIBLE) |
1270 dirtyVisibleContentStatus(); | 1270 dirtyVisibleContentStatus(); |
1271 | 1271 |
1272 oldChild->setPreviousSibling(0); | 1272 oldChild->setPreviousSibling(0); |
1273 oldChild->setNextSibling(0); | 1273 oldChild->setNextSibling(0); |
1274 oldChild->m_parent = 0; | 1274 oldChild->m_parent = 0; |
1275 | 1275 |
1276 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1276 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1277 | 1277 |
1278 oldChild->updateDescendantDependentFlags(); | 1278 oldChild->updateDescendantDependentFlags(); |
1279 | 1279 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 current = next; | 1322 current = next; |
1323 } | 1323 } |
1324 | 1324 |
1325 // Remove us from the parent. | 1325 // Remove us from the parent. |
1326 m_parent->removeChild(this); | 1326 m_parent->removeChild(this); |
1327 m_renderer->destroyLayer(); | 1327 m_renderer->destroyLayer(); |
1328 } | 1328 } |
1329 | 1329 |
1330 void Layer::insertOnlyThisLayer() | 1330 void Layer::insertOnlyThisLayer() |
1331 { | 1331 { |
1332 if (!m_parent && renderer()->parent()) { | 1332 if (!m_parent && layoutObject()->parent()) { |
1333 // We need to connect ourselves when our renderer() has a parent. | 1333 // We need to connect ourselves when our layoutObject() has a parent. |
1334 // Find our enclosingLayer and add ourselves. | 1334 // Find our enclosingLayer and add ourselves. |
1335 Layer* parentLayer = renderer()->parent()->enclosingLayer(); | 1335 Layer* parentLayer = layoutObject()->parent()->enclosingLayer(); |
1336 ASSERT(parentLayer); | 1336 ASSERT(parentLayer); |
1337 Layer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->refl
ectionInfo()->reflectionLayer() != this ? renderer()->parent()->findNextLayer(pa
rentLayer, renderer()) : 0; | 1337 Layer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->refl
ectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNextLaye
r(parentLayer, layoutObject()) : 0; |
1338 parentLayer->addChild(this, beforeChild); | 1338 parentLayer->addChild(this, beforeChild); |
1339 } | 1339 } |
1340 | 1340 |
1341 // Remove all descendant layers from the hierarchy and add them to the new p
osition. | 1341 // Remove all descendant layers from the hierarchy and add them to the new p
osition. |
1342 for (LayoutObject* curr = renderer()->slowFirstChild(); curr; curr = curr->n
extSibling()) | 1342 for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = cur
r->nextSibling()) |
1343 curr->moveLayers(m_parent, this); | 1343 curr->moveLayers(m_parent, this); |
1344 | 1344 |
1345 // Clear out all the clip rects. | 1345 // Clear out all the clip rects. |
1346 m_clipper.clearClipRectsIncludingDescendants(); | 1346 m_clipper.clearClipRectsIncludingDescendants(); |
1347 } | 1347 } |
1348 | 1348 |
1349 // Returns the layer reached on the walk up towards the ancestor. | 1349 // Returns the layer reached on the walk up towards the ancestor. |
1350 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c
onst Layer* ancestorLayer, LayoutPoint& location) | 1350 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c
onst Layer* ancestorLayer, LayoutPoint& location) |
1351 { | 1351 { |
1352 ASSERT(ancestorLayer != layer); | 1352 ASSERT(ancestorLayer != layer); |
1353 | 1353 |
1354 const LayoutBoxModelObject* renderer = layer->renderer(); | 1354 const LayoutBoxModelObject* renderer = layer->layoutObject(); |
1355 EPosition position = renderer->style()->position(); | 1355 EPosition position = renderer->style()->position(); |
1356 | 1356 |
1357 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a LayoutFlowThread | 1357 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a LayoutFlowThread |
1358 // may need to be revisited in a future patch. | 1358 // may need to be revisited in a future patch. |
1359 // If the fixed renderer is inside a LayoutFlowThread, we should not compute
location using localToAbsolute, | 1359 // If the fixed renderer is inside a LayoutFlowThread, we should not compute
location using localToAbsolute, |
1360 // since localToAbsolute maps the coordinates from flow thread to regions co
ordinates and regions can be | 1360 // since localToAbsolute maps the coordinates from flow thread to regions co
ordinates and regions can be |
1361 // positioned in a completely different place in the viewport (LayoutView). | 1361 // positioned in a completely different place in the viewport (LayoutView). |
1362 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == rendere
r->view()->layer())) { | 1362 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == rendere
r->view()->layer())) { |
1363 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling | 1363 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling |
1364 // localToAbsolute() on the LayoutView. | 1364 // localToAbsolute() on the LayoutView. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 if (ancestorLayer == this) | 1490 if (ancestorLayer == this) |
1491 return offset; | 1491 return offset; |
1492 Layer* paginationLayer = enclosingPaginationLayer(); | 1492 Layer* paginationLayer = enclosingPaginationLayer(); |
1493 if (paginationLayer == this) | 1493 if (paginationLayer == this) |
1494 paginationLayer = parent()->enclosingPaginationLayer(); | 1494 paginationLayer = parent()->enclosingPaginationLayer(); |
1495 if (!paginationLayer) { | 1495 if (!paginationLayer) { |
1496 convertToLayerCoords(ancestorLayer, offset); | 1496 convertToLayerCoords(ancestorLayer, offset); |
1497 return offset; | 1497 return offset; |
1498 } | 1498 } |
1499 | 1499 |
1500 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->renderer(
)); | 1500 LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObj
ect()); |
1501 convertToLayerCoords(paginationLayer, offset); | 1501 convertToLayerCoords(paginationLayer, offset); |
1502 offset = flowThread->flowThreadPointToVisualPoint(offset); | 1502 offset = flowThread->flowThreadPointToVisualPoint(offset); |
1503 if (ancestorLayer == paginationLayer) | 1503 if (ancestorLayer == paginationLayer) |
1504 return offset; | 1504 return offset; |
1505 | 1505 |
1506 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) { | 1506 if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) { |
1507 offset.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); | 1507 offset.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer)); |
1508 } else { | 1508 } else { |
1509 // The ancestor layer is also inside the pagination layer, so we need to
subtract the visual | 1509 // The ancestor layer is also inside the pagination layer, so we need to
subtract the visual |
1510 // distance from the ancestor layer to the pagination layer. | 1510 // distance from the ancestor layer to the pagination layer. |
1511 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer))
; | 1511 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer))
; |
1512 } | 1512 } |
1513 return offset; | 1513 return offset; |
1514 } | 1514 } |
1515 | 1515 |
1516 void Layer::didUpdateNeedsCompositedScrolling() | 1516 void Layer::didUpdateNeedsCompositedScrolling() |
1517 { | 1517 { |
1518 updateSelfPaintingLayer(); | 1518 updateSelfPaintingLayer(); |
1519 } | 1519 } |
1520 | 1520 |
1521 void Layer::updateReflectionInfo(const LayoutStyle* oldStyle) | 1521 void Layer::updateReflectionInfo(const LayoutStyle* oldStyle) |
1522 { | 1522 { |
1523 ASSERT(!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)
); | 1523 ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldSt
yle)); |
1524 if (renderer()->hasReflection()) { | 1524 if (layoutObject()->hasReflection()) { |
1525 if (!m_reflectionInfo) | 1525 if (!m_reflectionInfo) |
1526 m_reflectionInfo = adoptPtr(new LayerReflectionInfo(*layoutBox())); | 1526 m_reflectionInfo = adoptPtr(new LayerReflectionInfo(*layoutBox())); |
1527 m_reflectionInfo->updateAfterStyleChange(oldStyle); | 1527 m_reflectionInfo->updateAfterStyleChange(oldStyle); |
1528 } else if (m_reflectionInfo) { | 1528 } else if (m_reflectionInfo) { |
1529 m_reflectionInfo->destroy(); | 1529 m_reflectionInfo->destroy(); |
1530 m_reflectionInfo = nullptr; | 1530 m_reflectionInfo = nullptr; |
1531 } | 1531 } |
1532 } | 1532 } |
1533 | 1533 |
1534 void Layer::updateStackingNode() | 1534 void Layer::updateStackingNode() |
1535 { | 1535 { |
1536 if (requiresStackingNode()) | 1536 if (requiresStackingNode()) |
1537 m_stackingNode = adoptPtr(new LayerStackingNode(this)); | 1537 m_stackingNode = adoptPtr(new LayerStackingNode(this)); |
1538 else | 1538 else |
1539 m_stackingNode = nullptr; | 1539 m_stackingNode = nullptr; |
1540 } | 1540 } |
1541 | 1541 |
1542 void Layer::updateScrollableArea() | 1542 void Layer::updateScrollableArea() |
1543 { | 1543 { |
1544 if (requiresScrollableArea()) | 1544 if (requiresScrollableArea()) |
1545 m_scrollableArea = adoptPtr(new LayerScrollableArea(*this)); | 1545 m_scrollableArea = adoptPtr(new LayerScrollableArea(*this)); |
1546 else | 1546 else |
1547 m_scrollableArea = nullptr; | 1547 m_scrollableArea = nullptr; |
1548 } | 1548 } |
1549 | 1549 |
1550 bool Layer::hasOverflowControls() const | 1550 bool Layer::hasOverflowControls() const |
1551 { | 1551 { |
1552 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1552 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->scrollCorner() || layoutObject()->style()->resize() != RESIZE_NONE); |
1553 } | 1553 } |
1554 | 1554 |
1555 void Layer::appendSingleFragmentIgnoringPagination(LayerFragments& fragments, co
nst Layer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot clipRectsC
acheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldR
espectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot, const
LayoutSize& subPixelAccumulation) | 1555 void Layer::appendSingleFragmentIgnoringPagination(LayerFragments& fragments, co
nst Layer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot clipRectsC
acheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldR
espectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot, const
LayoutSize& subPixelAccumulation) |
1556 { | 1556 { |
1557 LayerFragment fragment; | 1557 LayerFragment fragment; |
1558 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlaySc
rollbarSizeRelevancy, subPixelAccumulation); | 1558 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlaySc
rollbarSizeRelevancy, subPixelAccumulation); |
1559 if (respectOverflowClip == IgnoreOverflowClip) | 1559 if (respectOverflowClip == IgnoreOverflowClip) |
1560 clipRectsContext.setIgnoreOverflowClip(); | 1560 clipRectsContext.setIgnoreOverflowClip(); |
1561 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr
omRoot); | 1561 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offsetFr
omRoot); |
1562 fragments.append(fragment); | 1562 fragments.append(fragment); |
(...skipping 23 matching lines...) Expand all Loading... |
1586 ClipRect foregroundRectInFlowThread; | 1586 ClipRect foregroundRectInFlowThread; |
1587 ClipRect outlineRectInFlowThread; | 1587 ClipRect outlineRectInFlowThread; |
1588 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::
infiniteIntRect()), layerBoundsInFlowThread, backgroundRectInFlowThread, foregro
undRectInFlowThread, | 1588 clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::
infiniteIntRect()), layerBoundsInFlowThread, backgroundRectInFlowThread, foregro
undRectInFlowThread, |
1589 outlineRectInFlowThread, &offsetWithinPaginatedLayer); | 1589 outlineRectInFlowThread, &offsetWithinPaginatedLayer); |
1590 | 1590 |
1591 // Take our bounding box within the flow thread and clip it. | 1591 // Take our bounding box within the flow thread and clip it. |
1592 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer
); | 1592 LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingB
ox : physicalBoundingBox(enclosingPaginationLayer(), &offsetWithinPaginatedLayer
); |
1593 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); | 1593 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); |
1594 | 1594 |
1595 // Make the dirty rect relative to the fragmentation context (multicol conta
iner, etc.). | 1595 // Make the dirty rect relative to the fragmentation context (multicol conta
iner, etc.). |
1596 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->renderer()); | 1596 LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginati
onLayer()->layoutObject()); |
1597 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. | 1597 LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root
layer to the nearest fragmentation context. |
1598 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); | 1598 bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer(
) == enclosingPaginationLayer(); |
1599 if (rootLayerIsInsidePaginationLayer) { | 1599 if (rootLayerIsInsidePaginationLayer) { |
1600 // The root layer is in the same fragmentation context as this layer, so
we need to look | 1600 // The root layer is in the same fragmentation context as this layer, so
we need to look |
1601 // inside it and subtract the offset between the fragmentation context a
nd the root layer. | 1601 // inside it and subtract the offset between the fragmentation context a
nd the root layer. |
1602 offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(e
nclosingPaginationLayer()); | 1602 offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(e
nclosingPaginationLayer()); |
1603 } else { | 1603 } else { |
1604 offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffs
etFromAncestor(rootLayer); | 1604 offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffs
etFromAncestor(rootLayer); |
1605 } | 1605 } |
1606 LayoutRect dirtyRectInFlowThread(dirtyRect); | 1606 LayoutRect dirtyRectInFlowThread(dirtyRect); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) | 1657 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) |
1658 { | 1658 { |
1659 return hitTest(request, result.hitTestLocation(), result); | 1659 return hitTest(request, result.hitTestLocation(), result); |
1660 } | 1660 } |
1661 | 1661 |
1662 bool Layer::hitTest(const HitTestRequest& request, const HitTestLocation& hitTes
tLocation, HitTestResult& result) | 1662 bool Layer::hitTest(const HitTestRequest& request, const HitTestLocation& hitTes
tLocation, HitTestResult& result) |
1663 { | 1663 { |
1664 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 1664 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
1665 | 1665 |
1666 // LayoutView should make sure to update layout before entering hit testing | 1666 // LayoutView should make sure to update layout before entering hit testing |
1667 ASSERT(!renderer()->frame()->view()->layoutPending()); | 1667 ASSERT(!layoutObject()->frame()->view()->layoutPending()); |
1668 ASSERT(!renderer()->document().layoutView()->needsLayout()); | 1668 ASSERT(!layoutObject()->document().layoutView()->needsLayout()); |
1669 | 1669 |
1670 // Start with frameVisibleRect to ensure we include the scrollbars. | 1670 // Start with frameVisibleRect to ensure we include the scrollbars. |
1671 LayoutRect hitTestArea = frameVisibleRect(renderer()); | 1671 LayoutRect hitTestArea = frameVisibleRect(layoutObject()); |
1672 if (request.ignoreClipping()) | 1672 if (request.ignoreClipping()) |
1673 hitTestArea.unite(LayoutRect(renderer()->view()->documentRect())); | 1673 hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
1674 | 1674 |
1675 Layer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hit
TestLocation, false); | 1675 Layer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, hit
TestLocation, false); |
1676 if (!insideLayer) { | 1676 if (!insideLayer) { |
1677 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, | 1677 // We didn't hit any layer. If we are the root layer and the mouse is --
or just was -- down, |
1678 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has | 1678 // return ourselves. We do this so mouse events continue getting deliver
ed after a drag has |
1679 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. | 1679 // exited the WebView, and so hit testing over a scrollbar hits the cont
ent document. |
1680 // In addtion, it is possible for the mouse to stay in the document but
there is no element. | 1680 // In addtion, it is possible for the mouse to stay in the document but
there is no element. |
1681 // At that time, the events of the mouse should be fired. | 1681 // At that time, the events of the mouse should be fired. |
1682 LayoutPoint hitPoint = hitTestLocation.point(); | 1682 LayoutPoint hitPoint = hitTestLocation.point(); |
1683 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { | 1683 if (!request.isChildFrameHitTest() && ((request.active() || request.rele
ase()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y())))
&& isRootLayer()) { |
1684 renderer()->updateHitTestResult(result, toLayoutView(renderer())->fl
ipForWritingMode(hitTestLocation.point())); | 1684 layoutObject()->updateHitTestResult(result, toLayoutView(layoutObjec
t())->flipForWritingMode(hitTestLocation.point())); |
1685 insideLayer = this; | 1685 insideLayer = this; |
1686 } | 1686 } |
1687 } | 1687 } |
1688 | 1688 |
1689 // Now determine if the result is inside an anchor - if the urlElement isn't
already set. | 1689 // Now determine if the result is inside an anchor - if the urlElement isn't
already set. |
1690 Node* node = result.innerNode(); | 1690 Node* node = result.innerNode(); |
1691 if (node && !result.URLElement()) | 1691 if (node && !result.URLElement()) |
1692 result.setURLElement(node->enclosingLinkEventParentOrSelf()); | 1692 result.setURLElement(node->enclosingLinkEventParentOrSelf()); |
1693 | 1693 |
1694 // Now return whether we were inside this layer (this will always be true fo
r the root | 1694 // Now return whether we were inside this layer (this will always be true fo
r the root |
1695 // layer). | 1695 // layer). |
1696 return insideLayer; | 1696 return insideLayer; |
1697 } | 1697 } |
1698 | 1698 |
1699 Node* Layer::enclosingElement() const | 1699 Node* Layer::enclosingElement() const |
1700 { | 1700 { |
1701 for (LayoutObject* r = renderer(); r; r = r->parent()) { | 1701 for (LayoutObject* r = layoutObject(); r; r = r->parent()) { |
1702 if (Node* e = r->node()) | 1702 if (Node* e = r->node()) |
1703 return e; | 1703 return e; |
1704 } | 1704 } |
1705 ASSERT_NOT_REACHED(); | 1705 ASSERT_NOT_REACHED(); |
1706 return 0; | 1706 return 0; |
1707 } | 1707 } |
1708 | 1708 |
1709 bool Layer::isInTopLayer() const | 1709 bool Layer::isInTopLayer() const |
1710 { | 1710 { |
1711 Node* node = renderer()->node(); | 1711 Node* node = layoutObject()->node(); |
1712 return node && node->isElementNode() && toElement(node)->isInTopLayer(); | 1712 return node && node->isElementNode() && toElement(node)->isInTopLayer(); |
1713 } | 1713 } |
1714 | 1714 |
1715 // Compute the z-offset of the point in the transformState. | 1715 // Compute the z-offset of the point in the transformState. |
1716 // This is effectively projecting a ray normal to the plane of ancestor, finding
where that | 1716 // This is effectively projecting a ray normal to the plane of ancestor, finding
where that |
1717 // ray intersects target, and computing the z delta between those two points. | 1717 // ray intersects target, and computing the z delta between those two points. |
1718 static double computeZOffset(const HitTestingTransformState& transformState) | 1718 static double computeZOffset(const HitTestingTransformState& transformState) |
1719 { | 1719 { |
1720 // We got an affine transform, so no z-offset | 1720 // We got an affine transform, so no z-offset |
1721 if (transformState.m_accumulatedTransform.isAffine()) | 1721 if (transformState.m_accumulatedTransform.isAffine()) |
(...skipping 19 matching lines...) Expand all Loading... |
1741 transformState = HitTestingTransformState::create(*containerTransformSta
te); | 1741 transformState = HitTestingTransformState::create(*containerTransformSta
te); |
1742 convertToLayerCoords(containerLayer, offset); | 1742 convertToLayerCoords(containerLayer, offset); |
1743 } else { | 1743 } else { |
1744 // If this is the first time we need to make transform state, then base
it off of hitTestLocation, | 1744 // If this is the first time we need to make transform state, then base
it off of hitTestLocation, |
1745 // which is relative to rootLayer. | 1745 // which is relative to rootLayer. |
1746 transformState = HitTestingTransformState::create(hitTestLocation.transf
ormedPoint(), hitTestLocation.transformedRect(), FloatQuad(hitTestRect)); | 1746 transformState = HitTestingTransformState::create(hitTestLocation.transf
ormedPoint(), hitTestLocation.transformedRect(), FloatQuad(hitTestRect)); |
1747 convertToLayerCoords(rootLayer, offset); | 1747 convertToLayerCoords(rootLayer, offset); |
1748 } | 1748 } |
1749 offset.moveBy(translationOffset); | 1749 offset.moveBy(translationOffset); |
1750 | 1750 |
1751 LayoutObject* containerRenderer = containerLayer ? containerLayer->renderer(
) : 0; | 1751 LayoutObject* containerRenderer = containerLayer ? containerLayer->layoutObj
ect() : 0; |
1752 if (renderer()->shouldUseTransformFromContainer(containerRenderer)) { | 1752 if (layoutObject()->shouldUseTransformFromContainer(containerRenderer)) { |
1753 TransformationMatrix containerTransform; | 1753 TransformationMatrix containerTransform; |
1754 renderer()->getTransformFromContainer(containerRenderer, toLayoutSize(of
fset), containerTransform); | 1754 layoutObject()->getTransformFromContainer(containerRenderer, toLayoutSiz
e(offset), containerTransform); |
1755 transformState->applyTransform(containerTransform, HitTestingTransformSt
ate::AccumulateTransform); | 1755 transformState->applyTransform(containerTransform, HitTestingTransformSt
ate::AccumulateTransform); |
1756 } else { | 1756 } else { |
1757 transformState->translate(offset.x(), offset.y(), HitTestingTransformSta
te::AccumulateTransform); | 1757 transformState->translate(offset.x(), offset.y(), HitTestingTransformSta
te::AccumulateTransform); |
1758 } | 1758 } |
1759 | 1759 |
1760 return transformState; | 1760 return transformState; |
1761 } | 1761 } |
1762 | 1762 |
1763 | 1763 |
1764 static bool isHitCandidate(const Layer* hitLayer, bool canDepthSort, double* zOf
fset, const HitTestingTransformState* transformState) | 1764 static bool isHitCandidate(const Layer* hitLayer, bool canDepthSort, double* zOf
fset, const HitTestingTransformState* transformState) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 if (appliedTransform) { | 1826 if (appliedTransform) { |
1827 // We computed the correct state in the caller (above code), so just ref
erence it. | 1827 // We computed the correct state in the caller (above code), so just ref
erence it. |
1828 ASSERT(transformState); | 1828 ASSERT(transformState); |
1829 localTransformState = const_cast<HitTestingTransformState*>(transformSta
te); | 1829 localTransformState = const_cast<HitTestingTransformState*>(transformSta
te); |
1830 } else if (transformState || m_has3DTransformedDescendant || preserves3D())
{ | 1830 } else if (transformState || m_has3DTransformedDescendant || preserves3D())
{ |
1831 // We need transform state for the first time, or to offset the containe
r state, so create it here. | 1831 // We need transform state for the first time, or to offset the containe
r state, so create it here. |
1832 localTransformState = createLocalTransformState(rootLayer, containerLaye
r, hitTestRect, hitTestLocation, transformState); | 1832 localTransformState = createLocalTransformState(rootLayer, containerLaye
r, hitTestRect, hitTestLocation, transformState); |
1833 } | 1833 } |
1834 | 1834 |
1835 // Check for hit test on backface if backface-visibility is 'hidden' | 1835 // Check for hit test on backface if backface-visibility is 'hidden' |
1836 if (localTransformState && renderer()->style()->backfaceVisibility() == Back
faceVisibilityHidden) { | 1836 if (localTransformState && layoutObject()->style()->backfaceVisibility() ==
BackfaceVisibilityHidden) { |
1837 TransformationMatrix invertedMatrix = localTransformState->m_accumulated
Transform.inverse(); | 1837 TransformationMatrix invertedMatrix = localTransformState->m_accumulated
Transform.inverse(); |
1838 // If the z-vector of the matrix is negative, the back is facing towards
the viewer. | 1838 // If the z-vector of the matrix is negative, the back is facing towards
the viewer. |
1839 if (invertedMatrix.m33() < 0) | 1839 if (invertedMatrix.m33() < 0) |
1840 return 0; | 1840 return 0; |
1841 } | 1841 } |
1842 | 1842 |
1843 RefPtr<HitTestingTransformState> unflattenedTransformState = localTransformS
tate; | 1843 RefPtr<HitTestingTransformState> unflattenedTransformState = localTransformS
tate; |
1844 if (localTransformState && !preserves3D()) { | 1844 if (localTransformState && !preserves3D()) { |
1845 // Keep a copy of the pre-flattening state, for computing z-offsets for
the container | 1845 // Keep a copy of the pre-flattening state, for computing z-offsets for
the container |
1846 unflattenedTransformState = HitTestingTransformState::create(*localTrans
formState); | 1846 unflattenedTransformState = HitTestingTransformState::create(*localTrans
formState); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 } | 1888 } |
1889 | 1889 |
1890 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 1890 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
1891 LayerFragments layerFragments; | 1891 LayerFragments layerFragments; |
1892 if (appliedTransform) | 1892 if (appliedTransform) |
1893 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); | 1893 appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTes
tRect, RootRelativeClipRects, IncludeOverlayScrollbarSize); |
1894 else | 1894 else |
1895 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli
pRects, IncludeOverlayScrollbarSize); | 1895 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeCli
pRects, IncludeOverlayScrollbarSize); |
1896 | 1896 |
1897 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 1897 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
1898 renderer()->updateHitTestResult(result, hitTestLocation.point()); | 1898 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); |
1899 return this; | 1899 return this; |
1900 } | 1900 } |
1901 | 1901 |
1902 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check | 1902 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check |
1903 // every fragment in reverse order. | 1903 // every fragment in reverse order. |
1904 if (isSelfPaintingLayer()) { | 1904 if (isSelfPaintingLayer()) { |
1905 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1905 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
1906 HitTestResult tempResult(result.hitTestLocation()); | 1906 HitTestResult tempResult(result.hitTestLocation()); |
1907 bool insideFragmentForegroundRect = false; | 1907 bool insideFragmentForegroundRect = false; |
1908 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) | 1908 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 newHitTestLocation = HitTestLocation(localPoint); | 2034 newHitTestLocation = HitTestLocation(localPoint); |
2035 | 2035 |
2036 // Now do a hit test with the root layer shifted to be us. | 2036 // Now do a hit test with the root layer shifted to be us. |
2037 return hitTestLayer(this, containerLayer, request, result, localHitTestRect,
newHitTestLocation, true, newTransformState.get(), zOffset); | 2037 return hitTestLayer(this, containerLayer, request, result, localHitTestRect,
newHitTestLocation, true, newTransformState.get(), zOffset); |
2038 } | 2038 } |
2039 | 2039 |
2040 bool Layer::hitTestContents(const HitTestRequest& request, HitTestResult& result
, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTest
Filter hitTestFilter) const | 2040 bool Layer::hitTestContents(const HitTestRequest& request, HitTestResult& result
, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTest
Filter hitTestFilter) const |
2041 { | 2041 { |
2042 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); | 2042 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); |
2043 | 2043 |
2044 if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(lay
erBounds.location() - layoutBoxLocation()), hitTestFilter)) { | 2044 if (!layoutObject()->hitTest(request, result, hitTestLocation, toLayoutPoint
(layerBounds.location() - layoutBoxLocation()), hitTestFilter)) { |
2045 // It's wrong to set innerNode, but then claim that you didn't hit anyth
ing, unless it is | 2045 // It's wrong to set innerNode, but then claim that you didn't hit anyth
ing, unless it is |
2046 // a rect-based test. | 2046 // a rect-based test. |
2047 ASSERT(!result.innerNode() || (request.listBased() && result.listBasedTe
stResult().size())); | 2047 ASSERT(!result.innerNode() || (request.listBased() && result.listBasedTe
stResult().size())); |
2048 return false; | 2048 return false; |
2049 } | 2049 } |
2050 | 2050 |
2051 // For positioned generated content, we might still not have a | 2051 // For positioned generated content, we might still not have a |
2052 // node by the time we get to the layer level, since none of | 2052 // node by the time we get to the layer level, since none of |
2053 // the content in the layer has an element. So just walk up | 2053 // the content in the layer has an element. So just walk up |
2054 // the tree. | 2054 // the tree. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 | 2102 |
2103 return resultLayer; | 2103 return resultLayer; |
2104 } | 2104 } |
2105 | 2105 |
2106 Layer* Layer::hitTestPaginatedChildLayer(Layer* childLayer, Layer* rootLayer, co
nst HitTestRequest& request, HitTestResult& result, | 2106 Layer* Layer::hitTestPaginatedChildLayer(Layer* childLayer, Layer* rootLayer, co
nst HitTestRequest& request, HitTestResult& result, |
2107 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) | 2107 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset) |
2108 { | 2108 { |
2109 Vector<Layer*> columnLayers; | 2109 Vector<Layer*> columnLayers; |
2110 LayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? paren
t()->stackingNode() : m_stackingNode->ancestorStackingContextNode(); | 2110 LayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? paren
t()->stackingNode() : m_stackingNode->ancestorStackingContextNode(); |
2111 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { | 2111 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { |
2112 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina
tion(childLayer->renderer(), curr->layoutBox())) | 2112 if (curr->layoutObject()->hasColumns() && checkContainingBlockChainForPa
gination(childLayer->layoutObject(), curr->layoutBox())) |
2113 columnLayers.append(curr); | 2113 columnLayers.append(curr); |
2114 if (curr->stackingNode() == ancestorNode) | 2114 if (curr->stackingNode() == ancestorNode) |
2115 break; | 2115 break; |
2116 } | 2116 } |
2117 | 2117 |
2118 ASSERT(columnLayers.size()); | 2118 ASSERT(columnLayers.size()); |
2119 return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitT
estRect, hitTestLocation, transformState, zOffset, | 2119 return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitT
estRect, hitTestLocation, transformState, zOffset, |
2120 columnLayers, columnLayers.size() - 1); | 2120 columnLayers, columnLayers.size() - 1); |
2121 } | 2121 } |
2122 | 2122 |
2123 Layer* Layer::hitTestChildLayerColumns(Layer* childLayer, Layer* rootLayer, cons
t HitTestRequest& request, HitTestResult& result, | 2123 Layer* Layer::hitTestChildLayerColumns(Layer* childLayer, Layer* rootLayer, cons
t HitTestRequest& request, HitTestResult& result, |
2124 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, | 2124 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const
HitTestingTransformState* transformState, double* zOffset, |
2125 const Vector<Layer*>& columnLayers, size_t columnIndex) | 2125 const Vector<Layer*>& columnLayers, size_t columnIndex) |
2126 { | 2126 { |
2127 LayoutBlock* columnBlock = toLayoutBlock(columnLayers[columnIndex]->renderer
()); | 2127 LayoutBlock* columnBlock = toLayoutBlock(columnLayers[columnIndex]->layoutOb
ject()); |
2128 | 2128 |
2129 ASSERT(columnBlock && columnBlock->hasColumns()); | 2129 ASSERT(columnBlock && columnBlock->hasColumns()); |
2130 if (!columnBlock || !columnBlock->hasColumns()) | 2130 if (!columnBlock || !columnBlock->hasColumns()) |
2131 return 0; | 2131 return 0; |
2132 | 2132 |
2133 LayoutPoint layerOffset; | 2133 LayoutPoint layerOffset; |
2134 columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset); | 2134 columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset); |
2135 | 2135 |
2136 ColumnInfo* colInfo = columnBlock->columnInfo(); | 2136 ColumnInfo* colInfo = columnBlock->columnInfo(); |
2137 int colCount = columnBlock->columnCount(colInfo); | 2137 int colCount = columnBlock->columnCount(colInfo); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 for (Layer* child = firstChild(); child; child = child->nextSibling()) { | 2247 for (Layer* child = firstChild(); child; child = child->nextSibling()) { |
2248 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2248 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
2249 DisablePaintInvalidationStateAsserts disabler; | 2249 DisablePaintInvalidationStateAsserts disabler; |
2250 child->invalidatePaintForBlockSelectionGaps(); | 2250 child->invalidatePaintForBlockSelectionGaps(); |
2251 } | 2251 } |
2252 | 2252 |
2253 if (m_blockSelectionGapsBounds.isEmpty()) | 2253 if (m_blockSelectionGapsBounds.isEmpty()) |
2254 return; | 2254 return; |
2255 | 2255 |
2256 LayoutRect rect(m_blockSelectionGapsBounds); | 2256 LayoutRect rect(m_blockSelectionGapsBounds); |
2257 if (renderer()->hasOverflowClip()) { | 2257 if (layoutObject()->hasOverflowClip()) { |
2258 LayoutBox* box = layoutBox(); | 2258 LayoutBox* box = layoutBox(); |
2259 rect.move(-box->scrolledContentOffset()); | 2259 rect.move(-box->scrolledContentOffset()); |
2260 if (!scrollableArea()->usesCompositedScrolling()) | 2260 if (!scrollableArea()->usesCompositedScrolling()) |
2261 rect.intersect(box->overflowClipRect(LayoutPoint())); | 2261 rect.intersect(box->overflowClipRect(LayoutPoint())); |
2262 } | 2262 } |
2263 if (renderer()->hasClip()) | 2263 if (layoutObject()->hasClip()) |
2264 rect.intersect(toLayoutBox(renderer())->clipRect(LayoutPoint())); | 2264 rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint())); |
2265 if (!rect.isEmpty()) { | 2265 if (!rect.isEmpty()) { |
2266 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 | 2266 // FIXME: We should not allow paint invalidation out of paint invalidati
on state. crbug.com/457415 |
2267 DisablePaintInvalidationStateAsserts disabler; | 2267 DisablePaintInvalidationStateAsserts disabler; |
2268 renderer()->invalidatePaintRectangle(rect); | 2268 layoutObject()->invalidatePaintRectangle(rect); |
2269 } | 2269 } |
2270 } | 2270 } |
2271 | 2271 |
2272 IntRect Layer::blockSelectionGapsBounds() const | 2272 IntRect Layer::blockSelectionGapsBounds() const |
2273 { | 2273 { |
2274 if (!renderer()->isLayoutBlockFlow()) | 2274 if (!layoutObject()->isLayoutBlockFlow()) |
2275 return IntRect(); | 2275 return IntRect(); |
2276 | 2276 |
2277 LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(renderer()); | 2277 LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject()); |
2278 LayoutRect gapRects = layoutBlockFlow->selectionGapRectsForPaintInvalidation
(layoutBlockFlow); | 2278 LayoutRect gapRects = layoutBlockFlow->selectionGapRectsForPaintInvalidation
(layoutBlockFlow); |
2279 | 2279 |
2280 return pixelSnappedIntRect(gapRects); | 2280 return pixelSnappedIntRect(gapRects); |
2281 } | 2281 } |
2282 | 2282 |
2283 bool Layer::hasBlockSelectionGapBounds() const | 2283 bool Layer::hasBlockSelectionGapBounds() const |
2284 { | 2284 { |
2285 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is
Empty(), but this is impossible | 2285 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is
Empty(), but this is impossible |
2286 // at the moment because it causes invalid queries to layout-dependent code
(crbug.com/372802). | 2286 // at the moment because it causes invalid queries to layout-dependent code
(crbug.com/372802). |
2287 // ASSERT(renderer()->document().lifecycle().state() >= DocumentLifecycle::L
ayoutClean); | 2287 // ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycl
e::LayoutClean); |
2288 | 2288 |
2289 if (!renderer()->isLayoutBlock()) | 2289 if (!layoutObject()->isLayoutBlock()) |
2290 return false; | 2290 return false; |
2291 | 2291 |
2292 return toLayoutBlock(renderer())->shouldPaintSelectionGaps(); | 2292 return toLayoutBlock(layoutObject())->shouldPaintSelectionGaps(); |
2293 } | 2293 } |
2294 | 2294 |
2295 bool Layer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect
& damageRect, const Layer* rootLayer, const LayoutPoint* offsetFromRoot) const | 2295 bool Layer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect
& damageRect, const Layer* rootLayer, const LayoutPoint* offsetFromRoot) const |
2296 { | 2296 { |
2297 // Always examine the canvas and the root. | 2297 // Always examine the canvas and the root. |
2298 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView | 2298 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the LayoutView |
2299 // paints the root's background. | 2299 // paints the root's background. |
2300 if (isRootLayer() || renderer()->isDocumentElement()) | 2300 if (isRootLayer() || layoutObject()->isDocumentElement()) |
2301 return true; | 2301 return true; |
2302 | 2302 |
2303 // If we aren't an inline flow, and our layer bounds do intersect the damage
rect, then we | 2303 // If we aren't an inline flow, and our layer bounds do intersect the damage
rect, then we |
2304 // can go ahead and return true. | 2304 // can go ahead and return true. |
2305 LayoutView* view = renderer()->view(); | 2305 LayoutView* view = layoutObject()->view(); |
2306 ASSERT(view); | 2306 ASSERT(view); |
2307 if (view && !renderer()->isLayoutInline()) { | 2307 if (view && !layoutObject()->isLayoutInline()) { |
2308 if (layerBounds.intersects(damageRect)) | 2308 if (layerBounds.intersects(damageRect)) |
2309 return true; | 2309 return true; |
2310 } | 2310 } |
2311 | 2311 |
2312 // Otherwise we need to compute the bounding box of this single layer and se
e if it intersects | 2312 // Otherwise we need to compute the bounding box of this single layer and se
e if it intersects |
2313 // the damage rect. | 2313 // the damage rect. |
2314 return physicalBoundingBox(rootLayer, offsetFromRoot).intersects(damageRect)
; | 2314 return physicalBoundingBox(rootLayer, offsetFromRoot).intersects(damageRect)
; |
2315 } | 2315 } |
2316 | 2316 |
2317 LayoutRect Layer::logicalBoundingBox() const | 2317 LayoutRect Layer::logicalBoundingBox() const |
2318 { | 2318 { |
2319 // There are three special cases we need to consider. | 2319 // There are three special cases we need to consider. |
2320 // (1) Inline Flows. For inline flows we will create a bounding box that fu
lly encompasses all of the lines occupied by the | 2320 // (1) Inline Flows. For inline flows we will create a bounding box that fu
lly encompasses all of the lines occupied by the |
2321 // inline. In other words, if some <span> wraps to three lines, we'll creat
e a bounding box that fully encloses the | 2321 // inline. In other words, if some <span> wraps to three lines, we'll creat
e a bounding box that fully encloses the |
2322 // line boxes of all three lines (including overflow on those lines). | 2322 // line boxes of all three lines (including overflow on those lines). |
2323 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top | 2323 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top |
2324 // overflow, we have to create a bounding box that will extend to include th
is overflow. | 2324 // overflow, we have to create a bounding box that will extend to include th
is overflow. |
2325 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats | 2325 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats |
2326 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those | 2326 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those |
2327 // floats. | 2327 // floats. |
2328 LayoutRect result; | 2328 LayoutRect result; |
2329 if (renderer()->isInline() && renderer()->isLayoutInline()) { | 2329 if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) { |
2330 result = toLayoutInline(renderer())->linesVisualOverflowBoundingBox(); | 2330 result = toLayoutInline(layoutObject())->linesVisualOverflowBoundingBox(
); |
2331 } else if (renderer()->isTableRow()) { | 2331 } else if (layoutObject()->isTableRow()) { |
2332 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. | 2332 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. |
2333 for (LayoutObject* child = renderer()->slowFirstChild(); child; child =
child->nextSibling()) { | 2333 for (LayoutObject* child = layoutObject()->slowFirstChild(); child; chil
d = child->nextSibling()) { |
2334 if (child->isTableCell()) { | 2334 if (child->isTableCell()) { |
2335 LayoutRect bbox = toLayoutBox(child)->borderBoxRect(); | 2335 LayoutRect bbox = toLayoutBox(child)->borderBoxRect(); |
2336 result.unite(bbox); | 2336 result.unite(bbox); |
2337 LayoutRect overflowRect = layoutBox()->visualOverflowRect(); | 2337 LayoutRect overflowRect = layoutBox()->visualOverflowRect(); |
2338 if (bbox != overflowRect) | 2338 if (bbox != overflowRect) |
2339 result.unite(overflowRect); | 2339 result.unite(overflowRect); |
2340 } | 2340 } |
2341 } | 2341 } |
2342 } else { | 2342 } else { |
2343 LayoutBox* box = layoutBox(); | 2343 LayoutBox* box = layoutBox(); |
2344 ASSERT(box); | 2344 ASSERT(box); |
2345 result = box->borderBoxRect(); | 2345 result = box->borderBoxRect(); |
2346 result.unite(box->visualOverflowRect()); | 2346 result.unite(box->visualOverflowRect()); |
2347 } | 2347 } |
2348 | 2348 |
2349 ASSERT(renderer()->view()); | 2349 ASSERT(layoutObject()->view()); |
2350 return result; | 2350 return result; |
2351 } | 2351 } |
2352 | 2352 |
2353 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou
tObject* renderer) | 2353 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou
tObject* renderer) |
2354 { | 2354 { |
2355 LayoutRect result = boundingBox; | 2355 LayoutRect result = boundingBox; |
2356 if (renderer->isBox()) | 2356 if (renderer->isBox()) |
2357 toLayoutBox(renderer)->flipForWritingMode(result); | 2357 toLayoutBox(renderer)->flipForWritingMode(result); |
2358 else | 2358 else |
2359 renderer->containingBlock()->flipForWritingMode(result); | 2359 renderer->containingBlock()->flipForWritingMode(result); |
2360 return result; | 2360 return result; |
2361 } | 2361 } |
2362 | 2362 |
2363 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo
int* offsetFromRoot) const | 2363 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo
int* offsetFromRoot) const |
2364 { | 2364 { |
2365 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer
()); | 2365 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutOb
ject()); |
2366 if (offsetFromRoot) | 2366 if (offsetFromRoot) |
2367 result.moveBy(*offsetFromRoot); | 2367 result.moveBy(*offsetFromRoot); |
2368 else | 2368 else |
2369 convertToLayerCoords(ancestorLayer, result); | 2369 convertToLayerCoords(ancestorLayer, result); |
2370 return result; | 2370 return result; |
2371 } | 2371 } |
2372 | 2372 |
2373 LayoutRect Layer::fragmentsBoundingBox(const Layer* ancestorLayer) const | 2373 LayoutRect Layer::fragmentsBoundingBox(const Layer* ancestorLayer) const |
2374 { | 2374 { |
2375 if (!enclosingPaginationLayer()) | 2375 if (!enclosingPaginationLayer()) |
2376 return physicalBoundingBox(ancestorLayer); | 2376 return physicalBoundingBox(ancestorLayer); |
2377 | 2377 |
2378 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer
()); | 2378 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutOb
ject()); |
2379 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu
lt); | 2379 convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, resu
lt); |
2380 return result; | 2380 return result; |
2381 } | 2381 } |
2382 | 2382 |
2383 LayoutRect Layer::boundingBoxForCompositingOverlapTest() const | 2383 LayoutRect Layer::boundingBoxForCompositingOverlapTest() const |
2384 { | 2384 { |
2385 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragme
ntsBoundingBox(this); | 2385 return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragme
ntsBoundingBox(this); |
2386 } | 2386 } |
2387 | 2387 |
2388 static void expandRectForReflectionAndStackingChildren(const Layer* ancestorLaye
r, Layer::CalculateBoundsOptions options, LayoutRect& result) | 2388 static void expandRectForReflectionAndStackingChildren(const Layer* ancestorLaye
r, Layer::CalculateBoundsOptions options, LayoutRect& result) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) | 2434 if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant()
) |
2435 return LayoutRect(); | 2435 return LayoutRect(); |
2436 | 2436 |
2437 // The root layer is always just the size of the document. | 2437 // The root layer is always just the size of the document. |
2438 if (isRootLayer()) | 2438 if (isRootLayer()) |
2439 return LayoutRect(m_renderer->view()->unscaledDocumentRect()); | 2439 return LayoutRect(m_renderer->view()->unscaledDocumentRect()); |
2440 | 2440 |
2441 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, | 2441 // The layer created for the LayoutFlowThread is just a helper for painting
and hit-testing, |
2442 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute | 2442 // and should not contribute to the bounding box. The LayoutMultiColumnSets
will contribute |
2443 // the correct size for the rendered content of the multicol container. | 2443 // the correct size for the rendered content of the multicol container. |
2444 if (useRegionBasedColumns() && renderer()->isLayoutFlowThread()) | 2444 if (useRegionBasedColumns() && layoutObject()->isLayoutFlowThread()) |
2445 return LayoutRect(); | 2445 return LayoutRect(); |
2446 | 2446 |
2447 LayoutRect result = clipper().localClipRect(); | 2447 LayoutRect result = clipper().localClipRect(); |
2448 if (result == LayoutRect::infiniteIntRect()) { | 2448 if (result == LayoutRect::infiniteIntRect()) { |
2449 LayoutPoint origin; | 2449 LayoutPoint origin; |
2450 result = physicalBoundingBox(ancestorLayer, &origin); | 2450 result = physicalBoundingBox(ancestorLayer, &origin); |
2451 | 2451 |
2452 const_cast<Layer*>(this)->stackingNode()->updateLayerListsIfNeeded(); | 2452 const_cast<Layer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
2453 | 2453 |
2454 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, | 2454 // Reflections are implemented with Layers that hang off of the reflecte
d layer. However, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 if (!m_compositedLayerMapping) | 2495 if (!m_compositedLayerMapping) |
2496 return NotComposited; | 2496 return NotComposited; |
2497 | 2497 |
2498 return PaintsIntoOwnBacking; | 2498 return PaintsIntoOwnBacking; |
2499 } | 2499 } |
2500 | 2500 |
2501 bool Layer::isAllowedToQueryCompositingState() const | 2501 bool Layer::isAllowedToQueryCompositingState() const |
2502 { | 2502 { |
2503 if (gCompositingQueryMode == CompositingQueriesAreAllowed) | 2503 if (gCompositingQueryMode == CompositingQueriesAreAllowed) |
2504 return true; | 2504 return true; |
2505 return renderer()->document().lifecycle().state() >= DocumentLifecycle::InCo
mpositingUpdate; | 2505 return layoutObject()->document().lifecycle().state() >= DocumentLifecycle::
InCompositingUpdate; |
2506 } | 2506 } |
2507 | 2507 |
2508 CompositedLayerMapping* Layer::compositedLayerMapping() const | 2508 CompositedLayerMapping* Layer::compositedLayerMapping() const |
2509 { | 2509 { |
2510 ASSERT(isAllowedToQueryCompositingState()); | 2510 ASSERT(isAllowedToQueryCompositingState()); |
2511 return m_compositedLayerMapping.get(); | 2511 return m_compositedLayerMapping.get(); |
2512 } | 2512 } |
2513 | 2513 |
2514 GraphicsLayer* Layer::graphicsLayerBacking() const | 2514 GraphicsLayer* Layer::graphicsLayerBacking() const |
2515 { | 2515 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 bool Layer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const | 2595 bool Layer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const |
2596 { | 2596 { |
2597 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 2597 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
2598 return false; | 2598 return false; |
2599 | 2599 |
2600 if (paintsWithTransparency(PaintBehaviorNormal)) | 2600 if (paintsWithTransparency(PaintBehaviorNormal)) |
2601 return false; | 2601 return false; |
2602 | 2602 |
2603 // We can't use hasVisibleContent(), because that will be true if our render
er is hidden, but some child | 2603 // We can't use hasVisibleContent(), because that will be true if our render
er is hidden, but some child |
2604 // is visible and that child doesn't cover the entire rect. | 2604 // is visible and that child doesn't cover the entire rect. |
2605 if (renderer()->style()->visibility() != VISIBLE) | 2605 if (layoutObject()->style()->visibility() != VISIBLE) |
2606 return false; | 2606 return false; |
2607 | 2607 |
2608 if (paintsWithFilters() && renderer()->style()->filter().hasFilterThatAffect
sOpacity()) | 2608 if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAf
fectsOpacity()) |
2609 return false; | 2609 return false; |
2610 | 2610 |
2611 // FIXME: Handle simple transforms. | 2611 // FIXME: Handle simple transforms. |
2612 if (paintsWithTransform(PaintBehaviorNormal)) | 2612 if (paintsWithTransform(PaintBehaviorNormal)) |
2613 return false; | 2613 return false; |
2614 | 2614 |
2615 // FIXME: Remove this check. | 2615 // FIXME: Remove this check. |
2616 // This function should not be called when layer-lists are dirty. | 2616 // This function should not be called when layer-lists are dirty. |
2617 // It is somehow getting triggered during style update. | 2617 // It is somehow getting triggered during style update. |
2618 if (m_stackingNode->zOrderListsDirty() || m_stackingNode->normalFlowListDirt
y()) | 2618 if (m_stackingNode->zOrderListsDirty() || m_stackingNode->normalFlowListDirt
y()) |
2619 return false; | 2619 return false; |
2620 | 2620 |
2621 // FIXME: We currently only check the immediate renderer, | 2621 // FIXME: We currently only check the immediate renderer, |
2622 // which will miss many cases. | 2622 // which will miss many cases. |
2623 if (renderer()->backgroundIsKnownToBeOpaqueInRect(localRect)) | 2623 if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect)) |
2624 return true; | 2624 return true; |
2625 | 2625 |
2626 // We can't consult child layers if we clip, since they might cover | 2626 // We can't consult child layers if we clip, since they might cover |
2627 // parts of the rect that are clipped out. | 2627 // parts of the rect that are clipped out. |
2628 if (renderer()->hasOverflowClip()) | 2628 if (layoutObject()->hasOverflowClip()) |
2629 return false; | 2629 return false; |
2630 | 2630 |
2631 return childBackgroundIsKnownToBeOpaqueInRect(localRect); | 2631 return childBackgroundIsKnownToBeOpaqueInRect(localRect); |
2632 } | 2632 } |
2633 | 2633 |
2634 bool Layer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 2634 bool Layer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
2635 { | 2635 { |
2636 LayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, PositiveZ
OrderChildren | NormalFlowChildren | NegativeZOrderChildren); | 2636 LayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, PositiveZ
OrderChildren | NormalFlowChildren | NegativeZOrderChildren); |
2637 while (LayerStackingNode* child = revertseIterator.next()) { | 2637 while (LayerStackingNode* child = revertseIterator.next()) { |
2638 const Layer* childLayer = child->layer(); | 2638 const Layer* childLayer = child->layer(); |
(...skipping 10 matching lines...) Expand all Loading... |
2649 childLocalRect.moveBy(-childOffset); | 2649 childLocalRect.moveBy(-childOffset); |
2650 | 2650 |
2651 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) | 2651 if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect)) |
2652 return true; | 2652 return true; |
2653 } | 2653 } |
2654 return false; | 2654 return false; |
2655 } | 2655 } |
2656 | 2656 |
2657 bool Layer::shouldBeSelfPaintingLayer() const | 2657 bool Layer::shouldBeSelfPaintingLayer() const |
2658 { | 2658 { |
2659 if (renderer()->isLayoutPart() && toLayoutPart(renderer())->requiresAccelera
tedCompositing()) | 2659 if (layoutObject()->isLayoutPart() && toLayoutPart(layoutObject())->requires
AcceleratedCompositing()) |
2660 return true; | 2660 return true; |
2661 return m_layerType == NormalLayer | 2661 return m_layerType == NormalLayer |
2662 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) | 2662 || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars()) |
2663 || needsCompositedScrolling(); | 2663 || needsCompositedScrolling(); |
2664 } | 2664 } |
2665 | 2665 |
2666 void Layer::updateSelfPaintingLayer() | 2666 void Layer::updateSelfPaintingLayer() |
2667 { | 2667 { |
2668 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); | 2668 bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); |
2669 if (this->isSelfPaintingLayer() == isSelfPaintingLayer) | 2669 if (this->isSelfPaintingLayer() == isSelfPaintingLayer) |
2670 return; | 2670 return; |
2671 | 2671 |
2672 m_isSelfPaintingLayer = isSelfPaintingLayer; | 2672 m_isSelfPaintingLayer = isSelfPaintingLayer; |
2673 | 2673 |
2674 if (parent()) | 2674 if (parent()) |
2675 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 2675 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
2676 } | 2676 } |
2677 | 2677 |
2678 bool Layer::hasNonEmptyChildRenderers() const | 2678 bool Layer::hasNonEmptyChildRenderers() const |
2679 { | 2679 { |
2680 // Some HTML can cause whitespace text nodes to have renderers, like: | 2680 // Some HTML can cause whitespace text nodes to have renderers, like: |
2681 // <div> | 2681 // <div> |
2682 // <img src=...> | 2682 // <img src=...> |
2683 // </div> | 2683 // </div> |
2684 // so test for 0x0 RenderTexts here | 2684 // so test for 0x0 RenderTexts here |
2685 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = chil
d->nextSibling()) { | 2685 for (LayoutObject* child = layoutObject()->slowFirstChild(); child; child =
child->nextSibling()) { |
2686 if (!child->hasLayer()) { | 2686 if (!child->hasLayer()) { |
2687 if (child->isLayoutInline() || !child->isBox()) | 2687 if (child->isLayoutInline() || !child->isBox()) |
2688 return true; | 2688 return true; |
2689 | 2689 |
2690 if (toLayoutBox(child)->size().width() > 0 || toLayoutBox(child)->si
ze().height() > 0) | 2690 if (toLayoutBox(child)->size().width() > 0 || toLayoutBox(child)->si
ze().height() > 0) |
2691 return true; | 2691 return true; |
2692 } | 2692 } |
2693 } | 2693 } |
2694 return false; | 2694 return false; |
2695 } | 2695 } |
2696 | 2696 |
2697 bool Layer::hasBoxDecorationsOrBackground() const | 2697 bool Layer::hasBoxDecorationsOrBackground() const |
2698 { | 2698 { |
2699 return renderer()->style()->hasBoxDecorations() || renderer()->style()->hasB
ackground(); | 2699 return layoutObject()->style()->hasBoxDecorations() || layoutObject()->style
()->hasBackground(); |
2700 } | 2700 } |
2701 | 2701 |
2702 bool Layer::hasVisibleBoxDecorations() const | 2702 bool Layer::hasVisibleBoxDecorations() const |
2703 { | 2703 { |
2704 if (!hasVisibleContent()) | 2704 if (!hasVisibleContent()) |
2705 return false; | 2705 return false; |
2706 | 2706 |
2707 return hasBoxDecorationsOrBackground() || hasOverflowControls(); | 2707 return hasBoxDecorationsOrBackground() || hasOverflowControls(); |
2708 } | 2708 } |
2709 | 2709 |
(...skipping 19 matching lines...) Expand all Loading... |
2729 // update. | 2729 // update. |
2730 | 2730 |
2731 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha
nged | StyleDifference::OpacityChanged)) | 2731 if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformCha
nged | StyleDifference::OpacityChanged)) |
2732 return false; | 2732 return false; |
2733 // The potentialCompositingReasonsFromStyle could have changed without | 2733 // The potentialCompositingReasonsFromStyle could have changed without |
2734 // a corresponding StyleDifference if an animation started or ended. | 2734 // a corresponding StyleDifference if an animation started or ended. |
2735 if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasons
FromStyle) | 2735 if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasons
FromStyle) |
2736 return false; | 2736 return false; |
2737 // We could add support for reflections if we updated the transform on | 2737 // We could add support for reflections if we updated the transform on |
2738 // the reflection layers. | 2738 // the reflection layers. |
2739 if (renderer()->hasReflection()) | 2739 if (layoutObject()->hasReflection()) |
2740 return false; | 2740 return false; |
2741 // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't | 2741 // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't |
2742 // perform a direct compositing update because the filters code is going | 2742 // perform a direct compositing update because the filters code is going |
2743 // to produce different output this time around. We can remove this code | 2743 // to produce different output this time around. We can remove this code |
2744 // once we fix the chicken/egg bugs in the filters code and delete the | 2744 // once we fix the chicken/egg bugs in the filters code and delete the |
2745 // scheduleSVGFilterLayerUpdateHack(). | 2745 // scheduleSVGFilterLayerUpdateHack(). |
2746 if (renderer()->node() && renderer()->node()->svgFilterNeedsLayerUpdate()) | 2746 if (layoutObject()->node() && layoutObject()->node()->svgFilterNeedsLayerUpd
ate()) |
2747 return false; | 2747 return false; |
2748 if (!m_compositedLayerMapping) | 2748 if (!m_compositedLayerMapping) |
2749 return false; | 2749 return false; |
2750 | 2750 |
2751 // To cut off almost all the work in the compositing update for | 2751 // To cut off almost all the work in the compositing update for |
2752 // this case, we treat inline transforms has having assumed overlap | 2752 // this case, we treat inline transforms has having assumed overlap |
2753 // (similar to how we treat animated transforms). Notice that we read | 2753 // (similar to how we treat animated transforms). Notice that we read |
2754 // CompositingReasonInlineTransform from the m_compositingReasons, which | 2754 // CompositingReasonInlineTransform from the m_compositingReasons, which |
2755 // means that the inline transform actually triggered assumed overlap in | 2755 // means that the inline transform actually triggered assumed overlap in |
2756 // the overlap map. | 2756 // the overlap map. |
2757 if (diff.transformChanged() && !(m_compositingReasons & CompositingReasonInl
ineTransform)) | 2757 if (diff.transformChanged() && !(m_compositingReasons & CompositingReasonInl
ineTransform)) |
2758 return false; | 2758 return false; |
2759 | 2759 |
2760 // We composite transparent Layers differently from non-transparent | 2760 // We composite transparent Layers differently from non-transparent |
2761 // Layers even when the non-transparent Layers are already a | 2761 // Layers even when the non-transparent Layers are already a |
2762 // stacking context. | 2762 // stacking context. |
2763 if (diff.opacityChanged() && m_renderer->style()->hasOpacity() != oldStyle->
hasOpacity()) | 2763 if (diff.opacityChanged() && m_renderer->style()->hasOpacity() != oldStyle->
hasOpacity()) |
2764 return false; | 2764 return false; |
2765 | 2765 |
2766 updateTransform(oldStyle, renderer()->styleRef()); | 2766 updateTransform(oldStyle, layoutObject()->styleRef()); |
2767 | 2767 |
2768 // FIXME: Consider introducing a smaller graphics layer update scope | 2768 // FIXME: Consider introducing a smaller graphics layer update scope |
2769 // that just handles transforms and opacity. GraphicsLayerUpdateLocal | 2769 // that just handles transforms and opacity. GraphicsLayerUpdateLocal |
2770 // will also program bounds, clips, and many other properties that could | 2770 // will also program bounds, clips, and many other properties that could |
2771 // not possibly have changed. | 2771 // not possibly have changed. |
2772 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLoc
al); | 2772 m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLoc
al); |
2773 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange
); | 2773 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange
); |
2774 return true; | 2774 return true; |
2775 } | 2775 } |
2776 | 2776 |
2777 void Layer::styleChanged(StyleDifference diff, const LayoutStyle* oldStyle) | 2777 void Layer::styleChanged(StyleDifference diff, const LayoutStyle* oldStyle) |
2778 { | 2778 { |
2779 if (attemptDirectCompositingUpdate(diff, oldStyle)) | 2779 if (attemptDirectCompositingUpdate(diff, oldStyle)) |
2780 return; | 2780 return; |
2781 | 2781 |
2782 m_stackingNode->updateIsNormalFlowOnly(); | 2782 m_stackingNode->updateIsNormalFlowOnly(); |
2783 m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle); | 2783 m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle); |
2784 | 2784 |
2785 if (m_scrollableArea) | 2785 if (m_scrollableArea) |
2786 m_scrollableArea->updateAfterStyleChange(oldStyle); | 2786 m_scrollableArea->updateAfterStyleChange(oldStyle); |
2787 | 2787 |
2788 // Overlay scrollbars can make this layer self-painting so we need | 2788 // Overlay scrollbars can make this layer self-painting so we need |
2789 // to recompute the bit once scrollbars have been updated. | 2789 // to recompute the bit once scrollbars have been updated. |
2790 updateSelfPaintingLayer(); | 2790 updateSelfPaintingLayer(); |
2791 | 2791 |
2792 if (!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle)) { | 2792 if (!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle
)) { |
2793 ASSERT(!oldStyle || diff.needsFullLayout()); | 2793 ASSERT(!oldStyle || diff.needsFullLayout()); |
2794 updateReflectionInfo(oldStyle); | 2794 updateReflectionInfo(oldStyle); |
2795 } | 2795 } |
2796 | 2796 |
2797 updateDescendantDependentFlags(); | 2797 updateDescendantDependentFlags(); |
2798 | 2798 |
2799 updateTransform(oldStyle, renderer()->styleRef()); | 2799 updateTransform(oldStyle, layoutObject()->styleRef()); |
2800 updateFilters(oldStyle, renderer()->styleRef()); | 2800 updateFilters(oldStyle, layoutObject()->styleRef()); |
2801 | 2801 |
2802 setNeedsCompositingInputsUpdate(); | 2802 setNeedsCompositingInputsUpdate(); |
2803 } | 2803 } |
2804 | 2804 |
2805 bool Layer::scrollsOverflow() const | 2805 bool Layer::scrollsOverflow() const |
2806 { | 2806 { |
2807 if (LayerScrollableArea* scrollableArea = this->scrollableArea()) | 2807 if (LayerScrollableArea* scrollableArea = this->scrollableArea()) |
2808 return scrollableArea->scrollsOverflow(); | 2808 return scrollableArea->scrollsOverflow(); |
2809 | 2809 |
2810 return false; | 2810 return false; |
2811 } | 2811 } |
2812 | 2812 |
2813 FilterOperations Layer::computeFilterOperations(const LayoutStyle& style) | 2813 FilterOperations Layer::computeFilterOperations(const LayoutStyle& style) |
2814 { | 2814 { |
2815 const FilterOperations& filters = style.filter(); | 2815 const FilterOperations& filters = style.filter(); |
2816 if (filters.hasReferenceFilter()) { | 2816 if (filters.hasReferenceFilter()) { |
2817 for (size_t i = 0; i < filters.size(); ++i) { | 2817 for (size_t i = 0; i < filters.size(); ++i) { |
2818 FilterOperation* filterOperation = filters.operations().at(i).get(); | 2818 FilterOperation* filterOperation = filters.operations().at(i).get(); |
2819 if (filterOperation->type() != FilterOperation::REFERENCE) | 2819 if (filterOperation->type() != FilterOperation::REFERENCE) |
2820 continue; | 2820 continue; |
2821 ReferenceFilterOperation* referenceOperation = toReferenceFilterOper
ation(filterOperation); | 2821 ReferenceFilterOperation* referenceOperation = toReferenceFilterOper
ation(filterOperation); |
2822 // FIXME: Cache the ReferenceFilter if it didn't change. | 2822 // FIXME: Cache the ReferenceFilter if it didn't change. |
2823 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
r::create(style.effectiveZoom()); | 2823 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte
r::create(style.effectiveZoom()); |
2824 referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referen
ceFilter.get(), renderer(), referenceFilter->sourceGraphic(), | 2824 referenceFilter->setLastEffect(ReferenceFilterBuilder::build(referen
ceFilter.get(), layoutObject(), referenceFilter->sourceGraphic(), |
2825 referenceOperation)); | 2825 referenceOperation)); |
2826 referenceOperation->setFilter(referenceFilter.release()); | 2826 referenceOperation->setFilter(referenceFilter.release()); |
2827 } | 2827 } |
2828 } | 2828 } |
2829 | 2829 |
2830 return filters; | 2830 return filters; |
2831 } | 2831 } |
2832 | 2832 |
2833 void Layer::updateOrRemoveFilterClients() | 2833 void Layer::updateOrRemoveFilterClients() |
2834 { | 2834 { |
2835 if (!hasFilter()) { | 2835 if (!hasFilter()) { |
2836 removeFilterInfoIfNeeded(); | 2836 removeFilterInfoIfNeeded(); |
2837 return; | 2837 return; |
2838 } | 2838 } |
2839 | 2839 |
2840 if (renderer()->style()->filter().hasReferenceFilter()) | 2840 if (layoutObject()->style()->filter().hasReferenceFilter()) |
2841 ensureFilterInfo()->updateReferenceFilterClients(renderer()->style()->fi
lter()); | 2841 ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style()
->filter()); |
2842 else if (hasFilterInfo()) | 2842 else if (hasFilterInfo()) |
2843 filterInfo()->removeReferenceFilterClients(); | 2843 filterInfo()->removeReferenceFilterClients(); |
2844 } | 2844 } |
2845 | 2845 |
2846 void Layer::updateOrRemoveFilterEffectRenderer() | 2846 void Layer::updateOrRemoveFilterEffectRenderer() |
2847 { | 2847 { |
2848 // FilterEffectRenderer is only used to render the filters in software mode, | 2848 // FilterEffectRenderer is only used to render the filters in software mode, |
2849 // so we always need to run updateOrRemoveFilterEffectRenderer after the com
posited | 2849 // so we always need to run updateOrRemoveFilterEffectRenderer after the com
posited |
2850 // mode might have changed for this layer. | 2850 // mode might have changed for this layer. |
2851 if (!paintsWithFilters()) { | 2851 if (!paintsWithFilters()) { |
2852 // Don't delete the whole filter info here, because we might use it | 2852 // Don't delete the whole filter info here, because we might use it |
2853 // for loading CSS shader files. | 2853 // for loading CSS shader files. |
2854 if (LayerFilterInfo* filterInfo = this->filterInfo()) | 2854 if (LayerFilterInfo* filterInfo = this->filterInfo()) |
2855 filterInfo->setRenderer(nullptr); | 2855 filterInfo->setRenderer(nullptr); |
2856 | 2856 |
2857 return; | 2857 return; |
2858 } | 2858 } |
2859 | 2859 |
2860 LayerFilterInfo* filterInfo = ensureFilterInfo(); | 2860 LayerFilterInfo* filterInfo = ensureFilterInfo(); |
2861 if (!filterInfo->renderer()) { | 2861 if (!filterInfo->layoutObject()) { |
2862 RefPtrWillBeRawPtr<FilterEffectRenderer> filterRenderer = FilterEffectRe
nderer::create(); | 2862 RefPtrWillBeRawPtr<FilterEffectRenderer> filterRenderer = FilterEffectRe
nderer::create(); |
2863 filterInfo->setRenderer(filterRenderer.release()); | 2863 filterInfo->setRenderer(filterRenderer.release()); |
2864 } | 2864 } |
2865 | 2865 |
2866 // If the filter fails to build, remove it from the layer. It will still att
empt to | 2866 // If the filter fails to build, remove it from the layer. It will still att
empt to |
2867 // go through regular processing (e.g. compositing), but never apply anythin
g. | 2867 // go through regular processing (e.g. compositing), but never apply anythin
g. |
2868 if (!filterInfo->renderer()->build(renderer(), computeFilterOperations(rende
rer()->styleRef()))) | 2868 if (!filterInfo->layoutObject()->build(layoutObject(), computeFilterOperatio
ns(layoutObject()->styleRef()))) |
2869 filterInfo->setRenderer(nullptr); | 2869 filterInfo->setRenderer(nullptr); |
2870 } | 2870 } |
2871 | 2871 |
2872 void Layer::filterNeedsPaintInvalidation() | 2872 void Layer::filterNeedsPaintInvalidation() |
2873 { | 2873 { |
2874 { | 2874 { |
2875 DeprecatedScheduleStyleRecalcDuringLayout marker(renderer()->document().
lifecycle()); | 2875 DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->documen
t().lifecycle()); |
2876 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl
e recalc, which | 2876 // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a styl
e recalc, which |
2877 // is a problem because this function can be called while performing lay
out. | 2877 // is a problem because this function can be called while performing lay
out. |
2878 // Presumably this represents an illegal data flow of layout or composit
ing | 2878 // Presumably this represents an illegal data flow of layout or composit
ing |
2879 // information into the style system. | 2879 // information into the style system. |
2880 toElement(renderer()->node())->scheduleSVGFilterLayerUpdateHack(); | 2880 toElement(layoutObject()->node())->scheduleSVGFilterLayerUpdateHack(); |
2881 } | 2881 } |
2882 | 2882 |
2883 renderer()->setShouldDoFullPaintInvalidation(); | 2883 layoutObject()->setShouldDoFullPaintInvalidation(); |
2884 } | 2884 } |
2885 | 2885 |
2886 void Layer::addLayerHitTestRects(LayerHitTestRects& rects) const | 2886 void Layer::addLayerHitTestRects(LayerHitTestRects& rects) const |
2887 { | 2887 { |
2888 computeSelfHitTestRects(rects); | 2888 computeSelfHitTestRects(rects); |
2889 for (Layer* child = firstChild(); child; child = child->nextSibling()) | 2889 for (Layer* child = firstChild(); child; child = child->nextSibling()) |
2890 child->addLayerHitTestRects(rects); | 2890 child->addLayerHitTestRects(rects); |
2891 } | 2891 } |
2892 | 2892 |
2893 void Layer::computeSelfHitTestRects(LayerHitTestRects& rects) const | 2893 void Layer::computeSelfHitTestRects(LayerHitTestRects& rects) const |
(...skipping 22 matching lines...) Expand all Loading... |
2916 } | 2916 } |
2917 } else { | 2917 } else { |
2918 rect.append(logicalBoundingBox()); | 2918 rect.append(logicalBoundingBox()); |
2919 rects.set(this, rect); | 2919 rects.set(this, rect); |
2920 } | 2920 } |
2921 } | 2921 } |
2922 } | 2922 } |
2923 | 2923 |
2924 void Layer::setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() | 2924 void Layer::setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants() |
2925 { | 2925 { |
2926 renderer()->setShouldDoFullPaintInvalidation(); | 2926 layoutObject()->setShouldDoFullPaintInvalidation(); |
2927 | 2927 |
2928 // Disable for reading compositingState() in isPaintInvalidationContainer()
below. | 2928 // Disable for reading compositingState() in isPaintInvalidationContainer()
below. |
2929 DisableCompositingQueryAsserts disabler; | 2929 DisableCompositingQueryAsserts disabler; |
2930 | 2930 |
2931 for (Layer* child = firstChild(); child; child = child->nextSibling()) { | 2931 for (Layer* child = firstChild(); child; child = child->nextSibling()) { |
2932 if (!child->isPaintInvalidationContainer()) | 2932 if (!child->isPaintInvalidationContainer()) |
2933 child->setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants(); | 2933 child->setShouldDoFullPaintInvalidationIncludingNonCompositingDescen
dants(); |
2934 } | 2934 } |
2935 } | 2935 } |
2936 | 2936 |
2937 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() | 2937 DisableCompositingQueryAsserts::DisableCompositingQueryAsserts() |
2938 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { } | 2938 : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { } |
2939 | 2939 |
2940 } // namespace blink | 2940 } // namespace blink |
2941 | 2941 |
2942 #ifndef NDEBUG | 2942 #ifndef NDEBUG |
2943 void showLayerTree(const blink::Layer* layer) | 2943 void showLayerTree(const blink::Layer* layer) |
2944 { | 2944 { |
2945 if (!layer) | 2945 if (!layer) |
2946 return; | 2946 return; |
2947 | 2947 |
2948 if (blink::LocalFrame* frame = layer->renderer()->frame()) { | 2948 if (blink::LocalFrame* frame = layer->layoutObject()->frame()) { |
2949 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh
owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo
sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla
ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); | 2949 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh
owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo
sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla
ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); |
2950 fprintf(stderr, "%s\n", output.utf8().data()); | 2950 fprintf(stderr, "%s\n", output.utf8().data()); |
2951 } | 2951 } |
2952 } | 2952 } |
2953 | 2953 |
2954 void showLayerTree(const blink::LayoutObject* renderer) | 2954 void showLayerTree(const blink::LayoutObject* renderer) |
2955 { | 2955 { |
2956 if (!renderer) | 2956 if (!renderer) |
2957 return; | 2957 return; |
2958 showLayerTree(renderer->enclosingLayer()); | 2958 showLayerTree(renderer->enclosingLayer()); |
2959 } | 2959 } |
2960 #endif | 2960 #endif |
OLD | NEW |