OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/rendering/RenderRegion.h" | 31 #include "core/rendering/RenderRegion.h" |
32 | 32 |
33 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
34 #include "core/rendering/FlowThreadController.h" | 34 #include "core/rendering/FlowThreadController.h" |
35 #include "core/rendering/HitTestLocation.h" | 35 #include "core/rendering/HitTestLocation.h" |
36 #include "core/rendering/PaintInfo.h" | 36 #include "core/rendering/PaintInfo.h" |
37 #include "core/rendering/RenderFlowThread.h" | 37 #include "core/rendering/RenderFlowThread.h" |
38 #include "core/rendering/RenderView.h" | 38 #include "core/rendering/RenderView.h" |
39 | 39 |
40 using namespace std; | |
41 | |
42 namespace WebCore { | 40 namespace WebCore { |
43 | 41 |
44 RenderRegion::RenderRegion(Element* element, RenderFlowThread* flowThread) | 42 RenderRegion::RenderRegion(Element* element, RenderFlowThread* flowThread) |
45 : RenderBlockFlow(element) | 43 : RenderBlockFlow(element) |
46 , m_flowThread(flowThread) | 44 , m_flowThread(flowThread) |
47 , m_isValid(false) | 45 , m_isValid(false) |
48 { | 46 { |
49 } | 47 } |
50 | 48 |
51 LayoutUnit RenderRegion::pageLogicalWidth() const | 49 LayoutUnit RenderRegion::pageLogicalWidth() const |
(...skipping 25 matching lines...) Expand all Loading... |
77 | 75 |
78 if (hasOverflowClip()) | 76 if (hasOverflowClip()) |
79 return flowThreadPortionRect; | 77 return flowThreadPortionRect; |
80 | 78 |
81 LayoutRect flowThreadOverflow = m_flowThread->visualOverflowRect(); | 79 LayoutRect flowThreadOverflow = m_flowThread->visualOverflowRect(); |
82 | 80 |
83 // Only clip along the flow thread axis. | 81 // Only clip along the flow thread axis. |
84 LayoutRect clipRect; | 82 LayoutRect clipRect; |
85 if (m_flowThread->isHorizontalWritingMode()) { | 83 if (m_flowThread->isHorizontalWritingMode()) { |
86 LayoutUnit minY = isFirstPortion ? flowThreadOverflow.y() : flowThreadPo
rtionRect.y(); | 84 LayoutUnit minY = isFirstPortion ? flowThreadOverflow.y() : flowThreadPo
rtionRect.y(); |
87 LayoutUnit maxY = isLastPortion ? max(flowThreadPortionRect.maxY(), flow
ThreadOverflow.maxY()) : flowThreadPortionRect.maxY(); | 85 LayoutUnit maxY = isLastPortion ? std::max(flowThreadPortionRect.maxY(),
flowThreadOverflow.maxY()) : flowThreadPortionRect.maxY(); |
88 LayoutUnit minX = min(flowThreadPortionRect.x(), flowThreadOverflow.x())
; | 86 LayoutUnit minX = std::min(flowThreadPortionRect.x(), flowThreadOverflow
.x()); |
89 LayoutUnit maxX = max(flowThreadPortionRect.maxX(), flowThreadOverflow.m
axX()); | 87 LayoutUnit maxX = std::max(flowThreadPortionRect.maxX(), flowThreadOverf
low.maxX()); |
90 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); | 88 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); |
91 } else { | 89 } else { |
92 LayoutUnit minX = isFirstPortion ? flowThreadOverflow.x() : flowThreadPo
rtionRect.x(); | 90 LayoutUnit minX = isFirstPortion ? flowThreadOverflow.x() : flowThreadPo
rtionRect.x(); |
93 LayoutUnit maxX = isLastPortion ? max(flowThreadPortionRect.maxX(), flow
ThreadOverflow.maxX()) : flowThreadPortionRect.maxX(); | 91 LayoutUnit maxX = isLastPortion ? std::max(flowThreadPortionRect.maxX(),
flowThreadOverflow.maxX()) : flowThreadPortionRect.maxX(); |
94 LayoutUnit minY = min(flowThreadPortionRect.y(), (flowThreadOverflow.y()
)); | 92 LayoutUnit minY = std::min(flowThreadPortionRect.y(), (flowThreadOverflo
w.y())); |
95 LayoutUnit maxY = max(flowThreadPortionRect.y(), (flowThreadOverflow.max
Y())); | 93 LayoutUnit maxY = std::max(flowThreadPortionRect.y(), (flowThreadOverflo
w.maxY())); |
96 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); | 94 clipRect = LayoutRect(minX, minY, maxX - minX, maxY - minY); |
97 } | 95 } |
98 | 96 |
99 return clipRect; | 97 return clipRect; |
100 } | 98 } |
101 | 99 |
102 LayoutUnit RenderRegion::pageLogicalTopForOffset(LayoutUnit /* offset */) const | 100 LayoutUnit RenderRegion::pageLogicalTopForOffset(LayoutUnit /* offset */) const |
103 { | 101 { |
104 return flowThread()->isHorizontalWritingMode() ? flowThreadPortionRect().y()
: flowThreadPortionRect().x(); | 102 return flowThread()->isHorizontalWritingMode() ? flowThreadPortionRect().y()
: flowThreadPortionRect().x(); |
105 } | 103 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!isValid()) { | 214 if (!isValid()) { |
217 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogic
alWidth); | 215 RenderBlockFlow::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogic
alWidth); |
218 return; | 216 return; |
219 } | 217 } |
220 | 218 |
221 minLogicalWidth = m_flowThread->minPreferredLogicalWidth(); | 219 minLogicalWidth = m_flowThread->minPreferredLogicalWidth(); |
222 maxLogicalWidth = m_flowThread->maxPreferredLogicalWidth(); | 220 maxLogicalWidth = m_flowThread->maxPreferredLogicalWidth(); |
223 } | 221 } |
224 | 222 |
225 } // namespace WebCore | 223 } // namespace WebCore |
OLD | NEW |