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