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, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "core/page/Page.h" | 54 #include "core/page/Page.h" |
55 #include "core/page/scrolling/SnapCoordinator.h" | 55 #include "core/page/scrolling/SnapCoordinator.h" |
56 #include "core/paint/BackgroundImageGeometry.h" | 56 #include "core/paint/BackgroundImageGeometry.h" |
57 #include "core/paint/BoxPainter.h" | 57 #include "core/paint/BoxPainter.h" |
58 #include "core/paint/PaintLayer.h" | 58 #include "core/paint/PaintLayer.h" |
59 #include "core/style/ShadowList.h" | 59 #include "core/style/ShadowList.h" |
60 #include "platform/LengthFunctions.h" | 60 #include "platform/LengthFunctions.h" |
61 #include "platform/geometry/DoubleRect.h" | 61 #include "platform/geometry/DoubleRect.h" |
62 #include "platform/geometry/FloatQuad.h" | 62 #include "platform/geometry/FloatQuad.h" |
63 #include "platform/geometry/FloatRoundedRect.h" | 63 #include "platform/geometry/FloatRoundedRect.h" |
| 64 #include "wtf/PtrUtil.h" |
64 #include <algorithm> | 65 #include <algorithm> |
65 #include <math.h> | 66 #include <math.h> |
66 | 67 |
67 namespace blink { | 68 namespace blink { |
68 | 69 |
69 // Used by flexible boxes when flexing this element and by table cells. | 70 // Used by flexible boxes when flexing this element and by table cells. |
70 typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap; | 71 typedef WTF::HashMap<const LayoutBox*, LayoutUnit> OverrideSizeMap; |
71 | 72 |
72 // Used by grid elements to properly size their grid items. | 73 // Used by grid elements to properly size their grid items. |
73 // FIXME: Move these into LayoutBoxRareData. | 74 // FIXME: Move these into LayoutBoxRareData. |
(...skipping 4118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4192 else | 4193 else |
4193 overflowRect.shiftXEdgeTo(std::max(overflowRect.x(), clientBox.x()))
; | 4194 overflowRect.shiftXEdgeTo(std::max(overflowRect.x(), clientBox.x()))
; |
4194 | 4195 |
4195 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully | 4196 // Now re-test with the adjusted rectangle and see if it has become unre
achable or fully |
4196 // contained. | 4197 // contained. |
4197 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) | 4198 if (clientBox.contains(overflowRect) || overflowRect.isEmpty()) |
4198 return; | 4199 return; |
4199 } | 4200 } |
4200 | 4201 |
4201 if (!m_overflow) | 4202 if (!m_overflow) |
4202 m_overflow = adoptPtr(new BoxOverflowModel(clientBox, borderBoxRect())); | 4203 m_overflow = wrapUnique(new BoxOverflowModel(clientBox, borderBoxRect())
); |
4203 | 4204 |
4204 m_overflow->addLayoutOverflow(overflowRect); | 4205 m_overflow->addLayoutOverflow(overflowRect); |
4205 } | 4206 } |
4206 | 4207 |
4207 void LayoutBox::addSelfVisualOverflow(const LayoutRect& rect) | 4208 void LayoutBox::addSelfVisualOverflow(const LayoutRect& rect) |
4208 { | 4209 { |
4209 if (rect.isEmpty()) | 4210 if (rect.isEmpty()) |
4210 return; | 4211 return; |
4211 | 4212 |
4212 LayoutRect borderBox = borderBoxRect(); | 4213 LayoutRect borderBox = borderBoxRect(); |
4213 if (borderBox.contains(rect)) | 4214 if (borderBox.contains(rect)) |
4214 return; | 4215 return; |
4215 | 4216 |
4216 if (!m_overflow) | 4217 if (!m_overflow) |
4217 m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox))
; | 4218 m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox
)); |
4218 | 4219 |
4219 m_overflow->addSelfVisualOverflow(rect); | 4220 m_overflow->addSelfVisualOverflow(rect); |
4220 } | 4221 } |
4221 | 4222 |
4222 void LayoutBox::addContentsVisualOverflow(const LayoutRect& rect) | 4223 void LayoutBox::addContentsVisualOverflow(const LayoutRect& rect) |
4223 { | 4224 { |
4224 if (rect.isEmpty()) | 4225 if (rect.isEmpty()) |
4225 return; | 4226 return; |
4226 | 4227 |
4227 // If hasOverflowClip() we always save contents visual overflow because we n
eed it | 4228 // If hasOverflowClip() we always save contents visual overflow because we n
eed it |
4228 // e.g. to determine whether to apply rounded corner clip on contents. | 4229 // e.g. to determine whether to apply rounded corner clip on contents. |
4229 // Otherwise we save contents visual overflow only if it overflows the borde
r box. | 4230 // Otherwise we save contents visual overflow only if it overflows the borde
r box. |
4230 LayoutRect borderBox = borderBoxRect(); | 4231 LayoutRect borderBox = borderBoxRect(); |
4231 if (!hasOverflowClip() && borderBox.contains(rect)) | 4232 if (!hasOverflowClip() && borderBox.contains(rect)) |
4232 return; | 4233 return; |
4233 | 4234 |
4234 if (!m_overflow) | 4235 if (!m_overflow) |
4235 m_overflow = adoptPtr(new BoxOverflowModel(noOverflowRect(), borderBox))
; | 4236 m_overflow = wrapUnique(new BoxOverflowModel(noOverflowRect(), borderBox
)); |
4236 m_overflow->addContentsVisualOverflow(rect); | 4237 m_overflow->addContentsVisualOverflow(rect); |
4237 } | 4238 } |
4238 | 4239 |
4239 void LayoutBox::clearLayoutOverflow() | 4240 void LayoutBox::clearLayoutOverflow() |
4240 { | 4241 { |
4241 if (!m_overflow) | 4242 if (!m_overflow) |
4242 return; | 4243 return; |
4243 | 4244 |
4244 if (!hasSelfVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { | 4245 if (!hasSelfVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { |
4245 clearAllOverflows(); | 4246 clearAllOverflows(); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4877 m_rareData->m_snapAreas->remove(&snapArea); | 4878 m_rareData->m_snapAreas->remove(&snapArea); |
4878 } | 4879 } |
4879 } | 4880 } |
4880 | 4881 |
4881 SnapAreaSet* LayoutBox::snapAreas() const | 4882 SnapAreaSet* LayoutBox::snapAreas() const |
4882 { | 4883 { |
4883 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4884 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
4884 } | 4885 } |
4885 | 4886 |
4886 } // namespace blink | 4887 } // namespace blink |
OLD | NEW |