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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 using namespace std; | 54 using namespace std; |
55 | 55 |
56 namespace WebCore { | 56 namespace WebCore { |
57 | 57 |
58 using namespace HTMLNames; | 58 using namespace HTMLNames; |
59 | 59 |
60 // Used by flexible boxes when flexing this element. | 60 // Used by flexible boxes when flexing this element. |
61 typedef WTF::HashMap<const RenderBox*, int> OverrideSizeMap; | 61 typedef WTF::HashMap<const RenderBox*, int> OverrideSizeMap; |
62 static OverrideSizeMap* gOverrideSizeMap = 0; | 62 static OverrideSizeMap* gOverrideSizeMap = 0; |
63 | 63 |
| 64 bool RenderBox::s_wasFloating = false; |
64 bool RenderBox::s_hadOverflowClip = false; | 65 bool RenderBox::s_hadOverflowClip = false; |
65 | 66 |
66 RenderBox::RenderBox(Node* node) | 67 RenderBox::RenderBox(Node* node) |
67 : RenderBoxModelObject(node) | 68 : RenderBoxModelObject(node) |
68 , m_marginLeft(0) | 69 , m_marginLeft(0) |
69 , m_marginRight(0) | 70 , m_marginRight(0) |
70 , m_marginTop(0) | 71 , m_marginTop(0) |
71 , m_marginBottom(0) | 72 , m_marginBottom(0) |
72 , m_minPrefWidth(-1) | 73 , m_minPrefWidth(-1) |
73 , m_maxPrefWidth(-1) | 74 , m_maxPrefWidth(-1) |
| 75 , m_layer(0) |
74 , m_inlineBoxWrapper(0) | 76 , m_inlineBoxWrapper(0) |
75 { | 77 { |
76 setIsBox(); | 78 setIsBox(); |
77 } | 79 } |
78 | 80 |
79 RenderBox::~RenderBox() | 81 RenderBox::~RenderBox() |
80 { | 82 { |
81 } | 83 } |
82 | 84 |
83 void RenderBox::destroy() | 85 void RenderBox::destroy() |
84 { | 86 { |
85 // A lot of the code in this function is just pasted into | 87 // A lot of the code in this function is just pasted into |
86 // RenderWidget::destroy. If anything in this function changes, | 88 // RenderWidget::destroy. If anything in this function changes, |
87 // be sure to fix RenderWidget::destroy() as well. | 89 // be sure to fix RenderWidget::destroy() as well. |
88 if (hasOverrideSize()) | 90 if (hasOverrideSize()) |
89 gOverrideSizeMap->remove(this); | 91 gOverrideSizeMap->remove(this); |
90 | 92 |
| 93 // This must be done before we destroy the RenderObject. |
| 94 if (m_layer) |
| 95 m_layer->clearClipRects(); |
| 96 |
91 if (style() && (style()->height().isPercent() || style()->minHeight().isPerc
ent() || style()->maxHeight().isPercent())) | 97 if (style() && (style()->height().isPercent() || style()->minHeight().isPerc
ent() || style()->maxHeight().isPercent())) |
92 RenderBlock::removePercentHeightDescendant(this); | 98 RenderBlock::removePercentHeightDescendant(this); |
93 | 99 |
94 RenderBoxModelObject::destroy(); | 100 RenderBoxModelObject::destroy(); |
95 } | 101 } |
96 | 102 |
97 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 103 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
98 { | 104 { |
99 ASSERT(isFloatingOrPositioned()); | 105 ASSERT(isFloatingOrPositioned()); |
100 | 106 |
(...skipping 15 matching lines...) Expand all Loading... |
116 RenderObject* p; | 122 RenderObject* p; |
117 for (p = parent(); p; p = p->parent()) { | 123 for (p = parent(); p; p = p->parent()) { |
118 if (p->isRenderBlock()) | 124 if (p->isRenderBlock()) |
119 toRenderBlock(p)->removePositionedObject(this); | 125 toRenderBlock(p)->removePositionedObject(this); |
120 } | 126 } |
121 } | 127 } |
122 } | 128 } |
123 | 129 |
124 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl
e) | 130 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyl
e) |
125 { | 131 { |
| 132 s_wasFloating = isFloating(); |
126 s_hadOverflowClip = hasOverflowClip(); | 133 s_hadOverflowClip = hasOverflowClip(); |
127 | 134 |
128 if (style()) { | 135 if (style()) { |
129 // If our z-index changes value or our visibility changes, | 136 // If our z-index changes value or our visibility changes, |
130 // we need to dirty our stacking context's z-order list. | 137 // we need to dirty our stacking context's z-order list. |
131 if (newStyle) { | 138 if (newStyle) { |
132 if (hasLayer() && (style()->hasAutoZIndex() != newStyle->hasAutoZInd
ex() || | 139 if (hasLayer() && (style()->hasAutoZIndex() != newStyle->hasAutoZInd
ex() || |
133 style()->zIndex() != newStyle->zIndex() || | 140 style()->zIndex() != newStyle->zIndex() || |
134 style()->visibility() != newStyle->visibility()))
{ | 141 style()->visibility() != newStyle->visibility()))
{ |
135 layer()->dirtyStackingContextZOrderLists(); | 142 layer()->dirtyStackingContextZOrderLists(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 removeFloatingOrPositionedChildFromBlockLists(); | 189 removeFloatingOrPositionedChildFromBlockLists(); |
183 } | 190 } |
184 } | 191 } |
185 } | 192 } |
186 | 193 |
187 RenderBoxModelObject::styleWillChange(diff, newStyle); | 194 RenderBoxModelObject::styleWillChange(diff, newStyle); |
188 } | 195 } |
189 | 196 |
190 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) | 197 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle
) |
191 { | 198 { |
| 199 // We need to ensure that view->maximalOutlineSize() is valid for any repain
ts that happen |
| 200 // during the style change (it's used by clippedOverflowRectForRepaint()). |
| 201 if (style()->outlineWidth() > 0 && style()->outlineSize() > maximalOutlineSi
ze(PaintPhaseOutline)) |
| 202 toRenderView(document()->renderer())->setMaximalOutlineSize(style()->out
lineSize()); |
| 203 |
192 RenderBoxModelObject::styleDidChange(diff, oldStyle); | 204 RenderBoxModelObject::styleDidChange(diff, oldStyle); |
193 | 205 |
194 if (needsLayout() && oldStyle && (oldStyle->height().isPercent() || oldStyle
->minHeight().isPercent() || oldStyle->maxHeight().isPercent())) | 206 if (needsLayout() && oldStyle && (oldStyle->height().isPercent() || oldStyle
->minHeight().isPercent() || oldStyle->maxHeight().isPercent())) |
195 RenderBlock::removePercentHeightDescendant(this); | 207 RenderBlock::removePercentHeightDescendant(this); |
196 | 208 |
197 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the | |
198 // new zoomed coordinate space. | |
199 if (hasOverflowClip() && oldStyle && style() && oldStyle->effectiveZoom() !=
style()->effectiveZoom()) { | |
200 int left = scrollLeft(); | |
201 if (left) { | |
202 left = (left / oldStyle->effectiveZoom()) * style()->effectiveZoom()
; | |
203 setScrollLeft(left); | |
204 } | |
205 int top = scrollTop(); | |
206 if (top) { | |
207 top = (top / oldStyle->effectiveZoom()) * style()->effectiveZoom(); | |
208 setScrollTop(top); | |
209 } | |
210 } | |
211 | |
212 // Set the text color if we're the body. | |
213 if (isBody()) | |
214 document()->setTextColor(style()->color()); | |
215 } | |
216 | |
217 void RenderBox::updateBoxModelInfoFromStyle() | |
218 { | |
219 RenderBoxModelObject::updateBoxModelInfoFromStyle(); | |
220 | |
221 bool isRootObject = isRoot(); | 209 bool isRootObject = isRoot(); |
222 bool isViewObject = isRenderView(); | 210 bool isViewObject = isRenderView(); |
223 | 211 |
224 // The root and the RenderView always paint their backgrounds/borders. | 212 // The root and the RenderView always paint their backgrounds/borders. |
225 if (isRootObject || isViewObject) | 213 if (isRootObject || isViewObject) |
226 setHasBoxDecorations(true); | 214 setHasBoxDecorations(true); |
227 | 215 |
228 setPositioned(style()->position() == AbsolutePosition || style()->position()
== FixedPosition); | 216 setInline(style()->isDisplayInlineType()); |
229 setFloating(!isPositioned() && style()->isFloating()); | 217 |
| 218 switch (style()->position()) { |
| 219 case AbsolutePosition: |
| 220 case FixedPosition: |
| 221 setPositioned(true); |
| 222 break; |
| 223 default: |
| 224 setPositioned(false); |
| 225 |
| 226 if (style()->isFloating()) |
| 227 setFloating(true); |
| 228 |
| 229 if (style()->position() == RelativePosition) |
| 230 setRelPositioned(true); |
| 231 break; |
| 232 } |
230 | 233 |
231 // We also handle <body> and <html>, whose overflow applies to the viewport. | 234 // We also handle <body> and <html>, whose overflow applies to the viewport. |
232 if (style()->overflowX() != OVISIBLE && !isRootObject && (isRenderBlock() ||
isTableRow() || isTableSection())) { | 235 if (style()->overflowX() != OVISIBLE && !isRootObject && (isRenderBlock() ||
isTableRow() || isTableSection())) { |
233 bool boxHasOverflowClip = true; | 236 bool boxHasOverflowClip = true; |
234 if (isBody()) { | 237 if (isBody()) { |
235 // Overflow on the body can propagate to the viewport under the foll
owing conditions. | 238 // Overflow on the body can propagate to the viewport under the foll
owing conditions. |
236 // (1) The root element is <html>. | 239 // (1) The root element is <html>. |
237 // (2) We are the primary <body> (can be checked by looking at docum
ent.body). | 240 // (2) We are the primary <body> (can be checked by looking at docum
ent.body). |
238 // (3) The root element has visible overflow. | 241 // (3) The root element has visible overflow. |
239 if (document()->documentElement()->hasTagName(htmlTag) && | 242 if (document()->documentElement()->hasTagName(htmlTag) && |
240 document()->body() == element() && | 243 document()->body() == element() && |
241 document()->documentElement()->renderer()->style()->overflowX()
== OVISIBLE) | 244 document()->documentElement()->renderer()->style()->overflowX()
== OVISIBLE) |
242 boxHasOverflowClip = false; | 245 boxHasOverflowClip = false; |
243 } | 246 } |
244 | 247 |
245 // Check for overflow clip. | 248 // Check for overflow clip. |
246 // It's sufficient to just check one direction, since it's illegal to ha
ve visible on only one overflow value. | 249 // It's sufficient to just check one direction, since it's illegal to ha
ve visible on only one overflow value. |
247 if (boxHasOverflowClip) { | 250 if (boxHasOverflowClip) { |
248 if (!s_hadOverflowClip) | 251 if (!s_hadOverflowClip) |
249 // Erase the overflow | 252 // Erase the overflow |
250 repaint(); | 253 repaint(); |
251 setHasOverflowClip(); | 254 setHasOverflowClip(); |
252 } | 255 } |
253 } | 256 } |
254 | 257 |
255 setHasTransform(style()->hasTransform()); | 258 // FIXME: we should make transforms really work on inline flows eventually. |
| 259 if (!isInline() || isReplaced()) |
| 260 setHasTransform(style()->hasTransform()); |
256 setHasReflection(style()->boxReflect()); | 261 setHasReflection(style()->boxReflect()); |
| 262 |
| 263 if (requiresLayer()) { |
| 264 if (!m_layer) { |
| 265 if (s_wasFloating && isFloating()) |
| 266 setChildNeedsLayout(true); |
| 267 m_layer = new (renderArena()) RenderLayer(this); |
| 268 setHasLayer(true); |
| 269 m_layer->insertOnlyThisLayer(); |
| 270 if (parent() && !needsLayout() && containingBlock()) |
| 271 m_layer->updateLayerPositions(); |
| 272 } |
| 273 } else if (m_layer && !isRootObject && !isViewObject) { |
| 274 ASSERT(m_layer->parent()); |
| 275 RenderLayer* layer = m_layer; |
| 276 m_layer = 0; |
| 277 setHasLayer(false); |
| 278 setHasTransform(false); // Either a transform wasn't specified or the ob
ject doesn't support transforms, so just null out the bit. |
| 279 setHasReflection(false); |
| 280 layer->removeOnlyThisLayer(); |
| 281 if (s_wasFloating && isFloating()) |
| 282 setChildNeedsLayout(true); |
| 283 } |
| 284 |
| 285 // If our zoom factor changes and we have a defined scrollLeft/Top, we need
to adjust that value into the |
| 286 // new zoomed coordinate space. |
| 287 if (hasOverflowClip() && oldStyle && style() && oldStyle->effectiveZoom() !=
style()->effectiveZoom()) { |
| 288 int left = scrollLeft(); |
| 289 if (left) { |
| 290 left = (left / oldStyle->effectiveZoom()) * style()->effectiveZoom()
; |
| 291 setScrollLeft(left); |
| 292 } |
| 293 int top = scrollTop(); |
| 294 if (top) { |
| 295 top = (top / oldStyle->effectiveZoom()) * style()->effectiveZoom(); |
| 296 setScrollTop(top); |
| 297 } |
| 298 } |
| 299 |
| 300 if (m_layer) |
| 301 m_layer->styleChanged(diff, oldStyle); |
| 302 |
| 303 // Set the text color if we're the body. |
| 304 if (isBody()) |
| 305 document()->setTextColor(style()->color()); |
257 } | 306 } |
258 | 307 |
259 void RenderBox::layout() | 308 void RenderBox::layout() |
260 { | 309 { |
261 ASSERT(needsLayout()); | 310 ASSERT(needsLayout()); |
262 | 311 |
263 RenderObject* child = firstChild(); | 312 RenderObject* child = firstChild(); |
264 if (!child) { | 313 if (!child) { |
265 setNeedsLayout(false); | 314 setNeedsLayout(false); |
266 return; | 315 return; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return height() - borderTop() - borderBottom() - horizontalScrollbarHeight()
; | 417 return height() - borderTop() - borderBottom() - horizontalScrollbarHeight()
; |
369 } | 418 } |
370 | 419 |
371 // scrollWidth/scrollHeight will be the same as overflowWidth/overflowHeight unl
ess the | 420 // scrollWidth/scrollHeight will be the same as overflowWidth/overflowHeight unl
ess the |
372 // object has overflow:hidden/scroll/auto specified and also has overflow. | 421 // object has overflow:hidden/scroll/auto specified and also has overflow. |
373 // FIXME: It's not completely clear how scrollWidth/Height should behave for | 422 // FIXME: It's not completely clear how scrollWidth/Height should behave for |
374 // objects with visible overflow. | 423 // objects with visible overflow. |
375 int RenderBox::scrollWidth() const | 424 int RenderBox::scrollWidth() const |
376 { | 425 { |
377 if (hasOverflowClip()) | 426 if (hasOverflowClip()) |
378 return layer()->scrollWidth(); | 427 return m_layer->scrollWidth(); |
379 return overflowWidth(); | 428 return overflowWidth(); |
380 } | 429 } |
381 | 430 |
382 int RenderBox::scrollHeight() const | 431 int RenderBox::scrollHeight() const |
383 { | 432 { |
384 if (hasOverflowClip()) | 433 if (hasOverflowClip()) |
385 return layer()->scrollHeight(); | 434 return m_layer->scrollHeight(); |
386 return overflowHeight(); | 435 return overflowHeight(); |
387 } | 436 } |
388 | 437 |
389 int RenderBox::scrollLeft() const | 438 int RenderBox::scrollLeft() const |
390 { | 439 { |
391 return hasOverflowClip() ? layer()->scrollXOffset() : 0; | 440 return hasOverflowClip() ? m_layer->scrollXOffset() : 0; |
392 } | 441 } |
393 | 442 |
394 int RenderBox::scrollTop() const | 443 int RenderBox::scrollTop() const |
395 { | 444 { |
396 return hasOverflowClip() ? layer()->scrollYOffset() : 0; | 445 return hasOverflowClip() ? m_layer->scrollYOffset() : 0; |
397 } | 446 } |
398 | 447 |
399 void RenderBox::setScrollLeft(int newLeft) | 448 void RenderBox::setScrollLeft(int newLeft) |
400 { | 449 { |
401 if (hasOverflowClip()) | 450 if (hasOverflowClip()) |
402 layer()->scrollToXOffset(newLeft); | 451 m_layer->scrollToXOffset(newLeft); |
403 } | 452 } |
404 | 453 |
405 void RenderBox::setScrollTop(int newTop) | 454 void RenderBox::setScrollTop(int newTop) |
406 { | 455 { |
407 if (hasOverflowClip()) | 456 if (hasOverflowClip()) |
408 layer()->scrollToYOffset(newTop); | 457 m_layer->scrollToYOffset(newTop); |
409 } | 458 } |
410 | 459 |
411 int RenderBox::paddingTop(bool) const | 460 int RenderBox::paddingTop(bool) const |
412 { | 461 { |
413 int w = 0; | 462 int w = 0; |
414 Length padding = style()->paddingTop(); | 463 Length padding = style()->paddingTop(); |
415 if (padding.isPercent()) | 464 if (padding.isPercent()) |
416 w = containingBlock()->availableWidth(); | 465 w = containingBlock()->availableWidth(); |
417 return padding.calcMinValue(w); | 466 return padding.calcMinValue(w); |
418 } | 467 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 return rect; | 511 return rect; |
463 } | 512 } |
464 | 513 |
465 FloatQuad RenderBox::absoluteContentQuad() const | 514 FloatQuad RenderBox::absoluteContentQuad() const |
466 { | 515 { |
467 IntRect rect = contentBoxRect(); | 516 IntRect rect = contentBoxRect(); |
468 return localToAbsoluteQuad(FloatRect(rect)); | 517 return localToAbsoluteQuad(FloatRect(rect)); |
469 } | 518 } |
470 | 519 |
471 | 520 |
472 IntRect RenderBox::outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContai
ner*/) const | 521 IntRect RenderBox::outlineBoundsForRepaint(RenderBox* /*repaintContainer*/) cons
t |
473 { | 522 { |
474 IntRect box = borderBoundingBox(); | 523 IntRect box = borderBoundingBox(); |
475 adjustRectForOutlineAndShadow(box); | 524 adjustRectForOutlineAndShadow(box); |
476 | 525 |
477 FloatQuad absOutlineQuad = localToAbsoluteQuad(FloatRect(box)); | 526 FloatQuad absOutlineQuad = localToAbsoluteQuad(FloatRect(box)); |
478 box = absOutlineQuad.enclosingBoundingBox(); | 527 box = absOutlineQuad.enclosingBoundingBox(); |
479 | 528 |
480 // FIXME: layoutDelta needs to be applied in parts before/after transforms a
nd | 529 // FIXME: layoutDelta needs to be applied in parts before/after transforms a
nd |
481 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 530 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
482 box.move(view()->layoutDelta()); | 531 box.move(view()->layoutDelta()); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 | 1314 |
1266 int bLeft = borderLeft(); | 1315 int bLeft = borderLeft(); |
1267 int bTop = borderTop(); | 1316 int bTop = borderTop(); |
1268 | 1317 |
1269 int clipX = tx + bLeft; | 1318 int clipX = tx + bLeft; |
1270 int clipY = ty + bTop; | 1319 int clipY = ty + bTop; |
1271 int clipWidth = width() - bLeft - borderRight(); | 1320 int clipWidth = width() - bLeft - borderRight(); |
1272 int clipHeight = height() - bTop - borderBottom(); | 1321 int clipHeight = height() - bTop - borderBottom(); |
1273 | 1322 |
1274 // Subtract out scrollbars if we have them. | 1323 // Subtract out scrollbars if we have them. |
1275 if (layer()) { | 1324 if (m_layer) { |
1276 clipWidth -= layer()->verticalScrollbarWidth(); | 1325 clipWidth -= m_layer->verticalScrollbarWidth(); |
1277 clipHeight -= layer()->horizontalScrollbarHeight(); | 1326 clipHeight -= m_layer->horizontalScrollbarHeight(); |
1278 } | 1327 } |
1279 | 1328 |
1280 return IntRect(clipX, clipY, clipWidth, clipHeight); | 1329 return IntRect(clipX, clipY, clipWidth, clipHeight); |
1281 } | 1330 } |
1282 | 1331 |
1283 IntRect RenderBox::getClipRect(int tx, int ty) | 1332 IntRect RenderBox::getClipRect(int tx, int ty) |
1284 { | 1333 { |
1285 int clipX = tx; | 1334 int clipX = tx; |
1286 int clipY = ty; | 1335 int clipY = ty; |
1287 int clipWidth = width(); | 1336 int clipWidth = width(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 } | 1368 } |
1320 | 1369 |
1321 FloatPoint RenderBox::localToAbsolute(FloatPoint localPoint, bool fixed, bool us
eTransforms) const | 1370 FloatPoint RenderBox::localToAbsolute(FloatPoint localPoint, bool fixed, bool us
eTransforms) const |
1322 { | 1371 { |
1323 if (RenderView* v = view()) { | 1372 if (RenderView* v = view()) { |
1324 if (v->layoutStateEnabled()) { | 1373 if (v->layoutStateEnabled()) { |
1325 LayoutState* layoutState = v->layoutState(); | 1374 LayoutState* layoutState = v->layoutState(); |
1326 IntSize offset = layoutState->m_offset; | 1375 IntSize offset = layoutState->m_offset; |
1327 offset.expand(x(), y()); | 1376 offset.expand(x(), y()); |
1328 localPoint += offset; | 1377 localPoint += offset; |
1329 if (style()->position() == RelativePosition && layer()) | 1378 if (style()->position() == RelativePosition && m_layer) |
1330 localPoint += layer()->relativePositionOffset(); | 1379 localPoint += m_layer->relativePositionOffset(); |
1331 return localPoint; | 1380 return localPoint; |
1332 } | 1381 } |
1333 } | 1382 } |
1334 | 1383 |
1335 if (style()->position() == FixedPosition) | 1384 if (style()->position() == FixedPosition) |
1336 fixed = true; | 1385 fixed = true; |
1337 | 1386 |
1338 RenderObject* o = container(); | 1387 RenderObject* o = container(); |
1339 if (o) { | 1388 if (o) { |
1340 if (useTransforms && layer() && layer()->transform()) { | 1389 if (useTransforms && m_layer && m_layer->transform()) { |
1341 fixed = false; // Elements with transforms act as a containing bloc
k for fixed position descendants | 1390 fixed = false; // Elements with transforms act as a containing bloc
k for fixed position descendants |
1342 localPoint = layer()->transform()->mapPoint(localPoint); | 1391 localPoint = m_layer->transform()->mapPoint(localPoint); |
1343 } | 1392 } |
1344 | 1393 |
1345 localPoint += offsetFromContainer(o); | 1394 localPoint += offsetFromContainer(o); |
1346 | 1395 |
1347 return o->localToAbsolute(localPoint, fixed, useTransforms); | 1396 return o->localToAbsolute(localPoint, fixed, useTransforms); |
1348 } | 1397 } |
1349 | 1398 |
1350 return FloatPoint(); | 1399 return FloatPoint(); |
1351 } | 1400 } |
1352 | 1401 |
1353 FloatPoint RenderBox::absoluteToLocal(FloatPoint containerPoint, bool fixed, boo
l useTransforms) const | 1402 FloatPoint RenderBox::absoluteToLocal(FloatPoint containerPoint, bool fixed, boo
l useTransforms) const |
1354 { | 1403 { |
1355 // We don't expect absoluteToLocal() to be called during layout (yet) | 1404 // We don't expect absoluteToLocal() to be called during layout (yet) |
1356 ASSERT(!view() || !view()->layoutStateEnabled()); | 1405 ASSERT(!view() || !view()->layoutStateEnabled()); |
1357 | 1406 |
1358 if (style()->position() == FixedPosition) | 1407 if (style()->position() == FixedPosition) |
1359 fixed = true; | 1408 fixed = true; |
1360 | 1409 |
1361 if (useTransforms && layer() && layer()->transform()) | 1410 if (useTransforms && m_layer && m_layer->transform()) |
1362 fixed = false; | 1411 fixed = false; |
1363 | 1412 |
1364 RenderObject* o = container(); | 1413 RenderObject* o = container(); |
1365 if (o) { | 1414 if (o) { |
1366 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra
nsforms); | 1415 FloatPoint localPoint = o->absoluteToLocal(containerPoint, fixed, useTra
nsforms); |
1367 localPoint -= offsetFromContainer(o); | 1416 localPoint -= offsetFromContainer(o); |
1368 if (useTransforms && layer() && layer()->transform()) | 1417 if (useTransforms && m_layer && m_layer->transform()) |
1369 localPoint = layer()->transform()->inverse().mapPoint(localPoint); | 1418 localPoint = m_layer->transform()->inverse().mapPoint(localPoint); |
1370 return localPoint; | 1419 return localPoint; |
1371 } | 1420 } |
1372 | 1421 |
1373 return FloatPoint(); | 1422 return FloatPoint(); |
1374 } | 1423 } |
1375 | 1424 |
1376 FloatQuad RenderBox::localToContainerQuad(const FloatQuad& localQuad, RenderBoxM
odelObject* repaintContainer, bool fixed) const | 1425 FloatQuad RenderBox::localToContainerQuad(const FloatQuad& localQuad, RenderBox*
repaintContainer, bool fixed) const |
1377 { | 1426 { |
1378 if (repaintContainer == this) | 1427 if (repaintContainer == this) |
1379 return localQuad; | 1428 return localQuad; |
1380 | 1429 |
1381 if (style()->position() == FixedPosition) | 1430 if (style()->position() == FixedPosition) |
1382 fixed = true; | 1431 fixed = true; |
1383 | 1432 |
1384 RenderObject* o = container(); | 1433 RenderObject* o = container(); |
1385 if (o) { | 1434 if (o) { |
1386 FloatQuad quad = localQuad; | 1435 FloatQuad quad = localQuad; |
1387 if (layer() && layer()->transform()) { | 1436 if (m_layer && m_layer->transform()) { |
1388 fixed = false; // Elements with transforms act as a containing bloc
k for fixed position descendants | 1437 fixed = false; // Elements with transforms act as a containing bloc
k for fixed position descendants |
1389 quad = layer()->transform()->mapQuad(quad); | 1438 quad = m_layer->transform()->mapQuad(quad); |
1390 } | 1439 } |
1391 quad += offsetFromContainer(o); | 1440 quad += offsetFromContainer(o); |
1392 return o->localToContainerQuad(quad, repaintContainer, fixed); | 1441 return o->localToContainerQuad(quad, repaintContainer, fixed); |
1393 } | 1442 } |
1394 | 1443 |
1395 return FloatQuad(); | 1444 return FloatQuad(); |
1396 } | 1445 } |
1397 | 1446 |
1398 IntSize RenderBox::offsetFromContainer(RenderObject* o) const | 1447 IntSize RenderBox::offsetFromContainer(RenderObject* o) const |
1399 { | 1448 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 } else | 1481 } else |
1433 m_inlineBoxWrapper->dirtyLineBoxes(); | 1482 m_inlineBoxWrapper->dirtyLineBoxes(); |
1434 } | 1483 } |
1435 } | 1484 } |
1436 | 1485 |
1437 void RenderBox::position(InlineBox* box) | 1486 void RenderBox::position(InlineBox* box) |
1438 { | 1487 { |
1439 if (isPositioned()) { | 1488 if (isPositioned()) { |
1440 // Cache the x position only if we were an INLINE type originally. | 1489 // Cache the x position only if we were an INLINE type originally. |
1441 bool wasInline = style()->isOriginalDisplayInlineType(); | 1490 bool wasInline = style()->isOriginalDisplayInlineType(); |
1442 if (wasInline && style()->hasStaticX()) { | 1491 if (wasInline && hasStaticX()) { |
1443 // The value is cached in the xPos of the box. We only need this va
lue if | 1492 // The value is cached in the xPos of the box. We only need this va
lue if |
1444 // our object was inline originally, since otherwise it would have e
nded up underneath | 1493 // our object was inline originally, since otherwise it would have e
nded up underneath |
1445 // the inlines. | 1494 // the inlines. |
1446 layer()->setStaticX(box->xPos()); | 1495 setStaticX(box->xPos()); |
1447 setChildNeedsLayout(true, false); // Just go ahead and mark the posi
tioned object as needing layout, so it will update its position properly. | 1496 setChildNeedsLayout(true, false); // Just go ahead and mark the posi
tioned object as needing layout, so it will update its position properly. |
1448 } else if (!wasInline && style()->hasStaticY()) { | 1497 } else if (!wasInline && hasStaticY()) { |
1449 // Our object was a block originally, so we make our normal flow pos
ition be | 1498 // Our object was a block originally, so we make our normal flow pos
ition be |
1450 // just below the line box (as though all the inlines that came befo
re us got | 1499 // just below the line box (as though all the inlines that came befo
re us got |
1451 // wrapped in an anonymous block, which is what would have happened
had we been | 1500 // wrapped in an anonymous block, which is what would have happened
had we been |
1452 // in flow). This value was cached in the yPos() of the box. | 1501 // in flow). This value was cached in the yPos() of the box. |
1453 layer()->setStaticY(box->yPos()); | 1502 setStaticY(box->yPos()); |
1454 setChildNeedsLayout(true, false); // Just go ahead and mark the posi
tioned object as needing layout, so it will update its position properly. | 1503 setChildNeedsLayout(true, false); // Just go ahead and mark the posi
tioned object as needing layout, so it will update its position properly. |
1455 } | 1504 } |
1456 | 1505 |
1457 // Nuke the box. | 1506 // Nuke the box. |
1458 box->remove(); | 1507 box->remove(); |
1459 box->destroy(renderArena()); | 1508 box->destroy(renderArena()); |
1460 } else if (isReplaced()) { | 1509 } else if (isReplaced()) { |
1461 setLocation(box->xPos(), box->yPos()); | 1510 setLocation(box->xPos(), box->yPos()); |
1462 m_inlineBoxWrapper = box; | 1511 m_inlineBoxWrapper = box; |
1463 } | 1512 } |
1464 } | 1513 } |
1465 | 1514 |
1466 void RenderBox::deleteLineBoxWrapper() | 1515 void RenderBox::deleteLineBoxWrapper() |
1467 { | 1516 { |
1468 if (m_inlineBoxWrapper) { | 1517 if (m_inlineBoxWrapper) { |
1469 if (!documentBeingDestroyed()) | 1518 if (!documentBeingDestroyed()) |
1470 m_inlineBoxWrapper->remove(); | 1519 m_inlineBoxWrapper->remove(); |
1471 m_inlineBoxWrapper->destroy(renderArena()); | 1520 m_inlineBoxWrapper->destroy(renderArena()); |
1472 m_inlineBoxWrapper = 0; | 1521 m_inlineBoxWrapper = 0; |
1473 } | 1522 } |
1474 } | 1523 } |
1475 | 1524 |
1476 IntRect RenderBox::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintCo
ntainer) | 1525 IntRect RenderBox::clippedOverflowRectForRepaint(RenderBox* repaintContainer) |
1477 { | 1526 { |
1478 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 1527 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
1479 return IntRect(); | 1528 return IntRect(); |
1480 | 1529 |
1481 IntRect r = overflowRect(false); | 1530 IntRect r = overflowRect(false); |
1482 | 1531 |
1483 RenderView* v = view(); | 1532 RenderView* v = view(); |
1484 if (v) { | 1533 if (v) { |
1485 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 1534 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
1486 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 1535 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
1487 r.move(v->layoutDelta()); | 1536 r.move(v->layoutDelta()); |
1488 } | 1537 } |
1489 | 1538 |
1490 if (style()) { | 1539 if (style()) { |
1491 if (style()->hasAppearance()) | 1540 if (style()->hasAppearance()) |
1492 // The theme may wish to inflate the rect used when repainting. | 1541 // The theme may wish to inflate the rect used when repainting. |
1493 theme()->adjustRepaintRect(this, r); | 1542 theme()->adjustRepaintRect(this, r); |
1494 | 1543 |
1495 // We have to use maximalOutlineSize() because a child might have an out
line | 1544 // We have to use maximalOutlineSize() because a child might have an out
line |
1496 // that projects outside of our overflowRect. | 1545 // that projects outside of our overflowRect. |
1497 if (v) { | 1546 if (v) { |
1498 ASSERT(style()->outlineSize() <= v->maximalOutlineSize()); | 1547 ASSERT(style()->outlineSize() <= v->maximalOutlineSize()); |
1499 r.inflate(v->maximalOutlineSize()); | 1548 r.inflate(v->maximalOutlineSize()); |
1500 } | 1549 } |
1501 } | 1550 } |
1502 computeRectForRepaint(repaintContainer, r); | 1551 computeRectForRepaint(repaintContainer, r); |
1503 return r; | 1552 return r; |
1504 } | 1553 } |
1505 | 1554 |
1506 void RenderBox::computeRectForRepaint(RenderBoxModelObject* repaintContainer, In
tRect& rect, bool fixed) | 1555 void RenderBox::computeRectForRepaint(RenderBox* repaintContainer, IntRect& rect
, bool fixed) |
1507 { | 1556 { |
1508 if (RenderView* v = view()) { | 1557 if (RenderView* v = view()) { |
1509 // LayoutState is only valid for root-relative repainting | 1558 // LayoutState is only valid for root-relative repainting |
1510 if (v->layoutStateEnabled() && !repaintContainer) { | 1559 if (v->layoutStateEnabled() && !repaintContainer) { |
1511 LayoutState* layoutState = v->layoutState(); | 1560 LayoutState* layoutState = v->layoutState(); |
1512 if (style()->position() == RelativePosition && layer()) | 1561 if (style()->position() == RelativePosition && m_layer) |
1513 rect.move(layer()->relativePositionOffset()); | 1562 rect.move(m_layer->relativePositionOffset()); |
1514 | 1563 |
1515 rect.move(x(), y()); | 1564 rect.move(x(), y()); |
1516 rect.move(layoutState->m_offset); | 1565 rect.move(layoutState->m_offset); |
1517 if (layoutState->m_clipped) | 1566 if (layoutState->m_clipped) |
1518 rect.intersect(layoutState->m_clipRect); | 1567 rect.intersect(layoutState->m_clipRect); |
1519 return; | 1568 return; |
1520 } | 1569 } |
1521 } | 1570 } |
1522 | 1571 |
1523 if (hasReflection()) | 1572 if (hasReflection()) |
(...skipping 17 matching lines...) Expand all Loading... |
1541 if (cb->hasColumns()) { | 1590 if (cb->hasColumns()) { |
1542 IntRect repaintRect(topLeft, rect.size()); | 1591 IntRect repaintRect(topLeft, rect.size()); |
1543 cb->adjustRectForColumns(repaintRect); | 1592 cb->adjustRectForColumns(repaintRect); |
1544 topLeft = repaintRect.location(); | 1593 topLeft = repaintRect.location(); |
1545 rect = repaintRect; | 1594 rect = repaintRect; |
1546 } | 1595 } |
1547 } | 1596 } |
1548 | 1597 |
1549 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box | 1598 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box |
1550 // in the parent's coordinate space that encloses us. | 1599 // in the parent's coordinate space that encloses us. |
1551 if (layer() && layer()->transform()) { | 1600 if (m_layer && m_layer->transform()) { |
1552 fixed = false; | 1601 fixed = false; |
1553 rect = layer()->transform()->mapRect(rect); | 1602 rect = m_layer->transform()->mapRect(rect); |
1554 // FIXME: this clobbers topLeft adjustment done for multicol above | 1603 // FIXME: this clobbers topLeft adjustment done for multicol above |
1555 topLeft = rect.location(); | 1604 topLeft = rect.location(); |
1556 topLeft.move(x(), y()); | 1605 topLeft.move(x(), y()); |
1557 } | 1606 } |
1558 | 1607 |
1559 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
RenderInline()) | 1608 if (style()->position() == AbsolutePosition && o->isRelPositioned() && o->is
RenderInline()) |
1560 topLeft += toRenderInline(o)->relativePositionedInlineOffset(this); | 1609 topLeft += toRenderInline(o)->relativePositionedInlineOffset(this); |
1561 else if (style()->position() == RelativePosition && layer()) { | 1610 else if (style()->position() == RelativePosition && m_layer) { |
1562 // Apply the relative position offset when invalidating a rectangle. Th
e layer | 1611 // Apply the relative position offset when invalidating a rectangle. Th
e layer |
1563 // is translated, but the render box isn't, so we need to do this to get
the | 1612 // is translated, but the render box isn't, so we need to do this to get
the |
1564 // right dirty rect. Since this is called from RenderObject::setStyle,
the relative position | 1613 // right dirty rect. Since this is called from RenderObject::setStyle,
the relative position |
1565 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 1614 // flag on the RenderObject has been cleared, so use the one on the styl
e(). |
1566 topLeft += layer()->relativePositionOffset(); | 1615 topLeft += m_layer->relativePositionOffset(); |
1567 } | 1616 } |
1568 | 1617 |
1569 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, | 1618 // FIXME: We ignore the lightweight clipping rect that controls use, since i
f |o| is in mid-layout, |
1570 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. | 1619 // its controlClipRect will be wrong. For overflow clip we use the values ca
ched by the layer. |
1571 if (o->hasOverflowClip()) { | 1620 if (o->hasOverflowClip()) { |
1572 RenderBox* containerBox = toRenderBox(o); | 1621 RenderBox* containerBox = toRenderBox(o); |
1573 | 1622 |
1574 // o->height() is inaccurate if we're in the middle of a layout of |o|,
so use the | 1623 // o->height() is inaccurate if we're in the middle of a layout of |o|,
so use the |
1575 // layer's size instead. Even if the layer's size is wrong, the layer i
tself will repaint | 1624 // layer's size instead. Even if the layer's size is wrong, the layer i
tself will repaint |
1576 // anyway if its size does change. | 1625 // anyway if its size does change. |
(...skipping 21 matching lines...) Expand all Loading... |
1598 // since the object may not have gotten a layout. | 1647 // since the object may not have gotten a layout. |
1599 m_frameRect = rect; | 1648 m_frameRect = rect; |
1600 repaint(); | 1649 repaint(); |
1601 repaintOverhangingFloats(true); | 1650 repaintOverhangingFloats(true); |
1602 m_frameRect = IntRect(newX, newY, newWidth, newHeight); | 1651 m_frameRect = IntRect(newX, newY, newWidth, newHeight); |
1603 repaint(); | 1652 repaint(); |
1604 repaintOverhangingFloats(true); | 1653 repaintOverhangingFloats(true); |
1605 } | 1654 } |
1606 } | 1655 } |
1607 | 1656 |
| 1657 int RenderBox::relativePositionOffsetX() const |
| 1658 { |
| 1659 if (!style()->left().isAuto()) { |
| 1660 if (!style()->right().isAuto() && containingBlock()->style()->direction(
) == RTL) |
| 1661 return -style()->right().calcValue(containingBlockWidth()); |
| 1662 return style()->left().calcValue(containingBlockWidth()); |
| 1663 } |
| 1664 if (!style()->right().isAuto()) |
| 1665 return -style()->right().calcValue(containingBlockWidth()); |
| 1666 return 0; |
| 1667 } |
| 1668 |
| 1669 int RenderBox::relativePositionOffsetY() const |
| 1670 { |
| 1671 if (!style()->top().isAuto()) { |
| 1672 if (!style()->top().isPercent() || containingBlock()->style()->height().
isFixed()) |
| 1673 return style()->top().calcValue(containingBlockHeight()); |
| 1674 } else if (!style()->bottom().isAuto()) { |
| 1675 if (!style()->bottom().isPercent() || containingBlock()->style()->height
().isFixed()) |
| 1676 return -style()->bottom().calcValue(containingBlockHeight()); |
| 1677 } |
| 1678 return 0; |
| 1679 } |
| 1680 |
1608 void RenderBox::calcWidth() | 1681 void RenderBox::calcWidth() |
1609 { | 1682 { |
1610 if (isPositioned()) { | 1683 if (isPositioned()) { |
1611 calcAbsoluteHorizontal(); | 1684 calcAbsoluteHorizontal(); |
1612 return; | 1685 return; |
1613 } | 1686 } |
1614 | 1687 |
1615 // If layout is limited to a subtree, the subtree root's width does not chan
ge. | 1688 // If layout is limited to a subtree, the subtree root's width does not chan
ge. |
1616 if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) =
= this) | 1689 if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) =
= this) |
1617 return; | 1690 return; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 // We need to stop here, since we don't want to increase the height of the t
able | 2113 // We need to stop here, since we don't want to increase the height of the t
able |
2041 // artificially. We're going to rely on this cell getting expanded to some
new | 2114 // artificially. We're going to rely on this cell getting expanded to some
new |
2042 // height, and then when we lay out again we'll use the calculation below. | 2115 // height, and then when we lay out again we'll use the calculation below. |
2043 if (isTableCell() && (h.isAuto() || h.isPercent())) | 2116 if (isTableCell() && (h.isAuto() || h.isPercent())) |
2044 return overrideSize() - (borderLeft() + borderRight() + paddingLeft() +
paddingRight()); | 2117 return overrideSize() - (borderLeft() + borderRight() + paddingLeft() +
paddingRight()); |
2045 | 2118 |
2046 if (h.isPercent()) | 2119 if (h.isPercent()) |
2047 return calcContentBoxHeight(h.calcValue(containingBlock()->availableHeigh
t())); | 2120 return calcContentBoxHeight(h.calcValue(containingBlock()->availableHeigh
t())); |
2048 | 2121 |
2049 if (isRenderBlock() && isPositioned() && style()->height().isAuto() && !(sty
le()->top().isAuto() || style()->bottom().isAuto())) { | 2122 if (isRenderBlock() && isPositioned() && style()->height().isAuto() && !(sty
le()->top().isAuto() || style()->bottom().isAuto())) { |
2050 RenderBlock* block = const_cast<RenderBlock*>(toRenderBlock(this)); | 2123 RenderBlock* block = const_cast<RenderBlock*>(static_cast<const RenderBl
ock*>(this)); |
2051 int oldHeight = block->height(); | 2124 int oldHeight = block->height(); |
2052 block->calcHeight(); | 2125 block->calcHeight(); |
2053 int newHeight = block->calcContentBoxHeight(block->contentHeight()); | 2126 int newHeight = block->calcContentBoxHeight(block->contentHeight()); |
2054 block->setHeight(oldHeight); | 2127 block->setHeight(oldHeight); |
2055 return calcContentBoxHeight(newHeight); | 2128 return calcContentBoxHeight(newHeight); |
2056 } | 2129 } |
2057 | 2130 |
2058 return containingBlock()->availableHeight(); | 2131 return containingBlock()->availableHeight(); |
2059 } | 2132 } |
2060 | 2133 |
2061 void RenderBox::calcVerticalMargins() | 2134 void RenderBox::calcVerticalMargins() |
2062 { | 2135 { |
2063 if (isTableCell()) { | 2136 if (isTableCell()) { |
2064 m_marginTop = 0; | 2137 m_marginTop = 0; |
2065 m_marginBottom = 0; | 2138 m_marginBottom = 0; |
2066 return; | 2139 return; |
2067 } | 2140 } |
2068 | 2141 |
2069 // margins are calculated with respect to the _width_ of | 2142 // margins are calculated with respect to the _width_ of |
2070 // the containing block (8.3) | 2143 // the containing block (8.3) |
2071 int cw = containingBlock()->contentWidth(); | 2144 int cw = containingBlock()->contentWidth(); |
2072 | 2145 |
2073 m_marginTop = style()->marginTop().calcMinValue(cw); | 2146 m_marginTop = style()->marginTop().calcMinValue(cw); |
2074 m_marginBottom = style()->marginBottom().calcMinValue(cw); | 2147 m_marginBottom = style()->marginBottom().calcMinValue(cw); |
2075 } | 2148 } |
2076 | 2149 |
| 2150 int RenderBox::staticX() const |
| 2151 { |
| 2152 return m_layer ? m_layer->staticX() : 0; |
| 2153 } |
| 2154 |
| 2155 int RenderBox::staticY() const |
| 2156 { |
| 2157 return m_layer ? m_layer->staticY() : 0; |
| 2158 } |
| 2159 |
| 2160 void RenderBox::setStaticX(int staticX) |
| 2161 { |
| 2162 ASSERT(isPositioned() || isRelPositioned()); |
| 2163 m_layer->setStaticX(staticX); |
| 2164 } |
| 2165 |
| 2166 void RenderBox::setStaticY(int staticY) |
| 2167 { |
| 2168 ASSERT(isPositioned() || isRelPositioned()); |
| 2169 |
| 2170 if (staticY == m_layer->staticY()) |
| 2171 return; |
| 2172 |
| 2173 m_layer->setStaticY(staticY); |
| 2174 setChildNeedsLayout(true, false); |
| 2175 } |
| 2176 |
2077 int RenderBox::containingBlockWidthForPositioned(const RenderObject* containingB
lock) const | 2177 int RenderBox::containingBlockWidthForPositioned(const RenderObject* containingB
lock) const |
2078 { | 2178 { |
2079 if (containingBlock->isRenderInline()) { | 2179 if (containingBlock->isRenderInline()) { |
2080 ASSERT(containingBlock->isRelPositioned()); | 2180 ASSERT(containingBlock->isRelPositioned()); |
2081 | 2181 |
2082 const RenderInline* flow = toRenderInline(containingBlock); | 2182 const RenderInline* flow = toRenderInline(containingBlock); |
2083 InlineFlowBox* first = flow->firstLineBox(); | 2183 InlineFlowBox* first = flow->firstLineBox(); |
2084 InlineFlowBox* last = flow->lastLineBox(); | 2184 InlineFlowBox* last = flow->lastLineBox(); |
2085 | 2185 |
2086 // If the containing block is empty, return a width of 0. | 2186 // If the containing block is empty, return a width of 0. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 * fixed positioned elements is the initial containing block instead of the | 2288 * fixed positioned elements is the initial containing block instead of the |
2189 * viewport, and all scrollable boxes should be assumed to be scrolled to th
eir | 2289 * viewport, and all scrollable boxes should be assumed to be scrolled to th
eir |
2190 * origin. | 2290 * origin. |
2191 \*--------------------------------------------------------------------------
-*/ | 2291 \*--------------------------------------------------------------------------
-*/ |
2192 | 2292 |
2193 // see FIXME 2 | 2293 // see FIXME 2 |
2194 // Calculate the static distance if needed. | 2294 // Calculate the static distance if needed. |
2195 if (left.isAuto() && right.isAuto()) { | 2295 if (left.isAuto() && right.isAuto()) { |
2196 if (containerDirection == LTR) { | 2296 if (containerDirection == LTR) { |
2197 // 'staticX' should already have been set through layout of the pare
nt. | 2297 // 'staticX' should already have been set through layout of the pare
nt. |
2198 int staticPosition = layer()->staticX() - containerBlock->borderLeft
(); | 2298 int staticPosition = staticX() - containerBlock->borderLeft(); |
2199 for (RenderBox* po = parentBox(); po && po != containerBlock; po = p
o->parentBox()) | 2299 for (RenderBox* po = parentBox(); po && po != containerBlock; po = p
o->parentBox()) |
2200 staticPosition += po->x(); | 2300 staticPosition += po->x(); |
2201 left.setValue(Fixed, staticPosition); | 2301 left.setValue(Fixed, staticPosition); |
2202 } else { | 2302 } else { |
2203 RenderBox* po = parentBox(); | 2303 RenderBox* po = parentBox(); |
2204 // 'staticX' should already have been set through layout of the pare
nt. | 2304 // 'staticX' should already have been set through layout of the pare
nt. |
2205 int staticPosition = layer()->staticX() + containerWidth + container
Block->borderRight() - po->width(); | 2305 int staticPosition = staticX() + containerWidth + containerBlock->bo
rderRight() - po->width(); |
2206 for (; po && po != containerBlock; po = po->parentBox()) | 2306 for (; po && po != containerBlock; po = po->parentBox()) |
2207 staticPosition -= po->x(); | 2307 staticPosition -= po->x(); |
2208 right.setValue(Fixed, staticPosition); | 2308 right.setValue(Fixed, staticPosition); |
2209 } | 2309 } |
2210 } | 2310 } |
2211 | 2311 |
2212 // Calculate constraint equation values for 'width' case. | 2312 // Calculate constraint equation values for 'width' case. |
2213 int widthResult; | 2313 int widthResult; |
2214 int xResult; | 2314 int xResult; |
2215 calcAbsoluteHorizontalValues(style()->width(), containerBlock, containerDire
ction, | 2315 calcAbsoluteHorizontalValues(style()->width(), containerBlock, containerDire
ction, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 * | 2583 * |
2484 * For the purposes of calculating the static position, the containing block | 2584 * For the purposes of calculating the static position, the containing block |
2485 * of fixed positioned elements is the initial containing block instead of | 2585 * of fixed positioned elements is the initial containing block instead of |
2486 * the viewport. | 2586 * the viewport. |
2487 \*--------------------------------------------------------------------------
-*/ | 2587 \*--------------------------------------------------------------------------
-*/ |
2488 | 2588 |
2489 // see FIXME 2 | 2589 // see FIXME 2 |
2490 // Calculate the static distance if needed. | 2590 // Calculate the static distance if needed. |
2491 if (top.isAuto() && bottom.isAuto()) { | 2591 if (top.isAuto() && bottom.isAuto()) { |
2492 // staticY should already have been set through layout of the parent() | 2592 // staticY should already have been set through layout of the parent() |
2493 int staticTop = layer()->staticY() - containerBlock->borderTop(); | 2593 int staticTop = staticY() - containerBlock->borderTop(); |
2494 for (RenderBox* po = parentBox(); po && po != containerBlock; po = po->p
arentBox()) { | 2594 for (RenderBox* po = parentBox(); po && po != containerBlock; po = po->p
arentBox()) { |
2495 if (!po->isTableRow()) | 2595 if (!po->isTableRow()) |
2496 staticTop += po->y(); | 2596 staticTop += po->y(); |
2497 } | 2597 } |
2498 top.setValue(Fixed, staticTop); | 2598 top.setValue(Fixed, staticTop); |
2499 } | 2599 } |
2500 | 2600 |
2501 | 2601 |
2502 int h; // Needed to compute overflow. | 2602 int h; // Needed to compute overflow. |
2503 int y; | 2603 int y; |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 /*-----------------------------------------------------------------------*\ | 2810 /*-----------------------------------------------------------------------*\ |
2711 * 2. If both 'left' and 'right' have the value 'auto', then if 'direction' | 2811 * 2. If both 'left' and 'right' have the value 'auto', then if 'direction' |
2712 * of the containing block is 'ltr', set 'left' to the static position; | 2812 * of the containing block is 'ltr', set 'left' to the static position; |
2713 * else if 'direction' is 'rtl', set 'right' to the static position. | 2813 * else if 'direction' is 'rtl', set 'right' to the static position. |
2714 \*-----------------------------------------------------------------------*/ | 2814 \*-----------------------------------------------------------------------*/ |
2715 // see FIXME 2 | 2815 // see FIXME 2 |
2716 if (left.isAuto() && right.isAuto()) { | 2816 if (left.isAuto() && right.isAuto()) { |
2717 // see FIXME 1 | 2817 // see FIXME 1 |
2718 if (containerDirection == LTR) { | 2818 if (containerDirection == LTR) { |
2719 // 'staticX' should already have been set through layout of the pare
nt. | 2819 // 'staticX' should already have been set through layout of the pare
nt. |
2720 int staticPosition = layer()->staticX() - containerBlock->borderLeft
(); | 2820 int staticPosition = staticX() - containerBlock->borderLeft(); |
2721 for (RenderBox* po = parentBox(); po && po != containerBlock; po = p
o->parentBox()) | 2821 for (RenderBox* po = parentBox(); po && po != containerBlock; po = p
o->parentBox()) |
2722 staticPosition += po->x(); | 2822 staticPosition += po->x(); |
2723 left.setValue(Fixed, staticPosition); | 2823 left.setValue(Fixed, staticPosition); |
2724 } else { | 2824 } else { |
2725 RenderBox* po = parentBox(); | 2825 RenderBox* po = parentBox(); |
2726 // 'staticX' should already have been set through layout of the pare
nt. | 2826 // 'staticX' should already have been set through layout of the pare
nt. |
2727 int staticPosition = layer()->staticX() + containerWidth + container
Block->borderRight() - po->width(); | 2827 int staticPosition = staticX() + containerWidth + containerBlock->bo
rderRight() - po->width(); |
2728 for (; po && po != containerBlock; po = po->parentBox()) | 2828 for (; po && po != containerBlock; po = po->parentBox()) |
2729 staticPosition -= po->x(); | 2829 staticPosition -= po->x(); |
2730 right.setValue(Fixed, staticPosition); | 2830 right.setValue(Fixed, staticPosition); |
2731 } | 2831 } |
2732 } | 2832 } |
2733 | 2833 |
2734 /*-----------------------------------------------------------------------*\ | 2834 /*-----------------------------------------------------------------------*\ |
2735 * 3. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left' | 2835 * 3. If 'left' or 'right' are 'auto', replace any 'auto' on 'margin-left' |
2736 * or 'margin-right' with '0'. | 2836 * or 'margin-right' with '0'. |
2737 \*-----------------------------------------------------------------------*/ | 2837 \*-----------------------------------------------------------------------*/ |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 setHeight(calcReplacedHeight() + borderTop() + borderBottom() + paddingTop()
+ paddingBottom()); | 2976 setHeight(calcReplacedHeight() + borderTop() + borderBottom() + paddingTop()
+ paddingBottom()); |
2877 const int availableSpace = containerHeight - height(); | 2977 const int availableSpace = containerHeight - height(); |
2878 | 2978 |
2879 /*-----------------------------------------------------------------------*\ | 2979 /*-----------------------------------------------------------------------*\ |
2880 * 2. If both 'top' and 'bottom' have the value 'auto', replace 'top' | 2980 * 2. If both 'top' and 'bottom' have the value 'auto', replace 'top' |
2881 * with the element's static position. | 2981 * with the element's static position. |
2882 \*-----------------------------------------------------------------------*/ | 2982 \*-----------------------------------------------------------------------*/ |
2883 // see FIXME 2 | 2983 // see FIXME 2 |
2884 if (top.isAuto() && bottom.isAuto()) { | 2984 if (top.isAuto() && bottom.isAuto()) { |
2885 // staticY should already have been set through layout of the parent(). | 2985 // staticY should already have been set through layout of the parent(). |
2886 int staticTop = layer()->staticY() - containerBlock->borderTop(); | 2986 int staticTop = staticY() - containerBlock->borderTop(); |
2887 for (RenderBox* po = parentBox(); po && po != containerBlock; po = po->p
arentBox()) { | 2987 for (RenderBox* po = parentBox(); po && po != containerBlock; po = po->p
arentBox()) { |
2888 if (!po->isTableRow()) | 2988 if (!po->isTableRow()) |
2889 staticTop += po->y(); | 2989 staticTop += po->y(); |
2890 } | 2990 } |
2891 top.setValue(Fixed, staticTop); | 2991 top.setValue(Fixed, staticTop); |
2892 } | 2992 } |
2893 | 2993 |
2894 /*-----------------------------------------------------------------------*\ | 2994 /*-----------------------------------------------------------------------*\ |
2895 * 3. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or | 2995 * 3. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or |
2896 * 'margin-bottom' with '0'. | 2996 * 'margin-bottom' with '0'. |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3146 #if ENABLE(SVG) | 3246 #if ENABLE(SVG) |
3147 | 3247 |
3148 TransformationMatrix RenderBox::localTransform() const | 3248 TransformationMatrix RenderBox::localTransform() const |
3149 { | 3249 { |
3150 return TransformationMatrix(1, 0, 0, 1, x(), y()); | 3250 return TransformationMatrix(1, 0, 0, 1, x(), y()); |
3151 } | 3251 } |
3152 | 3252 |
3153 #endif | 3253 #endif |
3154 | 3254 |
3155 } // namespace WebCore | 3255 } // namespace WebCore |
OLD | NEW |