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

Side by Side Diff: sky/engine/core/rendering/RenderBoxModelObject.cpp

Issue 953673002: Delete RenderLayerModelObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // FIXME: We should consider whether it is OK propagating to ancestor Render Inlines. 57 // FIXME: We should consider whether it is OK propagating to ancestor Render Inlines.
58 // This is a workaround for http://webkit.org/b/32123 58 // This is a workaround for http://webkit.org/b/32123
59 // The containing block can be null in case of an orphaned tree. 59 // The containing block can be null in case of an orphaned tree.
60 RenderBlock* containingBlock = this->containingBlock(); 60 RenderBlock* containingBlock = this->containingBlock();
61 if (containingBlock && !containingBlock->isRenderView()) 61 if (containingBlock && !containingBlock->isRenderView())
62 containingBlock->setSelectionState(state); 62 containingBlock->setSelectionState(state);
63 } 63 }
64 64
65 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node) 65 RenderBoxModelObject::RenderBoxModelObject(ContainerNode* node)
66 : RenderLayerModelObject(node) 66 : RenderObject(node)
67 { 67 {
68 } 68 }
69 69
70 RenderBoxModelObject::~RenderBoxModelObject() 70 RenderBoxModelObject::~RenderBoxModelObject()
71 { 71 {
72 } 72 }
73 73
74 bool RenderBoxModelObject::calculateHasBoxDecorations() const
75 {
76 RenderStyle* styleToUse = style();
77 ASSERT(styleToUse);
78 return hasBackground() || styleToUse->hasBorder() || styleToUse->boxShadow() ;
79 }
80
81 void RenderBoxModelObject::updateFromStyle()
82 {
83 RenderLayerModelObject::updateFromStyle();
84
85 RenderStyle* styleToUse = style();
86 setHasBoxDecorationBackground(calculateHasBoxDecorations());
87 setInline(styleToUse->isDisplayInlineType());
88 setPositionState(styleToUse->position());
89 }
90
91 bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const 74 bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const
92 { 75 {
93 Length logicalHeightLength = style()->logicalHeight(); 76 Length logicalHeightLength = style()->logicalHeight();
94 if (logicalHeightLength.isAuto()) 77 if (logicalHeightLength.isAuto())
95 return true; 78 return true;
96 79
97 // For percentage heights: The percentage is calculated with respect to the height of the generated box's 80 // For percentage heights: The percentage is calculated with respect to the height of the generated box's
98 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends 81 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
99 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'. 82 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'.
100 // FIXME(sky): We might want to make height: 100% be sensible. 83 // FIXME(sky): We might want to make height: 100% be sensible.
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 { 631 {
649 int numberOfTiles = areaSize / tileSize; 632 int numberOfTiles = areaSize / tileSize;
650 int space = -1; 633 int space = -1;
651 634
652 if (numberOfTiles > 1) 635 if (numberOfTiles > 1)
653 space = lroundf((float)(areaSize - numberOfTiles * tileSize) / (numberOf Tiles - 1)); 636 space = lroundf((float)(areaSize - numberOfTiles * tileSize) / (numberOf Tiles - 1));
654 637
655 return space; 638 return space;
656 } 639 }
657 640
658 void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderLayerMod elObject* paintContainer, const FillLayer& fillLayer, const LayoutRect& paintRec t, 641 void RenderBoxModelObject::calculateBackgroundImageGeometry(const RenderBox* pai ntContainer, const FillLayer& fillLayer, const LayoutRect& paintRect,
659 BackgroundImageGeometry& geometry, RenderObject* backgroundObject) const 642 BackgroundImageGeometry& geometry, RenderObject* backgroundObject) const
660 { 643 {
661 LayoutUnit left = 0; 644 LayoutUnit left = 0;
662 LayoutUnit top = 0; 645 LayoutUnit top = 0;
663 IntSize positioningAreaSize; 646 IntSize positioningAreaSize;
664 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); 647 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect);
665 648
666 // Determine the background positioning area and set destRect to the backgro und painting area. 649 // Determine the background positioning area and set destRect to the backgro und painting area.
667 // destRect will be adjusted later if the background is non-repeating. 650 // destRect will be adjusted later if the background is non-repeating.
668 // FIXME: transforms spec says that fixed backgrounds behave like scroll ins ide transforms. 651 // FIXME: transforms spec says that fixed backgrounds behave like scroll ins ide transforms.
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 2307
2325 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D()); 2308 bool preserve3D = mode & UseTransforms && (o->style()->preserves3D() || styl e()->preserves3D());
2326 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) { 2309 if (mode & UseTransforms && shouldUseTransformFromContainer(o)) {
2327 TransformationMatrix t; 2310 TransformationMatrix t;
2328 getTransformFromContainer(o, containerOffset, t); 2311 getTransformFromContainer(o, containerOffset, t);
2329 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); 2312 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform);
2330 } else 2313 } else
2331 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); 2314 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm);
2332 } 2315 }
2333 2316
2334 const RenderObject* RenderBoxModelObject::pushMappingToContainer(const RenderLay erModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const 2317 const RenderObject* RenderBoxModelObject::pushMappingToContainer(const RenderBox * ancestorToStopAt, RenderGeometryMap& geometryMap) const
2335 { 2318 {
2336 ASSERT(ancestorToStopAt != this); 2319 ASSERT(ancestorToStopAt != this);
2337 2320
2338 bool ancestorSkipped; 2321 bool ancestorSkipped;
2339 RenderObject* container = this->container(ancestorToStopAt, &ancestorSkipped ); 2322 RenderObject* container = this->container(ancestorToStopAt, &ancestorSkipped );
2340 if (!container) 2323 if (!container)
2341 return 0; 2324 return 0;
2342 2325
2343 bool isInline = isRenderInline(); 2326 bool isInline = isRenderInline();
2344 bool hasTransform = !isInline && hasLayer() && layer()->transform(); 2327 bool hasTransform = !isInline && hasLayer() && toRenderBox(this)->layer()->t ransform();
2345 2328
2346 LayoutSize adjustmentForSkippedAncestor; 2329 LayoutSize adjustmentForSkippedAncestor;
2347 if (ancestorSkipped) { 2330 if (ancestorSkipped) {
2348 // There can't be a transform between paintInvalidationContainer and o, because transforms create containers, so it should be safe 2331 // There can't be a transform between paintInvalidationContainer and o, because transforms create containers, so it should be safe
2349 // to just subtract the delta between the ancestor and o. 2332 // to just subtract the delta between the ancestor and o.
2350 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont ainer(container); 2333 adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorCont ainer(container);
2351 } 2334 }
2352 2335
2353 bool offsetDependsOnPoint = false; 2336 bool offsetDependsOnPoint = false;
2354 LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), & offsetDependsOnPoint); 2337 LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), & offsetDependsOnPoint);
2355 2338
2356 bool preserve3D = container->style()->preserves3D() || style()->preserves3D( ); 2339 bool preserve3D = container->style()->preserves3D() || style()->preserves3D( );
2357 if (shouldUseTransformFromContainer(container)) { 2340 if (shouldUseTransformFromContainer(container)) {
2358 TransformationMatrix t; 2341 TransformationMatrix t;
2359 getTransformFromContainer(container, containerOffset, t); 2342 getTransformFromContainer(container, containerOffset, t);
2360 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm entForSkippedAncestor.height().toFloat()); 2343 t.translateRight(adjustmentForSkippedAncestor.width().toFloat(), adjustm entForSkippedAncestor.height().toFloat());
2361 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, hasTransform ); 2344 geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, hasTransform );
2362 } else { 2345 } else {
2363 containerOffset += adjustmentForSkippedAncestor; 2346 containerOffset += adjustmentForSkippedAncestor;
2364 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint , hasTransform); 2347 geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint , hasTransform);
2365 } 2348 }
2366 2349
2367 return ancestorSkipped ? ancestorToStopAt : container; 2350 return ancestorSkipped ? ancestorToStopAt : container;
2368 } 2351 }
2369 2352
2353 void RenderBoxModelObject::collectSelfPaintingLayers(Vector<RenderBox*>& layers)
2354 {
2355 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
2356 if (child->isBox()) {
2357 RenderBox* childBox = toRenderBox(child);
2358 if (childBox->hasSelfPaintingLayer())
2359 layers.append(childBox);
2360 else
2361 childBox->collectSelfPaintingLayers(layers);
2362 } else if (child->isBoxModelObject()) {
2363 toRenderBoxModelObject(child)->collectSelfPaintingLayers(layers);
2364 }
2365 }
2366 }
2367
2370 void RenderBoxModelObject::moveChildTo(RenderBoxModelObject* toBoxModelObject, R enderObject* child, RenderObject* beforeChild, bool fullRemoveInsert) 2368 void RenderBoxModelObject::moveChildTo(RenderBoxModelObject* toBoxModelObject, R enderObject* child, RenderObject* beforeChild, bool fullRemoveInsert)
2371 { 2369 {
2372 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the 2370 // We assume that callers have cleared their positioned objects list for chi ld moves (!fullRemoveInsert) so the
2373 // positioned renderer maps don't become stale. It would be too slow to do t he map lookup on each call. 2371 // positioned renderer maps don't become stale. It would be too slow to do t he map lookup on each call.
2374 ASSERT(!fullRemoveInsert || !isRenderBlock() || !toRenderBlock(this)->hasPos itionedObjects()); 2372 ASSERT(!fullRemoveInsert || !isRenderBlock() || !toRenderBlock(this)->hasPos itionedObjects());
2375 2373
2376 ASSERT(this == child->parent()); 2374 ASSERT(this == child->parent());
2377 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2375 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2378 if (fullRemoveInsert && (toBoxModelObject->isRenderBlock() || toBoxModelObje ct->isRenderInline())) { 2376 if (fullRemoveInsert && (toBoxModelObject->isRenderBlock() || toBoxModelObje ct->isRenderInline())) {
2379 // Takes care of adding the new child correctly if toBlock and fromBlock 2377 // Takes care of adding the new child correctly if toBlock and fromBlock
(...skipping 16 matching lines...) Expand all
2396 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2394 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2397 for (RenderObject* child = slowFirstChild(); child; ) { 2395 for (RenderObject* child = slowFirstChild(); child; ) {
2398 // Save our next sibling as moveChildTo will clear it. 2396 // Save our next sibling as moveChildTo will clear it.
2399 RenderObject* nextSibling = child->nextSibling(); 2397 RenderObject* nextSibling = child->nextSibling();
2400 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2398 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2401 child = nextSibling; 2399 child = nextSibling;
2402 } 2400 }
2403 } 2401 }
2404 2402
2405 } // namespace blink 2403 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBoxModelObject.h ('k') | sky/engine/core/rendering/RenderGeometryMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698