| OLD | NEW |
| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 class FloatStateForStyleChange { | 90 class FloatStateForStyleChange { |
| 91 public: | 91 public: |
| 92 static void setWasFloating(LayoutBoxModelObject* boxModelObject, | 92 static void setWasFloating(LayoutBoxModelObject* boxModelObject, |
| 93 bool wasFloating) { | 93 bool wasFloating) { |
| 94 s_wasFloating = wasFloating; | 94 s_wasFloating = wasFloating; |
| 95 s_boxModelObject = boxModelObject; | 95 s_boxModelObject = boxModelObject; |
| 96 } | 96 } |
| 97 | 97 |
| 98 static bool wasFloating(LayoutBoxModelObject* boxModelObject) { | 98 static bool wasFloating(LayoutBoxModelObject* boxModelObject) { |
| 99 ASSERT(boxModelObject == s_boxModelObject); | 99 DCHECK_EQ(boxModelObject, s_boxModelObject); |
| 100 return s_wasFloating; | 100 return s_wasFloating; |
| 101 } | 101 } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 // Used to store state between styleWillChange and styleDidChange | 104 // Used to store state between styleWillChange and styleDidChange |
| 105 static bool s_wasFloating; | 105 static bool s_wasFloating; |
| 106 static LayoutBoxModelObject* s_boxModelObject; | 106 static LayoutBoxModelObject* s_boxModelObject; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 bool FloatStateForStyleChange::s_wasFloating = false; | 109 bool FloatStateForStyleChange::s_wasFloating = false; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 continue; | 227 continue; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 return BackgroundPaintInGraphicsLayer; | 230 return BackgroundPaintInGraphicsLayer; |
| 231 } | 231 } |
| 232 return paintLocation; | 232 return paintLocation; |
| 233 } | 233 } |
| 234 | 234 |
| 235 LayoutBoxModelObject::~LayoutBoxModelObject() { | 235 LayoutBoxModelObject::~LayoutBoxModelObject() { |
| 236 // Our layer should have been destroyed and cleared by now | 236 // Our layer should have been destroyed and cleared by now |
| 237 ASSERT(!hasLayer()); | 237 DCHECK(!hasLayer()); |
| 238 ASSERT(!m_layer); | 238 DCHECK(!m_layer); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void LayoutBoxModelObject::willBeDestroyed() { | 241 void LayoutBoxModelObject::willBeDestroyed() { |
| 242 ImageQualityController::remove(*this); | 242 ImageQualityController::remove(*this); |
| 243 | 243 |
| 244 // A continuation of this LayoutObject should be destroyed at subclasses. | 244 // A continuation of this LayoutObject should be destroyed at subclasses. |
| 245 ASSERT(!continuation()); | 245 DCHECK(!continuation()); |
| 246 | 246 |
| 247 if (isPositioned()) { | 247 if (isPositioned()) { |
| 248 // Don't use this->view() because the document's layoutView has been set to | 248 // Don't use this->view() because the document's layoutView has been set to |
| 249 // 0 during destruction. | 249 // 0 during destruction. |
| 250 if (LocalFrame* frame = this->frame()) { | 250 if (LocalFrame* frame = this->frame()) { |
| 251 if (FrameView* frameView = frame->view()) { | 251 if (FrameView* frameView = frame->view()) { |
| 252 if (style()->hasViewportConstrainedPosition()) | 252 if (style()->hasViewportConstrainedPosition()) |
| 253 frameView->removeViewportConstrainedObject(*this); | 253 frameView->removeViewportConstrainedObject(*this); |
| 254 } | 254 } |
| 255 } | 255 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // as if we have saved constraints for this layer they were saved in the | 493 // as if we have saved constraints for this layer they were saved in the |
| 494 // previous frame. | 494 // previous frame. |
| 495 DisableCompositingQueryAsserts disabler; | 495 DisableCompositingQueryAsserts disabler; |
| 496 if (const PaintLayer* ancestorOverflowLayer = | 496 if (const PaintLayer* ancestorOverflowLayer = |
| 497 enclosing->ancestorOverflowLayer()) | 497 enclosing->ancestorOverflowLayer()) |
| 498 ancestorOverflowLayer->getScrollableArea() | 498 ancestorOverflowLayer->getScrollableArea() |
| 499 ->invalidateAllStickyConstraints(); | 499 ->invalidateAllStickyConstraints(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void LayoutBoxModelObject::createLayer() { | 502 void LayoutBoxModelObject::createLayer() { |
| 503 ASSERT(!m_layer); | 503 DCHECK(!m_layer); |
| 504 m_layer = WTF::makeUnique<PaintLayer>(*this); | 504 m_layer = WTF::makeUnique<PaintLayer>(*this); |
| 505 setHasLayer(true); | 505 setHasLayer(true); |
| 506 m_layer->insertOnlyThisLayerAfterStyleChange(); | 506 m_layer->insertOnlyThisLayerAfterStyleChange(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void LayoutBoxModelObject::destroyLayer() { | 509 void LayoutBoxModelObject::destroyLayer() { |
| 510 setHasLayer(false); | 510 setHasLayer(false); |
| 511 m_layer = nullptr; | 511 m_layer = nullptr; |
| 512 } | 512 } |
| 513 | 513 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 object = object->nextInPreOrder(object)) { | 660 object = object->nextInPreOrder(object)) { |
| 661 if (object->isBox()) { | 661 if (object->isBox()) { |
| 662 const LayoutBox& box = toLayoutBox(*object); | 662 const LayoutBox& box = toLayoutBox(*object); |
| 663 if (box.logicalHeight() && box.logicalWidth()) | 663 if (box.logicalHeight() && box.logicalWidth()) |
| 664 return true; | 664 return true; |
| 665 } else if (object->isLayoutInline()) { | 665 } else if (object->isLayoutInline()) { |
| 666 const LayoutInline& layoutInline = toLayoutInline(*object); | 666 const LayoutInline& layoutInline = toLayoutInline(*object); |
| 667 if (!layoutInline.linesBoundingBox().isEmpty()) | 667 if (!layoutInline.linesBoundingBox().isEmpty()) |
| 668 return true; | 668 return true; |
| 669 } else { | 669 } else { |
| 670 ASSERT(object->isText()); | 670 DCHECK(object->isText()); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 return false; | 674 return false; |
| 675 } | 675 } |
| 676 | 676 |
| 677 void LayoutBoxModelObject::absoluteQuadsForSelf( | 677 void LayoutBoxModelObject::absoluteQuadsForSelf( |
| 678 Vector<FloatQuad>& quads, | 678 Vector<FloatQuad>& quads, |
| 679 MapCoordinatesFlags mode) const { | 679 MapCoordinatesFlags mode) const { |
| 680 NOTREACHED(); | 680 NOTREACHED(); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const { | 1215 LayoutUnit LayoutBoxModelObject::containingBlockLogicalWidthForContent() const { |
| 1216 return containingBlock()->availableLogicalWidth(); | 1216 return containingBlock()->availableLogicalWidth(); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const { | 1219 LayoutBoxModelObject* LayoutBoxModelObject::continuation() const { |
| 1220 return (!continuationMap) ? nullptr : continuationMap->at(this); | 1220 return (!continuationMap) ? nullptr : continuationMap->at(this); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) { | 1223 void LayoutBoxModelObject::setContinuation(LayoutBoxModelObject* continuation) { |
| 1224 if (continuation) { | 1224 if (continuation) { |
| 1225 ASSERT(continuation->isLayoutInline() || continuation->isLayoutBlockFlow()); | 1225 DCHECK(continuation->isLayoutInline() || continuation->isLayoutBlockFlow()); |
| 1226 if (!continuationMap) | 1226 if (!continuationMap) |
| 1227 continuationMap = new ContinuationMap; | 1227 continuationMap = new ContinuationMap; |
| 1228 continuationMap->set(this, continuation); | 1228 continuationMap->set(this, continuation); |
| 1229 } else { | 1229 } else { |
| 1230 if (continuationMap) | 1230 if (continuationMap) |
| 1231 continuationMap->erase(this); | 1231 continuationMap->erase(this); |
| 1232 } | 1232 } |
| 1233 } | 1233 } |
| 1234 | 1234 |
| 1235 void LayoutBoxModelObject::computeLayerHitTestRects( | 1235 void LayoutBoxModelObject::computeLayerHitTestRects( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 height; | 1320 height; |
| 1321 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); | 1321 LayoutUnit y = paddingTop() + borderTop() + (verticalSpace / 2); |
| 1322 return currentStyle.isHorizontalWritingMode() | 1322 return currentStyle.isHorizontalWritingMode() |
| 1323 ? LayoutRect(x, y, caretWidth, height) | 1323 ? LayoutRect(x, y, caretWidth, height) |
| 1324 : LayoutRect(y, x, height, caretWidth); | 1324 : LayoutRect(y, x, height, caretWidth); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer( | 1327 const LayoutObject* LayoutBoxModelObject::pushMappingToContainer( |
| 1328 const LayoutBoxModelObject* ancestorToStopAt, | 1328 const LayoutBoxModelObject* ancestorToStopAt, |
| 1329 LayoutGeometryMap& geometryMap) const { | 1329 LayoutGeometryMap& geometryMap) const { |
| 1330 ASSERT(ancestorToStopAt != this); | 1330 DCHECK_NE(ancestorToStopAt, this); |
| 1331 | 1331 |
| 1332 AncestorSkipInfo skipInfo(ancestorToStopAt); | 1332 AncestorSkipInfo skipInfo(ancestorToStopAt); |
| 1333 LayoutObject* container = this->container(&skipInfo); | 1333 LayoutObject* container = this->container(&skipInfo); |
| 1334 if (!container) | 1334 if (!container) |
| 1335 return nullptr; | 1335 return nullptr; |
| 1336 | 1336 |
| 1337 bool isInline = isLayoutInline(); | 1337 bool isInline = isLayoutInline(); |
| 1338 bool isFixedPos = !isInline && style()->position() == EPosition::kFixed; | 1338 bool isFixedPos = !isInline && style()->position() == EPosition::kFixed; |
| 1339 bool containsFixedPosition = canContainFixedPositionObjects(); | 1339 bool containsFixedPosition = canContainFixedPositionObjects(); |
| 1340 | 1340 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 return skipInfo.ancestorSkipped() ? ancestorToStopAt : container; | 1382 return skipInfo.ancestorSkipped() ? ancestorToStopAt : container; |
| 1383 } | 1383 } |
| 1384 | 1384 |
| 1385 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, | 1385 void LayoutBoxModelObject::moveChildTo(LayoutBoxModelObject* toBoxModelObject, |
| 1386 LayoutObject* child, | 1386 LayoutObject* child, |
| 1387 LayoutObject* beforeChild, | 1387 LayoutObject* beforeChild, |
| 1388 bool fullRemoveInsert) { | 1388 bool fullRemoveInsert) { |
| 1389 // We assume that callers have cleared their positioned objects list for child | 1389 // We assume that callers have cleared their positioned objects list for child |
| 1390 // moves (!fullRemoveInsert) so the positioned layoutObject maps don't become | 1390 // moves (!fullRemoveInsert) so the positioned layoutObject maps don't become |
| 1391 // stale. It would be too slow to do the map lookup on each call. | 1391 // stale. It would be too slow to do the map lookup on each call. |
| 1392 ASSERT(!fullRemoveInsert || !isLayoutBlock() || | 1392 DCHECK(!fullRemoveInsert || !isLayoutBlock() || |
| 1393 !toLayoutBlock(this)->hasPositionedObjects()); | 1393 !toLayoutBlock(this)->hasPositionedObjects()); |
| 1394 | 1394 |
| 1395 ASSERT(this == child->parent()); | 1395 DCHECK_EQ(this, child->parent()); |
| 1396 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 1396 DCHECK(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 1397 | 1397 |
| 1398 // If a child is moving from a block-flow to an inline-flow parent then any | 1398 // If a child is moving from a block-flow to an inline-flow parent then any |
| 1399 // floats currently intruding into the child can no longer do so. This can | 1399 // floats currently intruding into the child can no longer do so. This can |
| 1400 // happen if a block becomes floating or out-of-flow and is moved to an | 1400 // happen if a block becomes floating or out-of-flow and is moved to an |
| 1401 // anonymous block. Remove all floats from their float-lists immediately as | 1401 // anonymous block. Remove all floats from their float-lists immediately as |
| 1402 // markAllDescendantsWithFloatsForLayout won't attempt to remove floats from | 1402 // markAllDescendantsWithFloatsForLayout won't attempt to remove floats from |
| 1403 // parents that have inline-flow if we try later. | 1403 // parents that have inline-flow if we try later. |
| 1404 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && | 1404 if (child->isLayoutBlockFlow() && toBoxModelObject->childrenInline() && |
| 1405 !childrenInline()) { | 1405 !childrenInline()) { |
| 1406 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants(); | 1406 toLayoutBlockFlow(child)->removeFloatingObjectsFromDescendants(); |
| 1407 ASSERT(!toLayoutBlockFlow(child)->containsFloats()); | 1407 DCHECK(!toLayoutBlockFlow(child)->containsFloats()); |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 if (fullRemoveInsert && isLayoutBlock() && child->isBox()) | 1410 if (fullRemoveInsert && isLayoutBlock() && child->isBox()) |
| 1411 toLayoutBox(child)->removeFromPercentHeightContainer(); | 1411 toLayoutBox(child)->removeFromPercentHeightContainer(); |
| 1412 | 1412 |
| 1413 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || | 1413 if (fullRemoveInsert && (toBoxModelObject->isLayoutBlock() || |
| 1414 toBoxModelObject->isLayoutInline())) { | 1414 toBoxModelObject->isLayoutInline())) { |
| 1415 // Takes care of adding the new child correctly if toBlock and fromBlock | 1415 // Takes care of adding the new child correctly if toBlock and fromBlock |
| 1416 // have different kind of children (block vs inline). | 1416 // have different kind of children (block vs inline). |
| 1417 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, child), | 1417 toBoxModelObject->addChild(virtualChildren()->removeChildNode(this, child), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1434 // anonymous blocks which can no longer carry positioned objects (see r120761) | 1434 // anonymous blocks which can no longer carry positioned objects (see r120761) |
| 1435 // or when fullRemoveInsert is false. | 1435 // or when fullRemoveInsert is false. |
| 1436 if (fullRemoveInsert && isLayoutBlock()) { | 1436 if (fullRemoveInsert && isLayoutBlock()) { |
| 1437 LayoutBlock* block = toLayoutBlock(this); | 1437 LayoutBlock* block = toLayoutBlock(this); |
| 1438 block->removePositionedObjects(nullptr); | 1438 block->removePositionedObjects(nullptr); |
| 1439 block->removeFromPercentHeightContainer(); | 1439 block->removeFromPercentHeightContainer(); |
| 1440 if (block->isLayoutBlockFlow()) | 1440 if (block->isLayoutBlockFlow()) |
| 1441 toLayoutBlockFlow(block)->removeFloatingObjects(); | 1441 toLayoutBlockFlow(block)->removeFloatingObjects(); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); | 1444 DCHECK(!beforeChild || toBoxModelObject == beforeChild->parent()); |
| 1445 for (LayoutObject* child = startChild; child && child != endChild;) { | 1445 for (LayoutObject* child = startChild; child && child != endChild;) { |
| 1446 // Save our next sibling as moveChildTo will clear it. | 1446 // Save our next sibling as moveChildTo will clear it. |
| 1447 LayoutObject* nextSibling = child->nextSibling(); | 1447 LayoutObject* nextSibling = child->nextSibling(); |
| 1448 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); | 1448 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); |
| 1449 child = nextSibling; | 1449 child = nextSibling; |
| 1450 } | 1450 } |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 bool LayoutBoxModelObject::backgroundStolenForBeingBody( | 1453 bool LayoutBoxModelObject::backgroundStolenForBeingBody( |
| 1454 const ComputedStyle* rootElementStyle) const { | 1454 const ComputedStyle* rootElementStyle) const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1468 if (rootElementStyle->hasBackground()) | 1468 if (rootElementStyle->hasBackground()) |
| 1469 return false; | 1469 return false; |
| 1470 | 1470 |
| 1471 if (node() != document().firstBodyElement()) | 1471 if (node() != document().firstBodyElement()) |
| 1472 return false; | 1472 return false; |
| 1473 | 1473 |
| 1474 return true; | 1474 return true; |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 } // namespace blink | 1477 } // namespace blink |
| OLD | NEW |