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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 178473024: Convert some Shape code to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase with 185393015 Created 6 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
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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1393
1394 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*) 1394 void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*)
1395 { 1395 {
1396 RenderBox::imageChanged(image); 1396 RenderBox::imageChanged(image);
1397 1397
1398 if (!parent() || !everHadLayout()) 1398 if (!parent() || !everHadLayout())
1399 return; 1399 return;
1400 1400
1401 ShapeValue* shapeValue = style()->shapeInside(); 1401 ShapeValue* shapeValue = style()->shapeInside();
1402 if (shapeValue && shapeValue->image() && shapeValue->image()->data() == imag e) { 1402 if (shapeValue && shapeValue->image() && shapeValue->image()->data() == imag e) {
1403 ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo(); 1403 ShapeInsideInfo& shapeInsideInfo = ensureShapeInsideInfo();
1404 shapeInsideInfo->dirtyShapeSize(); 1404 shapeInsideInfo.markShapeAsDirty();
1405 markShapeInsideDescendantsForLayout(); 1405 markShapeInsideDescendantsForLayout();
1406 } 1406 }
1407 } 1407 }
1408 1408
1409 void RenderBlock::updateShapeInsideInfoAfterStyleChange(const ShapeValue* shapeI nside, const ShapeValue* oldShapeInside) 1409 void RenderBlock::updateShapeInsideInfoAfterStyleChange(const ShapeValue* shapeI nside, const ShapeValue* oldShapeInside)
1410 { 1410 {
1411 // FIXME: A future optimization would do a deep comparison for equality. 1411 // FIXME: A future optimization would do a deep comparison for equality.
1412 if (shapeInside == oldShapeInside) 1412 if (shapeInside == oldShapeInside)
1413 return; 1413 return;
1414 1414
1415 if (shapeInside) { 1415 if (shapeInside) {
1416 ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo(); 1416 ShapeInsideInfo& shapeInsideInfo = ensureShapeInsideInfo();
1417 shapeInsideInfo->dirtyShapeSize(); 1417 shapeInsideInfo.markShapeAsDirty();
1418 } else { 1418 } else {
1419 setShapeInsideInfo(nullptr); 1419 setShapeInsideInfo(nullptr);
1420 markShapeInsideDescendantsForLayout(); 1420 markShapeInsideDescendantsForLayout();
1421 } 1421 }
1422 } 1422 }
1423 1423
1424 static inline bool shapeInfoRequiresRelayout(const RenderBlock* block) 1424 static inline bool shapeInfoRequiresRelayout(const RenderBlock* block)
1425 { 1425 {
1426 ShapeInsideInfo* info = block->shapeInsideInfo(); 1426 ShapeInsideInfo* info = block->shapeInsideInfo();
1427 if (info) 1427 if (info)
1428 info->setNeedsLayout(info->shapeSizeDirty()); 1428 info->setNeedsLayout(info->isShapeDirty());
1429 else 1429 else
1430 info = block->layoutShapeInsideInfo(); 1430 info = block->layoutShapeInsideInfo();
1431 return info && info->needsLayout(); 1431 return info && info->needsLayout();
1432 } 1432 }
1433 1433
1434 bool RenderBlock::updateRegionsAndShapesLogicalSize(RenderFlowThread* flowThread ) 1434 bool RenderBlock::updateRegionsAndShapesLogicalSize(RenderFlowThread* flowThread )
1435 { 1435 {
1436 if (!flowThread && !shapeInsideInfo()) 1436 if (!flowThread && !shapeInsideInfo())
1437 return shapeInfoRequiresRelayout(this); 1437 return shapeInfoRequiresRelayout(this);
1438 1438
(...skipping 17 matching lines...) Expand all
1456 return shapeInfoRequiresRelayout(this); 1456 return shapeInfoRequiresRelayout(this);
1457 } 1457 }
1458 1458
1459 void RenderBlock::computeShapeSize() 1459 void RenderBlock::computeShapeSize()
1460 { 1460 {
1461 ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo(); 1461 ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo();
1462 if (!shapeInsideInfo) 1462 if (!shapeInsideInfo)
1463 return; 1463 return;
1464 1464
1465 bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvable FromBlock(this, false); 1465 bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvable FromBlock(this, false);
1466 shapeInsideInfo->setShapeSize(logicalWidth(), percentageLogicalHeightResolva ble ? logicalHeight() : LayoutUnit()); 1466 shapeInsideInfo->setReferenceBoxLogicalSize(LayoutSize(logicalWidth(), perce ntageLogicalHeightResolvable ? logicalHeight() : LayoutUnit()));
1467 } 1467 }
1468 1468
1469 void RenderBlock::updateRegionsAndShapesAfterChildLayout(RenderFlowThread* flowT hread, bool heightChanged) 1469 void RenderBlock::updateRegionsAndShapesAfterChildLayout(RenderFlowThread* flowT hread, bool heightChanged)
1470 { 1470 {
1471 // A previous sibling has changed dimension, so we need to relayout the shap e with the content 1471 // A previous sibling has changed dimension, so we need to relayout the shap e with the content
1472 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); 1472 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo();
1473 if (heightChanged && shapeInsideInfo) 1473 if (heightChanged && shapeInsideInfo)
1474 shapeInsideInfo->dirtyShapeSize(); 1474 shapeInsideInfo->markShapeAsDirty();
1475 1475
1476 computeRegionRangeForBlock(flowThread); 1476 computeRegionRangeForBlock(flowThread);
1477 } 1477 }
1478 1478
1479 void RenderBlock::computeRegionRangeForBlock(RenderFlowThread* flowThread) 1479 void RenderBlock::computeRegionRangeForBlock(RenderFlowThread* flowThread)
1480 { 1480 {
1481 if (flowThread) 1481 if (flowThread)
1482 flowThread->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage() ); 1482 flowThread->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage() );
1483 } 1483 }
1484 1484
(...skipping 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after
5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 5018 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
5019 { 5019 {
5020 showRenderObject(); 5020 showRenderObject();
5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 5021 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 5022 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
5023 } 5023 }
5024 5024
5025 #endif 5025 #endif
5026 5026
5027 } // namespace WebCore 5027 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698