From 6f68ebcacb0eb55f110c9b3dd440f91dc60a2eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 20 Sep 2018 13:21:51 +0200 Subject: [PATCH] [poincare] Remove nullptr cases in CondensedSumLayoutNode --- poincare/src/condensed_sum_layout.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/poincare/src/condensed_sum_layout.cpp b/poincare/src/condensed_sum_layout.cpp index 395e5669c..68a74e188 100644 --- a/poincare/src/condensed_sum_layout.cpp +++ b/poincare/src/condensed_sum_layout.cpp @@ -6,17 +6,14 @@ namespace Poincare { static inline KDCoordinate max(KDCoordinate x, KDCoordinate y) { return x > y ? x : y; } - -// TODO remove nullptr in the code? KDCoordinate CondensedSumLayoutNode::computeBaseline() { - KDSize superscriptSize = superscriptLayout() == nullptr ? KDSizeZero : superscriptLayout()->layoutSize(); - return baseLayout()->baseline() + max(0, superscriptSize.height() - baseLayout()->layoutSize().height()/2); + return baseLayout()->baseline() + max(0, superscriptLayout()->layoutSize().height() - baseLayout()->layoutSize().height()/2); } KDSize CondensedSumLayoutNode::computeSize() { KDSize baseSize = baseLayout()->layoutSize(); KDSize subscriptSize = subscriptLayout()->layoutSize(); - KDSize superscriptSize = superscriptLayout() == nullptr ? KDSizeZero : superscriptLayout()->layoutSize(); + KDSize superscriptSize = superscriptLayout()->layoutSize(); KDCoordinate sizeWidth = baseSize.width() + max(subscriptSize.width(), superscriptSize.width()); KDCoordinate sizeHeight = max(baseSize.height()/2, subscriptSize.height()) + max(baseSize.height()/2, superscriptSize.height()); return KDSize(sizeWidth, sizeHeight); @@ -26,7 +23,7 @@ KDPoint CondensedSumLayoutNode::positionOfChild(LayoutNode * child) { KDCoordinate x = 0; KDCoordinate y = 0; KDSize baseSize = baseLayout()->layoutSize(); - KDSize superscriptSize = superscriptLayout() == nullptr ? KDSizeZero : superscriptLayout()->layoutSize(); + KDSize superscriptSize = superscriptLayout()->layoutSize(); if (child == baseLayout()) { y = max(0, superscriptSize.height() - baseSize.height()/2); }