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) 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 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3865 } | 3865 } |
3866 | 3866 |
3867 delete containerSet; | 3867 delete containerSet; |
3868 } | 3868 } |
3869 | 3869 |
3870 HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const | 3870 HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const |
3871 { | 3871 { |
3872 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; | 3872 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; |
3873 } | 3873 } |
3874 | 3874 |
3875 #if !ASSERT_DISABLED | 3875 bool RenderBlock::hasPercentHeightContainerMap() |
| 3876 { |
| 3877 return gPercentHeightContainerMap; |
| 3878 } |
| 3879 |
3876 bool RenderBlock::hasPercentHeightDescendant(RenderBox* descendant) | 3880 bool RenderBlock::hasPercentHeightDescendant(RenderBox* descendant) |
3877 { | 3881 { |
3878 ASSERT(descendant); | 3882 // We don't null check gPercentHeightContainerMap since the caller |
3879 if (!gPercentHeightContainerMap) | 3883 // already ensures this and we need to call this function on every |
3880 return false; | 3884 // descendant in clearPercentHeightDescendantsFrom(). |
3881 HashSet<RenderBlock*>* containerSet = gPercentHeightContainerMap->take(desce
ndant); | 3885 ASSERT(gPercentHeightContainerMap); |
3882 return containerSet && containerSet->size(); | 3886 return gPercentHeightContainerMap->contains(descendant); |
3883 } | 3887 } |
3884 #endif | 3888 |
| 3889 void RenderBlock::removePercentHeightDescendantIfNeeded(RenderBox* descendant) |
| 3890 { |
| 3891 // We query the map directly, rather than looking at style's |
| 3892 // logicalHeight()/logicalMinHeight()/logicalMaxHeight() since those |
| 3893 // can change with writing mode/directional changes. |
| 3894 if (!hasPercentHeightContainerMap()) |
| 3895 return; |
| 3896 |
| 3897 if (!hasPercentHeightDescendant(descendant)) |
| 3898 return; |
| 3899 |
| 3900 removePercentHeightDescendant(descendant); |
| 3901 } |
| 3902 |
| 3903 void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) |
| 3904 { |
| 3905 ASSERT(gPercentHeightContainerMap); |
| 3906 for (RenderObject* curr = parent->firstChild(); curr; curr = curr->nextInPre
Order(parent)) { |
| 3907 if (!curr->isBox()) |
| 3908 continue; |
| 3909 |
| 3910 RenderBox* box = toRenderBox(curr); |
| 3911 if (!hasPercentHeightDescendant(box)) |
| 3912 continue; |
| 3913 |
| 3914 removePercentHeightDescendant(box); |
| 3915 } |
| 3916 } |
3885 | 3917 |
3886 template <RenderBlock::FloatingObject::Type FloatTypeValue> | 3918 template <RenderBlock::FloatingObject::Type FloatTypeValue> |
3887 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) const | 3919 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) const |
3888 { | 3920 { |
3889 const FloatingObject* r = interval.data(); | 3921 const FloatingObject* r = interval.data(); |
3890 if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < in
terval.high()) { | 3922 if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < in
terval.high()) { |
3891 // All the objects returned from the tree should be already placed. | 3923 // All the objects returned from the tree should be already placed. |
3892 ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <=
m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value); | 3924 ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <=
m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value); |
3893 | 3925 |
3894 if (FloatTypeValue == FloatingObject::FloatLeft | 3926 if (FloatTypeValue == FloatingObject::FloatLeft |
(...skipping 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7382 } | 7414 } |
7383 | 7415 |
7384 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7416 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7385 { | 7417 { |
7386 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi
xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX
(), floatingObject->pixelSnappedMaxY()); | 7418 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pi
xelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX
(), floatingObject->pixelSnappedMaxY()); |
7387 } | 7419 } |
7388 | 7420 |
7389 #endif | 7421 #endif |
7390 | 7422 |
7391 } // namespace WebCore | 7423 } // namespace WebCore |
OLD | NEW |