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 3891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3902 } | 3902 } |
3903 | 3903 |
3904 delete containerSet; | 3904 delete containerSet; |
3905 } | 3905 } |
3906 | 3906 |
3907 HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const | 3907 HashSet<RenderBox*>* RenderBlock::percentHeightDescendants() const |
3908 { | 3908 { |
3909 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; | 3909 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; |
3910 } | 3910 } |
3911 | 3911 |
3912 #if !ASSERT_DISABLED | 3912 bool RenderBlock::hasPercentHeightContainerMap() |
| 3913 { |
| 3914 return gPercentHeightContainerMap; |
| 3915 } |
| 3916 |
3913 bool RenderBlock::hasPercentHeightDescendant(RenderBox* descendant) | 3917 bool RenderBlock::hasPercentHeightDescendant(RenderBox* descendant) |
3914 { | 3918 { |
3915 ASSERT(descendant); | 3919 // We don't null check gPercentHeightContainerMap since the caller |
3916 if (!gPercentHeightContainerMap) | 3920 // already ensures this and we need to call this function on every |
3917 return false; | 3921 // descendant in clearPercentHeightDescendantsFrom(). |
3918 HashSet<RenderBlock*>* containerSet = gPercentHeightContainerMap->take(desce
ndant); | 3922 ASSERT(gPercentHeightContainerMap); |
3919 return containerSet && containerSet->size(); | 3923 return gPercentHeightContainerMap->contains(descendant); |
3920 } | 3924 } |
3921 #endif | 3925 |
| 3926 void RenderBlock::removePercentHeightDescendantIfNeeded(RenderBox* descendant) |
| 3927 { |
| 3928 // We query the map directly, rather than looking at style's |
| 3929 // logicalHeight()/logicalMinHeight()/logicalMaxHeight() since those |
| 3930 // can change with writing mode/directional changes. |
| 3931 if (!hasPercentHeightContainerMap()) |
| 3932 return; |
| 3933 |
| 3934 if (!hasPercentHeightDescendant(descendant)) |
| 3935 return; |
| 3936 |
| 3937 removePercentHeightDescendant(descendant); |
| 3938 } |
| 3939 |
| 3940 void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) |
| 3941 { |
| 3942 ASSERT(gPercentHeightContainerMap); |
| 3943 for (RenderObject* curr = parent->firstChild(); curr; curr = curr->nextInPre
Order(parent)) { |
| 3944 if (!curr->isBox()) |
| 3945 continue; |
| 3946 |
| 3947 RenderBox* box = toRenderBox(curr); |
| 3948 if (!hasPercentHeightDescendant(box)) |
| 3949 continue; |
| 3950 |
| 3951 removePercentHeightDescendant(box); |
| 3952 } |
| 3953 } |
3922 | 3954 |
3923 template <RenderBlock::FloatingObject::Type FloatTypeValue> | 3955 template <RenderBlock::FloatingObject::Type FloatTypeValue> |
3924 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) const | 3956 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe
eded(const IntervalType& interval) const |
3925 { | 3957 { |
3926 const FloatingObject* r = interval.data(); | 3958 const FloatingObject* r = interval.data(); |
3927 if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < in
terval.high()) { | 3959 if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < in
terval.high()) { |
3928 // All the objects returned from the tree should be already placed. | 3960 // All the objects returned from the tree should be already placed. |
3929 ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <=
m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value); | 3961 ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <=
m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value); |
3930 | 3962 |
3931 if (FloatTypeValue == FloatingObject::FloatLeft | 3963 if (FloatTypeValue == FloatingObject::FloatLeft |
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7252 } | 7284 } |
7253 | 7285 |
7254 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7286 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7255 { | 7287 { |
7256 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 7288 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
7257 } | 7289 } |
7258 | 7290 |
7259 #endif | 7291 #endif |
7260 | 7292 |
7261 } // namespace WebCore | 7293 } // namespace WebCore |
OLD | NEW |