Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: Source/core/layout/Layer.cpp

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

Powered by Google App Engine
This is Rietveld 408576698