| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Size of border belt for autoscroll. When mouse pointer in border belt, | 84 // Size of border belt for autoscroll. When mouse pointer in border belt, |
| 85 // autoscroll is started. | 85 // autoscroll is started. |
| 86 static const int autoscrollBeltSize = 20; | 86 static const int autoscrollBeltSize = 20; |
| 87 static const unsigned backgroundObscurationTestMaxDepth = 4; | 87 static const unsigned backgroundObscurationTestMaxDepth = 4; |
| 88 | 88 |
| 89 static bool skipBodyBackground(const RenderBox* bodyElementRenderer) | 89 static bool skipBodyBackground(const RenderBox* bodyElementRenderer) |
| 90 { | 90 { |
| 91 ASSERT(bodyElementRenderer->isBody()); | 91 ASSERT(bodyElementRenderer->isBody()); |
| 92 // The <body> only paints its background if the root element has defined a b
ackground independent of the body, | 92 // The <body> only paints its background if the root element has defined a b
ackground independent of the body, |
| 93 // or if the <body>'s parent is not the document element's renderer (e.g. in
side SVG foreignObject). | 93 // or if the <body>'s parent is not the document element's renderer (e.g. in
side SVG foreignObject). |
| 94 RenderObject* documentElementRenderer = bodyElementRenderer->document().docu
mentElement()->renderer(); | 94 LayoutObject* documentElementRenderer = bodyElementRenderer->document().docu
mentElement()->renderer(); |
| 95 return documentElementRenderer | 95 return documentElementRenderer |
| 96 && !documentElementRenderer->hasBackground() | 96 && !documentElementRenderer->hasBackground() |
| 97 && (documentElementRenderer == bodyElementRenderer->parent()); | 97 && (documentElementRenderer == bodyElementRenderer->parent()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 RenderBox::RenderBox(ContainerNode* node) | 100 RenderBox::RenderBox(ContainerNode* node) |
| 101 : RenderBoxModelObject(node) | 101 : RenderBoxModelObject(node) |
| 102 , m_intrinsicContentLogicalHeight(-1) | 102 , m_intrinsicContentLogicalHeight(-1) |
| 103 , m_minPreferredLogicalWidth(-1) | 103 , m_minPreferredLogicalWidth(-1) |
| 104 , m_maxPreferredLogicalWidth(-1) | 104 , m_maxPreferredLogicalWidth(-1) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() | 146 void RenderBox::removeFloatingOrPositionedChildFromBlockLists() |
| 147 { | 147 { |
| 148 ASSERT(isFloatingOrOutOfFlowPositioned()); | 148 ASSERT(isFloatingOrOutOfFlowPositioned()); |
| 149 | 149 |
| 150 if (documentBeingDestroyed()) | 150 if (documentBeingDestroyed()) |
| 151 return; | 151 return; |
| 152 | 152 |
| 153 if (isFloating()) { | 153 if (isFloating()) { |
| 154 RenderBlockFlow* parentBlockFlow = 0; | 154 RenderBlockFlow* parentBlockFlow = 0; |
| 155 for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr
= curr->parent()) { | 155 for (LayoutObject* curr = parent(); curr && !curr->isRenderView(); curr
= curr->parent()) { |
| 156 if (curr->isRenderBlockFlow()) { | 156 if (curr->isRenderBlockFlow()) { |
| 157 RenderBlockFlow* currBlockFlow = toRenderBlockFlow(curr); | 157 RenderBlockFlow* currBlockFlow = toRenderBlockFlow(curr); |
| 158 if (!parentBlockFlow || currBlockFlow->containsFloat(this)) | 158 if (!parentBlockFlow || currBlockFlow->containsFloat(this)) |
| 159 parentBlockFlow = currBlockFlow; | 159 parentBlockFlow = currBlockFlow; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (parentBlockFlow) { | 163 if (parentBlockFlow) { |
| 164 parentBlockFlow->markSiblingsWithFloatsForLayout(this); | 164 parentBlockFlow->markSiblingsWithFloatsForLayout(this); |
| 165 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false); | 165 parentBlockFlow->markAllDescendantsWithFloatsForLayout(this, false); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 layer()->scrollableArea()->scrollToXOffset(left); | 229 layer()->scrollableArea()->scrollToXOffset(left); |
| 230 } | 230 } |
| 231 if (int top = layer()->scrollableArea()->scrollYOffset()) { | 231 if (int top = layer()->scrollableArea()->scrollYOffset()) { |
| 232 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); | 232 top = (top / oldStyle->effectiveZoom()) * newStyle->effectiveZoom(); |
| 233 layer()->scrollableArea()->scrollToYOffset(top); | 233 layer()->scrollableArea()->scrollToYOffset(top); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Our opaqueness might have changed without triggering layout. | 237 // Our opaqueness might have changed without triggering layout. |
| 238 if (diff.needsPaintInvalidation()) { | 238 if (diff.needsPaintInvalidation()) { |
| 239 RenderObject* parentToInvalidate = parent(); | 239 LayoutObject* parentToInvalidate = parent(); |
| 240 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn
validate; ++i) { | 240 for (unsigned i = 0; i < backgroundObscurationTestMaxDepth && parentToIn
validate; ++i) { |
| 241 parentToInvalidate->invalidateBackgroundObscurationStatus(); | 241 parentToInvalidate->invalidateBackgroundObscurationStatus(); |
| 242 parentToInvalidate = parentToInvalidate->parent(); | 242 parentToInvalidate = parentToInvalidate->parent(); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 | 245 |
| 246 if (isDocumentElement() || isBody()) { | 246 if (isDocumentElement() || isBody()) { |
| 247 document().view()->recalculateScrollbarOverlayStyle(); | 247 document().view()->recalculateScrollbarOverlayStyle(); |
| 248 document().view()->recalculateCustomScrollbarStyle(); | 248 document().view()->recalculateCustomScrollbarStyle(); |
| 249 } | 249 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 bool boxHasOverflowClip = false; | 314 bool boxHasOverflowClip = false; |
| 315 if (!styleToUse->isOverflowVisible() && isRenderBlock() && (rootLayerScrolls
|| !isViewObject)) { | 315 if (!styleToUse->isOverflowVisible() && isRenderBlock() && (rootLayerScrolls
|| !isViewObject)) { |
| 316 // If overflow has been propagated to the viewport, it has no effect her
e. | 316 // If overflow has been propagated to the viewport, it has no effect her
e. |
| 317 if (node() != document().viewportDefiningElement()) | 317 if (node() != document().viewportDefiningElement()) |
| 318 boxHasOverflowClip = true; | 318 boxHasOverflowClip = true; |
| 319 } | 319 } |
| 320 | 320 |
| 321 if (boxHasOverflowClip != hasOverflowClip()) { | 321 if (boxHasOverflowClip != hasOverflowClip()) { |
| 322 // FIXME: This shouldn't be required if we tracked the visual overflow | 322 // FIXME: This shouldn't be required if we tracked the visual overflow |
| 323 // generated by positioned children or self painting layers. crbug.com/3
45403 | 323 // generated by positioned children or self painting layers. crbug.com/3
45403 |
| 324 for (RenderObject* child = slowFirstChild(); child; child = child->nextS
ibling()) | 324 for (LayoutObject* child = slowFirstChild(); child; child = child->nextS
ibling()) |
| 325 child->setMayNeedPaintInvalidation(); | 325 child->setMayNeedPaintInvalidation(); |
| 326 } | 326 } |
| 327 | 327 |
| 328 setHasOverflowClip(boxHasOverflowClip); | 328 setHasOverflowClip(boxHasOverflowClip); |
| 329 | 329 |
| 330 setHasTransformRelatedProperty(styleToUse->hasTransformRelatedProperty()); | 330 setHasTransformRelatedProperty(styleToUse->hasTransformRelatedProperty()); |
| 331 setHasReflection(styleToUse->boxReflect()); | 331 setHasReflection(styleToUse->boxReflect()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void RenderBox::layout() | 334 void RenderBox::layout() |
| 335 { | 335 { |
| 336 ASSERT(needsLayout()); | 336 ASSERT(needsLayout()); |
| 337 | 337 |
| 338 RenderObject* child = slowFirstChild(); | 338 LayoutObject* child = slowFirstChild(); |
| 339 if (!child) { | 339 if (!child) { |
| 340 clearNeedsLayout(); | 340 clearNeedsLayout(); |
| 341 return; | 341 return; |
| 342 } | 342 } |
| 343 | 343 |
| 344 LayoutState state(*this, locationOffset()); | 344 LayoutState state(*this, locationOffset()); |
| 345 while (child) { | 345 while (child) { |
| 346 child->layoutIfNeeded(); | 346 child->layoutIfNeeded(); |
| 347 ASSERT(!child->needsLayout()); | 347 ASSERT(!child->needsLayout()); |
| 348 child = child->nextSibling(); | 348 child = child->nextSibling(); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 windowAutoscrollPoint.move(autoscrollBeltSize, 0); | 803 windowAutoscrollPoint.move(autoscrollBeltSize, 0); |
| 804 | 804 |
| 805 if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize) | 805 if (windowAutoscrollPoint.y() < windowBox.y() + autoscrollBeltSize) |
| 806 windowAutoscrollPoint.move(0, -autoscrollBeltSize); | 806 windowAutoscrollPoint.move(0, -autoscrollBeltSize); |
| 807 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) | 807 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) |
| 808 windowAutoscrollPoint.move(0, autoscrollBeltSize); | 808 windowAutoscrollPoint.move(0, autoscrollBeltSize); |
| 809 | 809 |
| 810 return windowAutoscrollPoint - windowPoint; | 810 return windowAutoscrollPoint - windowPoint; |
| 811 } | 811 } |
| 812 | 812 |
| 813 RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer) | 813 RenderBox* RenderBox::findAutoscrollable(LayoutObject* renderer) |
| 814 { | 814 { |
| 815 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro
ll())) { | 815 while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscro
ll())) { |
| 816 if (!renderer->parent() && renderer->node() == renderer->document() && r
enderer->document().ownerElement()) | 816 if (!renderer->parent() && renderer->node() == renderer->document() && r
enderer->document().ownerElement()) |
| 817 renderer = renderer->document().ownerElement()->renderer(); | 817 renderer = renderer->document().ownerElement()->renderer(); |
| 818 else | 818 else |
| 819 renderer = renderer->parent(); | 819 renderer = renderer->parent(); |
| 820 } | 820 } |
| 821 | 821 |
| 822 return renderer && renderer->isBox() ? toRenderBox(renderer) : 0; | 822 return renderer && renderer->isBox() ? toRenderBox(renderer) : 0; |
| 823 } | 823 } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 height -= borderAndPaddingLogicalHeight(); | 1128 height -= borderAndPaddingLogicalHeight(); |
| 1129 return std::max(LayoutUnit(), height); | 1129 return std::max(LayoutUnit(), height); |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 // Hit Testing | 1132 // Hit Testing |
| 1133 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) | 1133 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) |
| 1134 { | 1134 { |
| 1135 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 1135 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
| 1136 | 1136 |
| 1137 // Check kids first. | 1137 // Check kids first. |
| 1138 for (RenderObject* child = slowLastChild(); child; child = child->previousSi
bling()) { | 1138 for (LayoutObject* child = slowLastChild(); child; child = child->previousSi
bling()) { |
| 1139 if ((!child->hasLayer() || !toLayoutLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { | 1139 if ((!child->hasLayer() || !toLayoutLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { |
| 1140 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); | 1140 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); |
| 1141 return true; | 1141 return true; |
| 1142 } | 1142 } |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 // Check our bounds next. For this purpose always assume that we can only be
hit in the | 1145 // Check our bounds next. For this purpose always assume that we can only be
hit in the |
| 1146 // foreground phase (which is true for replaced elements like images). | 1146 // foreground phase (which is true for replaced elements like images). |
| 1147 LayoutRect boundsRect = borderBoxRect(); | 1147 LayoutRect boundsRect = borderBoxRect(); |
| 1148 boundsRect.moveBy(adjustedLocation); | 1148 boundsRect.moveBy(adjustedLocation); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 if (childBox->hasOverflowClip() && childStyle->hasBorderRadius()) | 1252 if (childBox->hasOverflowClip() && childStyle->hasBorderRadius()) |
| 1253 return false; | 1253 return false; |
| 1254 } | 1254 } |
| 1255 return true; | 1255 return true; |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 bool RenderBox::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, u
nsigned maxDepthToTest) const | 1258 bool RenderBox::foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, u
nsigned maxDepthToTest) const |
| 1259 { | 1259 { |
| 1260 if (!maxDepthToTest) | 1260 if (!maxDepthToTest) |
| 1261 return false; | 1261 return false; |
| 1262 for (RenderObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { | 1262 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli
ng()) { |
| 1263 if (!child->isBox()) | 1263 if (!child->isBox()) |
| 1264 continue; | 1264 continue; |
| 1265 RenderBox* childBox = toRenderBox(child); | 1265 RenderBox* childBox = toRenderBox(child); |
| 1266 if (!isCandidateForOpaquenessTest(childBox)) | 1266 if (!isCandidateForOpaquenessTest(childBox)) |
| 1267 continue; | 1267 continue; |
| 1268 LayoutPoint childLocation = childBox->location(); | 1268 LayoutPoint childLocation = childBox->location(); |
| 1269 if (childBox->isRelPositioned()) | 1269 if (childBox->isRelPositioned()) |
| 1270 childLocation.move(childBox->relativePositionOffset()); | 1270 childLocation.move(childBox->relativePositionOffset()); |
| 1271 LayoutRect childLocalRect = localRect; | 1271 LayoutRect childLocalRect = localRect; |
| 1272 childLocalRect.moveBy(-childLocation); | 1272 childLocalRect.moveBy(-childLocation); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 markShapeOutsideDependentsForLayout(); | 1358 markShapeOutsideDependentsForLayout(); |
| 1359 } | 1359 } |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(),
true)) | 1362 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(),
true)) |
| 1363 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false)
; | 1363 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false)
; |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 bool RenderBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const
FillLayer& layers, bool drawingBackground) | 1366 bool RenderBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const
FillLayer& layers, bool drawingBackground) |
| 1367 { | 1367 { |
| 1368 Vector<RenderObject*> layerRenderers; | 1368 Vector<LayoutObject*> layerRenderers; |
| 1369 | 1369 |
| 1370 // A background of the body or document must extend to the total visible siz
e of the document. This means the union of the | 1370 // A background of the body or document must extend to the total visible siz
e of the document. This means the union of the |
| 1371 // view and document bounds, since it can be the case that the view is large
r than the document and vice-versa. | 1371 // view and document bounds, since it can be the case that the view is large
r than the document and vice-versa. |
| 1372 // http://dev.w3.org/csswg/css-backgrounds/#the-background | 1372 // http://dev.w3.org/csswg/css-backgrounds/#the-background |
| 1373 if (drawingBackground && (isDocumentElement() || (isBody() && !document().do
cumentElement()->renderer()->hasBackground()))) { | 1373 if (drawingBackground && (isDocumentElement() || (isBody() && !document().do
cumentElement()->renderer()->hasBackground()))) { |
| 1374 layerRenderers.append(document().documentElement()->renderer()); | 1374 layerRenderers.append(document().documentElement()->renderer()); |
| 1375 layerRenderers.append(view()); | 1375 layerRenderers.append(view()); |
| 1376 if (view()->frameView()) | 1376 if (view()->frameView()) |
| 1377 view()->frameView()->setNeedsFullPaintInvalidation(); | 1377 view()->frameView()->setNeedsFullPaintInvalidation(); |
| 1378 } else { | 1378 } else { |
| 1379 layerRenderers.append(this); | 1379 layerRenderers.append(this); |
| 1380 } | 1380 } |
| 1381 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex
t()) { | 1381 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex
t()) { |
| 1382 if (curLayer->image() && image == curLayer->image()->data() && curLayer-
>image()->canRender(*this, style()->effectiveZoom())) { | 1382 if (curLayer->image() && image == curLayer->image()->data() && curLayer-
>image()->canRender(*this, style()->effectiveZoom())) { |
| 1383 for (RenderObject* layerRenderer : layerRenderers) | 1383 for (LayoutObject* layerRenderer : layerRenderers) |
| 1384 layerRenderer->setShouldDoFullPaintInvalidation(); | 1384 layerRenderer->setShouldDoFullPaintInvalidation(); |
| 1385 return true; | 1385 return true; |
| 1386 } | 1386 } |
| 1387 } | 1387 } |
| 1388 return false; | 1388 return false; |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 PaintInvalidationReason RenderBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState, const LayoutLayerModelObject& newPaintInvalidat
ionContainer) | 1391 PaintInvalidationReason RenderBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState, const LayoutLayerModelObject& newPaintInvalidat
ionContainer) |
| 1392 { | 1392 { |
| 1393 PaintInvalidationReason reason = RenderBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState, newPaintInvalidationContainer); | 1393 PaintInvalidationReason reason = RenderBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState, newPaintInvalidationContainer); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 | 1568 |
| 1569 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1569 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
| 1570 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | 1570 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); |
| 1571 if (style()->hasInFlowPosition() && layer()) | 1571 if (style()->hasInFlowPosition() && layer()) |
| 1572 offset += layer()->offsetForInFlowPosition(); | 1572 offset += layer()->offsetForInFlowPosition(); |
| 1573 transformState.move(offset); | 1573 transformState.move(offset); |
| 1574 return; | 1574 return; |
| 1575 } | 1575 } |
| 1576 | 1576 |
| 1577 bool containerSkipped; | 1577 bool containerSkipped; |
| 1578 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1578 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); |
| 1579 if (!o) | 1579 if (!o) |
| 1580 return; | 1580 return; |
| 1581 | 1581 |
| 1582 bool isFixedPos = style()->position() == FixedPosition; | 1582 bool isFixedPos = style()->position() == FixedPosition; |
| 1583 bool hasTransform = hasLayer() && layer()->transform(); | 1583 bool hasTransform = hasLayer() && layer()->transform(); |
| 1584 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, | 1584 // If this box has a transform, it acts as a fixed position container for fi
xed descendants, |
| 1585 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. | 1585 // and may itself also be fixed position. So propagate 'fixed' up only if th
is box is fixed position. |
| 1586 if (hasTransform && !isFixedPos) | 1586 if (hasTransform && !isFixedPos) |
| 1587 mode &= ~IsFixed; | 1587 mode &= ~IsFixed; |
| 1588 else if (isFixedPos) | 1588 else if (isFixedPos) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 if (hasTransform && !isFixedPos) { | 1621 if (hasTransform && !isFixedPos) { |
| 1622 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, | 1622 // If this box has a transform, it acts as a fixed position container fo
r fixed descendants, |
| 1623 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. | 1623 // and may itself also be fixed position. So propagate 'fixed' up only i
f this box is fixed position. |
| 1624 mode &= ~IsFixed; | 1624 mode &= ~IsFixed; |
| 1625 } else if (isFixedPos) | 1625 } else if (isFixedPos) |
| 1626 mode |= IsFixed; | 1626 mode |= IsFixed; |
| 1627 | 1627 |
| 1628 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); | 1628 RenderBoxModelObject::mapAbsoluteToLocalPoint(mode, transformState); |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 LayoutSize RenderBox::offsetFromContainer(const RenderObject* o, const LayoutPoi
nt& point, bool* offsetDependsOnPoint) const | 1631 LayoutSize RenderBox::offsetFromContainer(const LayoutObject* o, const LayoutPoi
nt& point, bool* offsetDependsOnPoint) const |
| 1632 { | 1632 { |
| 1633 ASSERT(o == container()); | 1633 ASSERT(o == container()); |
| 1634 | 1634 |
| 1635 LayoutSize offset; | 1635 LayoutSize offset; |
| 1636 if (isRelPositioned()) | 1636 if (isRelPositioned()) |
| 1637 offset += offsetForInFlowPosition(); | 1637 offset += offsetForInFlowPosition(); |
| 1638 | 1638 |
| 1639 if (!isInline() || isReplaced()) { | 1639 if (!isInline() || isReplaced()) { |
| 1640 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { | 1640 if (!style()->hasOutOfFlowPosition() && o->hasColumns()) { |
| 1641 const RenderBlock* block = toRenderBlock(o); | 1641 const RenderBlock* block = toRenderBlock(o); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 | 1798 |
| 1799 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, | 1799 // We need to inflate the paint invalidation rect before we use paintInvalid
ationState, |
| 1800 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were | 1800 // else we would forget to inflate it for the current renderer. FIXME: If th
ese were |
| 1801 // included into the visual overflow for repaint, we wouldn't have this issu
e. | 1801 // included into the visual overflow for repaint, we wouldn't have this issu
e. |
| 1802 inflatePaintInvalidationRectForReflectionAndFilter(rect); | 1802 inflatePaintInvalidationRectForReflectionAndFilter(rect); |
| 1803 | 1803 |
| 1804 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && position != FixedPosition) { | 1804 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer) && position != FixedPosition) { |
| 1805 if (layer() && layer()->transform()) | 1805 if (layer() && layer()->transform()) |
| 1806 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); | 1806 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); |
| 1807 | 1807 |
| 1808 // We can't trust the bits on RenderObject, because this might be called
while re-resolving style. | 1808 // We can't trust the bits on LayoutObject, because this might be called
while re-resolving style. |
| 1809 if (styleToUse->hasInFlowPosition() && layer()) | 1809 if (styleToUse->hasInFlowPosition() && layer()) |
| 1810 rect.move(layer()->offsetForInFlowPosition()); | 1810 rect.move(layer()->offsetForInFlowPosition()); |
| 1811 | 1811 |
| 1812 rect.moveBy(location()); | 1812 rect.moveBy(location()); |
| 1813 rect.move(paintInvalidationState->paintOffset()); | 1813 rect.move(paintInvalidationState->paintOffset()); |
| 1814 if (paintInvalidationState->isClipped()) | 1814 if (paintInvalidationState->isClipped()) |
| 1815 rect.intersect(paintInvalidationState->clipRect()); | 1815 rect.intersect(paintInvalidationState->clipRect()); |
| 1816 return; | 1816 return; |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 if (paintInvalidationContainer == this) { | 1819 if (paintInvalidationContainer == this) { |
| 1820 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) | 1820 if (paintInvalidationContainer->style()->isFlippedBlocksWritingMode()) |
| 1821 flipForWritingMode(rect); | 1821 flipForWritingMode(rect); |
| 1822 return; | 1822 return; |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 bool containerSkipped; | 1825 bool containerSkipped; |
| 1826 RenderObject* o = container(paintInvalidationContainer, &containerSkipped); | 1826 LayoutObject* o = container(paintInvalidationContainer, &containerSkipped); |
| 1827 if (!o) | 1827 if (!o) |
| 1828 return; | 1828 return; |
| 1829 | 1829 |
| 1830 if (isWritingModeRoot()) | 1830 if (isWritingModeRoot()) |
| 1831 flipForWritingMode(rect); | 1831 flipForWritingMode(rect); |
| 1832 | 1832 |
| 1833 LayoutPoint topLeft = rect.location(); | 1833 LayoutPoint topLeft = rect.location(); |
| 1834 topLeft.move(locationOffset()); | 1834 topLeft.move(locationOffset()); |
| 1835 | 1835 |
| 1836 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box | 1836 // We are now in our parent container's coordinate space. Apply our transfo
rm to obtain a bounding box |
| 1837 // in the parent's coordinate space that encloses us. | 1837 // in the parent's coordinate space that encloses us. |
| 1838 if (hasLayer() && layer()->transform()) { | 1838 if (hasLayer() && layer()->transform()) { |
| 1839 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); | 1839 rect = layer()->transform()->mapRect(pixelSnappedIntRect(rect)); |
| 1840 topLeft = rect.location(); | 1840 topLeft = rect.location(); |
| 1841 topLeft.move(locationOffset()); | 1841 topLeft.move(locationOffset()); |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInlin
e()) { | 1844 if (position == AbsolutePosition && o->isRelPositioned() && o->isRenderInlin
e()) { |
| 1845 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(*this); | 1845 topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(*this); |
| 1846 } else if (styleToUse->hasInFlowPosition() && layer()) { | 1846 } else if (styleToUse->hasInFlowPosition() && layer()) { |
| 1847 // Apply the relative position offset when invalidating a rectangle. Th
e layer | 1847 // Apply the relative position offset when invalidating a rectangle. Th
e layer |
| 1848 // is translated, but the render box isn't, so we need to do this to get
the | 1848 // is translated, but the render box isn't, so we need to do this to get
the |
| 1849 // right dirty rect. Since this is called from RenderObject::setStyle,
the relative position | 1849 // right dirty rect. Since this is called from LayoutObject::setStyle,
the relative position |
| 1850 // flag on the RenderObject has been cleared, so use the one on the styl
e(). | 1850 // flag on the LayoutObject has been cleared, so use the one on the styl
e(). |
| 1851 topLeft += layer()->offsetForInFlowPosition(); | 1851 topLeft += layer()->offsetForInFlowPosition(); |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 if (position != AbsolutePosition && position != FixedPosition && o->hasColum
ns() && o->isRenderBlockFlow()) { | 1854 if (position != AbsolutePosition && position != FixedPosition && o->hasColum
ns() && o->isRenderBlockFlow()) { |
| 1855 LayoutRect paintInvalidationRect(topLeft, rect.size()); | 1855 LayoutRect paintInvalidationRect(topLeft, rect.size()); |
| 1856 toRenderBlock(o)->adjustRectForColumns(paintInvalidationRect); | 1856 toRenderBlock(o)->adjustRectForColumns(paintInvalidationRect); |
| 1857 topLeft = paintInvalidationRect.location(); | 1857 topLeft = paintInvalidationRect.location(); |
| 1858 rect = paintInvalidationRect; | 1858 rect = paintInvalidationRect; |
| 1859 } | 1859 } |
| 1860 | 1860 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 static float getMaxWidthListMarker(const RenderBox* renderer) | 1911 static float getMaxWidthListMarker(const RenderBox* renderer) |
| 1912 { | 1912 { |
| 1913 #if ENABLE(ASSERT) | 1913 #if ENABLE(ASSERT) |
| 1914 ASSERT(renderer); | 1914 ASSERT(renderer); |
| 1915 Node* parentNode = renderer->generatingNode(); | 1915 Node* parentNode = renderer->generatingNode(); |
| 1916 ASSERT(parentNode); | 1916 ASSERT(parentNode); |
| 1917 ASSERT(isHTMLOListElement(parentNode) || isHTMLUListElement(parentNode)); | 1917 ASSERT(isHTMLOListElement(parentNode) || isHTMLUListElement(parentNode)); |
| 1918 ASSERT(renderer->style()->textAutosizingMultiplier() != 1); | 1918 ASSERT(renderer->style()->textAutosizingMultiplier() != 1); |
| 1919 #endif | 1919 #endif |
| 1920 float maxWidth = 0; | 1920 float maxWidth = 0; |
| 1921 for (RenderObject* child = renderer->slowFirstChild(); child; child = child-
>nextSibling()) { | 1921 for (LayoutObject* child = renderer->slowFirstChild(); child; child = child-
>nextSibling()) { |
| 1922 if (!child->isListItem()) | 1922 if (!child->isListItem()) |
| 1923 continue; | 1923 continue; |
| 1924 | 1924 |
| 1925 RenderBox* listItem = toRenderBox(child); | 1925 RenderBox* listItem = toRenderBox(child); |
| 1926 for (RenderObject* itemChild = listItem->slowFirstChild(); itemChild; it
emChild = itemChild->nextSibling()) { | 1926 for (LayoutObject* itemChild = listItem->slowFirstChild(); itemChild; it
emChild = itemChild->nextSibling()) { |
| 1927 if (!itemChild->isListMarker()) | 1927 if (!itemChild->isListMarker()) |
| 1928 continue; | 1928 continue; |
| 1929 RenderBox* itemMarker = toRenderBox(itemChild); | 1929 RenderBox* itemMarker = toRenderBox(itemChild); |
| 1930 // Make sure to compute the autosized width. | 1930 // Make sure to compute the autosized width. |
| 1931 if (itemMarker->needsLayout()) | 1931 if (itemMarker->needsLayout()) |
| 1932 itemMarker->layout(); | 1932 itemMarker->layout(); |
| 1933 maxWidth = std::max<float>(maxWidth, toRenderListMarker(itemMarker)-
>logicalWidth().toFloat()); | 1933 maxWidth = std::max<float>(maxWidth, toRenderListMarker(itemMarker)-
>logicalWidth().toFloat()); |
| 1934 break; | 1934 break; |
| 1935 } | 1935 } |
| 1936 } | 1936 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); | 2077 LayoutUnit logicalWidthResult = fillAvailableMeasure(availableLogicalWidth,
marginStart, marginEnd); |
| 2078 | 2078 |
| 2079 if (shrinkToAvoidFloats() && cb->isRenderBlockFlow() && toRenderBlockFlow(cb
)->containsFloats()) | 2079 if (shrinkToAvoidFloats() && cb->isRenderBlockFlow() && toRenderBlockFlow(cb
)->containsFloats()) |
| 2080 logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv
oidFloats(marginStart, marginEnd, toRenderBlockFlow(cb))); | 2080 logicalWidthResult = std::min(logicalWidthResult, shrinkLogicalWidthToAv
oidFloats(marginStart, marginEnd, toRenderBlockFlow(cb))); |
| 2081 | 2081 |
| 2082 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
lWidth)) | 2082 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(logica
lWidth)) |
| 2083 return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical
Width(), logicalWidthResult)); | 2083 return std::max(minPreferredLogicalWidth(), std::min(maxPreferredLogical
Width(), logicalWidthResult)); |
| 2084 return logicalWidthResult; | 2084 return logicalWidthResult; |
| 2085 } | 2085 } |
| 2086 | 2086 |
| 2087 static bool columnFlexItemHasStretchAlignment(const RenderObject* flexitem) | 2087 static bool columnFlexItemHasStretchAlignment(const LayoutObject* flexitem) |
| 2088 { | 2088 { |
| 2089 RenderObject* parent = flexitem->parent(); | 2089 LayoutObject* parent = flexitem->parent(); |
| 2090 // auto margins mean we don't stretch. Note that this function will only be
used for | 2090 // auto margins mean we don't stretch. Note that this function will only be
used for |
| 2091 // widths, so we don't have to check marginBefore/marginAfter. | 2091 // widths, so we don't have to check marginBefore/marginAfter. |
| 2092 ASSERT(parent->style()->isColumnFlexDirection()); | 2092 ASSERT(parent->style()->isColumnFlexDirection()); |
| 2093 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) | 2093 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn
d().isAuto()) |
| 2094 return false; | 2094 return false; |
| 2095 return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
PositionStretch); | 2095 return flexitem->style()->alignSelf() == ItemPositionStretch || (flexitem->s
tyle()->alignSelf() == ItemPositionAuto && parent->style()->alignItems() == Item
PositionStretch); |
| 2096 } | 2096 } |
| 2097 | 2097 |
| 2098 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) | 2098 static bool isStretchingColumnFlexItem(const LayoutObject* flexitem) |
| 2099 { | 2099 { |
| 2100 RenderObject* parent = flexitem->parent(); | 2100 LayoutObject* parent = flexitem->parent(); |
| 2101 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) | 2101 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER
TICAL && parent->style()->boxAlign() == BSTRETCH) |
| 2102 return true; | 2102 return true; |
| 2103 | 2103 |
| 2104 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. | 2104 // We don't stretch multiline flexboxes because they need to apply line spac
ing (align-content) first. |
| 2105 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) | 2105 if (parent->isFlexibleBox() && parent->style()->flexWrap() == FlexNoWrap &&
parent->style()->isColumnFlexDirection() && columnFlexItemHasStretchAlignment(fl
exitem)) |
| 2106 return true; | 2106 return true; |
| 2107 return false; | 2107 return false; |
| 2108 } | 2108 } |
| 2109 | 2109 |
| 2110 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const | 2110 bool RenderBox::sizesLogicalWidthToFitContent(const Length& logicalWidth) const |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 } | 2601 } |
| 2602 | 2602 |
| 2603 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei
ght) const | 2603 LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(const Length& logicalHei
ght) const |
| 2604 { | 2604 { |
| 2605 switch (logicalHeight.type()) { | 2605 switch (logicalHeight.type()) { |
| 2606 case Fixed: | 2606 case Fixed: |
| 2607 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value
()); | 2607 return adjustContentBoxLogicalHeightForBoxSizing(logicalHeight.value
()); |
| 2608 case Percent: | 2608 case Percent: |
| 2609 case Calculated: | 2609 case Calculated: |
| 2610 { | 2610 { |
| 2611 RenderObject* cb = isOutOfFlowPositioned() ? container() : containin
gBlock(); | 2611 LayoutObject* cb = isOutOfFlowPositioned() ? container() : containin
gBlock(); |
| 2612 while (cb->isAnonymous()) | 2612 while (cb->isAnonymous()) |
| 2613 cb = cb->containingBlock(); | 2613 cb = cb->containingBlock(); |
| 2614 if (cb->isRenderBlock()) | 2614 if (cb->isRenderBlock()) |
| 2615 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB
ox*>(this)); | 2615 toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderB
ox*>(this)); |
| 2616 | 2616 |
| 2617 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() &&
!(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { | 2617 if (cb->isOutOfFlowPositioned() && cb->style()->height().isAuto() &&
!(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) { |
| 2618 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); | 2618 ASSERT_WITH_SECURITY_IMPLICATION(cb->isRenderBlock()); |
| 2619 RenderBlock* block = toRenderBlock(cb); | 2619 RenderBlock* block = toRenderBlock(cb); |
| 2620 LogicalExtentComputedValues computedValues; | 2620 LogicalExtentComputedValues computedValues; |
| 2621 block->computeLogicalHeight(block->logicalHeight(), 0, computedV
alues); | 2621 block->computeLogicalHeight(block->logicalHeight(), 0, computedV
alues); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2809 } | 2809 } |
| 2810 | 2810 |
| 2811 static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
t, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUni
t containerLogicalWidth) | 2811 static void computeInlineStaticDistance(Length& logicalLeft, Length& logicalRigh
t, const RenderBox* child, const RenderBoxModelObject* containerBlock, LayoutUni
t containerLogicalWidth) |
| 2812 { | 2812 { |
| 2813 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) | 2813 if (!logicalLeft.isAuto() || !logicalRight.isAuto()) |
| 2814 return; | 2814 return; |
| 2815 | 2815 |
| 2816 // FIXME: The static distance computation has not been patched for mixed wri
ting modes yet. | 2816 // FIXME: The static distance computation has not been patched for mixed wri
ting modes yet. |
| 2817 if (child->parent()->style()->direction() == LTR) { | 2817 if (child->parent()->style()->direction() == LTR) { |
| 2818 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con
tainerBlock->borderLogicalLeft(); | 2818 LayoutUnit staticPosition = child->layer()->staticInlinePosition() - con
tainerBlock->borderLogicalLeft(); |
| 2819 for (RenderObject* curr = child->parent(); curr && curr != containerBloc
k; curr = curr->container()) { | 2819 for (LayoutObject* curr = child->parent(); curr && curr != containerBloc
k; curr = curr->container()) { |
| 2820 if (curr->isBox()) { | 2820 if (curr->isBox()) { |
| 2821 staticPosition += toRenderBox(curr)->logicalLeft(); | 2821 staticPosition += toRenderBox(curr)->logicalLeft(); |
| 2822 if (toRenderBox(curr)->isRelPositioned()) | 2822 if (toRenderBox(curr)->isRelPositioned()) |
| 2823 staticPosition += toRenderBox(curr)->relativePositionOffset(
).width(); | 2823 staticPosition += toRenderBox(curr)->relativePositionOffset(
).width(); |
| 2824 } else if (curr->isInline()) { | 2824 } else if (curr->isInline()) { |
| 2825 if (curr->isRelPositioned()) { | 2825 if (curr->isRelPositioned()) { |
| 2826 if (!curr->style()->logicalLeft().isAuto()) | 2826 if (!curr->style()->logicalLeft().isAuto()) |
| 2827 staticPosition += valueForLength(curr->style()->logicalL
eft(), curr->containingBlock()->availableWidth()); | 2827 staticPosition += valueForLength(curr->style()->logicalL
eft(), curr->containingBlock()->availableWidth()); |
| 2828 else | 2828 else |
| 2829 staticPosition -= valueForLength(curr->style()->logicalR
ight(), curr->containingBlock()->availableWidth()); | 2829 staticPosition -= valueForLength(curr->style()->logicalR
ight(), curr->containingBlock()->availableWidth()); |
| 2830 } | 2830 } |
| 2831 } | 2831 } |
| 2832 } | 2832 } |
| 2833 logicalLeft.setValue(Fixed, staticPosition); | 2833 logicalLeft.setValue(Fixed, staticPosition); |
| 2834 } else { | 2834 } else { |
| 2835 RenderBox* enclosingBox = child->parent()->enclosingBox(); | 2835 RenderBox* enclosingBox = child->parent()->enclosingBox(); |
| 2836 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con
tainerLogicalWidth + containerBlock->borderLogicalLeft(); | 2836 LayoutUnit staticPosition = child->layer()->staticInlinePosition() + con
tainerLogicalWidth + containerBlock->borderLogicalLeft(); |
| 2837 for (RenderObject* curr = child->parent(); curr; curr = curr->container(
)) { | 2837 for (LayoutObject* curr = child->parent(); curr; curr = curr->container(
)) { |
| 2838 if (curr->isBox()) { | 2838 if (curr->isBox()) { |
| 2839 if (curr != containerBlock) { | 2839 if (curr != containerBlock) { |
| 2840 staticPosition -= toRenderBox(curr)->logicalLeft(); | 2840 staticPosition -= toRenderBox(curr)->logicalLeft(); |
| 2841 if (toRenderBox(curr)->isRelPositioned()) | 2841 if (toRenderBox(curr)->isRelPositioned()) |
| 2842 staticPosition -= toRenderBox(curr)->relativePositionOff
set().width(); | 2842 staticPosition -= toRenderBox(curr)->relativePositionOff
set().width(); |
| 2843 } | 2843 } |
| 2844 if (curr == enclosingBox) | 2844 if (curr == enclosingBox) |
| 2845 staticPosition -= enclosingBox->logicalWidth(); | 2845 staticPosition -= enclosingBox->logicalWidth(); |
| 2846 } else if (curr->isInline()) { | 2846 } else if (curr->isInline()) { |
| 2847 if (curr->isRelPositioned()) { | 2847 if (curr->isRelPositioned()) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed
Values.m_extent, containerBlock, containerLogicalWidth); | 3168 computeLogicalLeftPositionedOffset(computedValues.m_position, this, computed
Values.m_extent, containerBlock, containerLogicalWidth); |
| 3169 } | 3169 } |
| 3170 | 3170 |
| 3171 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBottom
, const RenderBox* child, const RenderBoxModelObject* containerBlock) | 3171 static void computeBlockStaticDistance(Length& logicalTop, Length& logicalBottom
, const RenderBox* child, const RenderBoxModelObject* containerBlock) |
| 3172 { | 3172 { |
| 3173 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) | 3173 if (!logicalTop.isAuto() || !logicalBottom.isAuto()) |
| 3174 return; | 3174 return; |
| 3175 | 3175 |
| 3176 // FIXME: The static distance computation has not been patched for mixed wri
ting modes. | 3176 // FIXME: The static distance computation has not been patched for mixed wri
ting modes. |
| 3177 LayoutUnit staticLogicalTop = child->layer()->staticBlockPosition() - contai
nerBlock->borderBefore(); | 3177 LayoutUnit staticLogicalTop = child->layer()->staticBlockPosition() - contai
nerBlock->borderBefore(); |
| 3178 for (RenderObject* curr = child->parent(); curr && curr != containerBlock; c
urr = curr->container()) { | 3178 for (LayoutObject* curr = child->parent(); curr && curr != containerBlock; c
urr = curr->container()) { |
| 3179 if (curr->isBox() && !curr->isTableRow()) | 3179 if (curr->isBox() && !curr->isTableRow()) |
| 3180 staticLogicalTop += toRenderBox(curr)->logicalTop(); | 3180 staticLogicalTop += toRenderBox(curr)->logicalTop(); |
| 3181 } | 3181 } |
| 3182 logicalTop.setValue(Fixed, staticLogicalTop); | 3182 logicalTop.setValue(Fixed, staticLogicalTop); |
| 3183 } | 3183 } |
| 3184 | 3184 |
| 3185 void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp
utedValues) const | 3185 void RenderBox::computePositionedLogicalHeight(LogicalExtentComputedValues& comp
utedValues) const |
| 3186 { | 3186 { |
| 3187 if (isReplaced()) { | 3187 if (isReplaced()) { |
| 3188 computePositionedLogicalHeightReplaced(computedValues); | 3188 computePositionedLogicalHeightReplaced(computedValues); |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3775 | 3775 |
| 3776 if (!isHorizontalWritingMode()) | 3776 if (!isHorizontalWritingMode()) |
| 3777 return rect.transposedRect(); | 3777 return rect.transposedRect(); |
| 3778 | 3778 |
| 3779 return rect; | 3779 return rect; |
| 3780 } | 3780 } |
| 3781 | 3781 |
| 3782 PositionWithAffinity RenderBox::positionForPoint(const LayoutPoint& point) | 3782 PositionWithAffinity RenderBox::positionForPoint(const LayoutPoint& point) |
| 3783 { | 3783 { |
| 3784 // no children...return this render object's element, if there is one, and o
ffset 0 | 3784 // no children...return this render object's element, if there is one, and o
ffset 0 |
| 3785 RenderObject* firstChild = slowFirstChild(); | 3785 LayoutObject* firstChild = slowFirstChild(); |
| 3786 if (!firstChild) | 3786 if (!firstChild) |
| 3787 return createPositionWithAffinity(nonPseudoNode() ? firstPositionInOrBef
oreNode(nonPseudoNode()) : Position()); | 3787 return createPositionWithAffinity(nonPseudoNode() ? firstPositionInOrBef
oreNode(nonPseudoNode()) : Position()); |
| 3788 | 3788 |
| 3789 if (isTable() && nonPseudoNode()) { | 3789 if (isTable() && nonPseudoNode()) { |
| 3790 LayoutUnit right = size().width() - verticalScrollbarWidth(); | 3790 LayoutUnit right = size().width() - verticalScrollbarWidth(); |
| 3791 LayoutUnit bottom = size().height() - horizontalScrollbarHeight(); | 3791 LayoutUnit bottom = size().height() - horizontalScrollbarHeight(); |
| 3792 | 3792 |
| 3793 if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > b
ottom) { | 3793 if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > b
ottom) { |
| 3794 if (point.x() <= right / 2) | 3794 if (point.x() <= right / 2) |
| 3795 return createPositionWithAffinity(firstPositionInOrBeforeNode(no
nPseudoNode())); | 3795 return createPositionWithAffinity(firstPositionInOrBeforeNode(no
nPseudoNode())); |
| 3796 return createPositionWithAffinity(lastPositionInOrAfterNode(nonPseud
oNode())); | 3796 return createPositionWithAffinity(lastPositionInOrAfterNode(nonPseud
oNode())); |
| 3797 } | 3797 } |
| 3798 } | 3798 } |
| 3799 | 3799 |
| 3800 // Pass off to the closest child. | 3800 // Pass off to the closest child. |
| 3801 LayoutUnit minDist = LayoutUnit::max(); | 3801 LayoutUnit minDist = LayoutUnit::max(); |
| 3802 RenderBox* closestRenderer = 0; | 3802 RenderBox* closestRenderer = 0; |
| 3803 LayoutPoint adjustedPoint = point; | 3803 LayoutPoint adjustedPoint = point; |
| 3804 if (isTableRow()) | 3804 if (isTableRow()) |
| 3805 adjustedPoint.moveBy(location()); | 3805 adjustedPoint.moveBy(location()); |
| 3806 | 3806 |
| 3807 for (RenderObject* renderObject = firstChild; renderObject; renderObject = r
enderObject->nextSibling()) { | 3807 for (LayoutObject* layoutObject = firstChild; layoutObject; layoutObject = l
ayoutObject->nextSibling()) { |
| 3808 if ((!renderObject->slowFirstChild() && !renderObject->isInline() && !re
nderObject->isRenderBlockFlow() ) | 3808 if ((!layoutObject->slowFirstChild() && !layoutObject->isInline() && !la
youtObject->isRenderBlockFlow() ) |
| 3809 || renderObject->style()->visibility() != VISIBLE) | 3809 || layoutObject->style()->visibility() != VISIBLE) |
| 3810 continue; | 3810 continue; |
| 3811 | 3811 |
| 3812 if (!renderObject->isBox()) | 3812 if (!layoutObject->isBox()) |
| 3813 continue; | 3813 continue; |
| 3814 | 3814 |
| 3815 RenderBox* renderer = toRenderBox(renderObject); | 3815 RenderBox* renderer = toRenderBox(layoutObject); |
| 3816 | 3816 |
| 3817 LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTab
leRow() ? LayoutUnit() : renderer->location().y()); | 3817 LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTab
leRow() ? LayoutUnit() : renderer->location().y()); |
| 3818 LayoutUnit bottom = top + renderer->contentHeight(); | 3818 LayoutUnit bottom = top + renderer->contentHeight(); |
| 3819 LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (is
TableRow() ? LayoutUnit() : renderer->location().x()); | 3819 LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (is
TableRow() ? LayoutUnit() : renderer->location().x()); |
| 3820 LayoutUnit right = left + renderer->contentWidth(); | 3820 LayoutUnit right = left + renderer->contentWidth(); |
| 3821 | 3821 |
| 3822 if (point.x() <= right && point.x() >= left && point.y() <= top && point
.y() >= bottom) { | 3822 if (point.x() <= right && point.x() >= left && point.y() <= top && point
.y() >= bottom) { |
| 3823 if (renderer->isTableRow()) | 3823 if (renderer->isTableRow()) |
| 3824 return renderer->positionForPoint(point + adjustedPoint - render
er->locationOffset()); | 3824 return renderer->positionForPoint(point + adjustedPoint - render
er->locationOffset()); |
| 3825 return renderer->positionForPoint(point - renderer->locationOffset()
); | 3825 return renderer->positionForPoint(point - renderer->locationOffset()
); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) | 3945 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) |
| 3946 return PaintInvalidationBorderBoxChange; | 3946 return PaintInvalidationBorderBoxChange; |
| 3947 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) | 3947 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) |
| 3948 return PaintInvalidationBorderBoxChange; | 3948 return PaintInvalidationBorderBoxChange; |
| 3949 | 3949 |
| 3950 return PaintInvalidationIncremental; | 3950 return PaintInvalidationIncremental; |
| 3951 } | 3951 } |
| 3952 | 3952 |
| 3953 void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds,
const LayoutPoint& positionFromPaintInvalidationBacking) | 3953 void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds,
const LayoutPoint& positionFromPaintInvalidationBacking) |
| 3954 { | 3954 { |
| 3955 RenderObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); | 3955 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); |
| 3956 | 3956 |
| 3957 bool hasBoxDecorations = style()->hasBoxDecorations(); | 3957 bool hasBoxDecorations = style()->hasBoxDecorations(); |
| 3958 if (!style()->hasBackground() && !hasBoxDecorations) | 3958 if (!style()->hasBackground() && !hasBoxDecorations) |
| 3959 return; | 3959 return; |
| 3960 | 3960 |
| 3961 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; | 3961 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; |
| 3962 LayoutSize newBorderBoxSize = size(); | 3962 LayoutSize newBorderBoxSize = size(); |
| 3963 | 3963 |
| 3964 // If border box size didn't change, RenderBox's incrementallyInvalidatePain
t() is good. | 3964 // If border box size didn't change, RenderBox's incrementallyInvalidatePain
t() is good. |
| 3965 if (oldBorderBoxSize == newBorderBoxSize) | 3965 if (oldBorderBoxSize == newBorderBoxSize) |
| 3966 return; | 3966 return; |
| 3967 | 3967 |
| 3968 // If size of the paint invalidation rect equals to size of border box, Rend
erObject::incrementallyInvalidatePaint() | 3968 // If size of the paint invalidation rect equals to size of border box, Layo
utObject::incrementallyInvalidatePaint() |
| 3969 // is good for boxes having background without box decorations. | 3969 // is good for boxes having background without box decorations. |
| 3970 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't
do incremental invalidation. | 3970 ASSERT(oldBounds.location() == newBounds.location()); // Otherwise we won't
do incremental invalidation. |
| 3971 if (!hasBoxDecorations | 3971 if (!hasBoxDecorations |
| 3972 && positionFromPaintInvalidationBacking == newBounds.location() | 3972 && positionFromPaintInvalidationBacking == newBounds.location() |
| 3973 && oldBorderBoxSize == oldBounds.size() | 3973 && oldBorderBoxSize == oldBounds.size() |
| 3974 && newBorderBoxSize == newBounds.size()) | 3974 && newBorderBoxSize == newBounds.size()) |
| 3975 return; | 3975 return; |
| 3976 | 3976 |
| 3977 // Invalidate the right delta part and the right border of the old or new bo
x which has smaller width. | 3977 // Invalidate the right delta part and the right border of the old or new bo
x which has smaller width. |
| 3978 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo
xSize.width()); | 3978 LayoutUnit deltaWidth = absoluteValue(oldBorderBoxSize.width() - newBorderBo
xSize.width()); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4262 if (baselineType == AlphabeticBaseline) | 4262 if (baselineType == AlphabeticBaseline) |
| 4263 return result; | 4263 return result; |
| 4264 return result - result / 2; | 4264 return result - result / 2; |
| 4265 } | 4265 } |
| 4266 return 0; | 4266 return 0; |
| 4267 } | 4267 } |
| 4268 | 4268 |
| 4269 | 4269 |
| 4270 Layer* RenderBox::enclosingFloatPaintingLayer() const | 4270 Layer* RenderBox::enclosingFloatPaintingLayer() const |
| 4271 { | 4271 { |
| 4272 const RenderObject* curr = this; | 4272 const LayoutObject* curr = this; |
| 4273 while (curr) { | 4273 while (curr) { |
| 4274 Layer* layer = curr->hasLayer() && curr->isBox() ? toRenderBox(curr)->la
yer() : 0; | 4274 Layer* layer = curr->hasLayer() && curr->isBox() ? toRenderBox(curr)->la
yer() : 0; |
| 4275 if (layer && layer->isSelfPaintingLayer()) | 4275 if (layer && layer->isSelfPaintingLayer()) |
| 4276 return layer; | 4276 return layer; |
| 4277 curr = curr->parent(); | 4277 curr = curr->parent(); |
| 4278 } | 4278 } |
| 4279 return 0; | 4279 return 0; |
| 4280 } | 4280 } |
| 4281 | 4281 |
| 4282 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* paren
tStyle) const | 4282 LayoutRect RenderBox::logicalVisualOverflowRectForPropagation(RenderStyle* paren
tStyle) const |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4442 // Because we may have added some sections with already computed column
structures, we need to | 4442 // Because we may have added some sections with already computed column
structures, we need to |
| 4443 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. | 4443 // sync the table structure with them now. This avoids crashes when addi
ng new cells to the table. |
| 4444 toLayoutTable(box)->forceSectionsRecalc(); | 4444 toLayoutTable(box)->forceSectionsRecalc(); |
| 4445 } else if (box->isTableSection()) { | 4445 } else if (box->isTableSection()) { |
| 4446 toLayoutTableSection(box)->setNeedsCellRecalc(); | 4446 toLayoutTableSection(box)->setNeedsCellRecalc(); |
| 4447 } | 4447 } |
| 4448 | 4448 |
| 4449 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 4449 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
| 4450 } | 4450 } |
| 4451 | 4451 |
| 4452 RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChil
d) | 4452 LayoutObject* RenderBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
d) |
| 4453 { | 4453 { |
| 4454 bool didSplitParentAnonymousBoxes = false; | 4454 bool didSplitParentAnonymousBoxes = false; |
| 4455 | 4455 |
| 4456 while (beforeChild->parent() != this) { | 4456 while (beforeChild->parent() != this) { |
| 4457 RenderBox* boxToSplit = toRenderBox(beforeChild->parent()); | 4457 RenderBox* boxToSplit = toRenderBox(beforeChild->parent()); |
| 4458 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { | 4458 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo
us()) { |
| 4459 didSplitParentAnonymousBoxes = true; | 4459 didSplitParentAnonymousBoxes = true; |
| 4460 | 4460 |
| 4461 // We have to split the parent box into two boxes and move children | 4461 // We have to split the parent box into two boxes and move children |
| 4462 // from |beforeChild| to end into the new post box. | 4462 // from |beforeChild| to end into the new post box. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4559 } | 4559 } |
| 4560 | 4560 |
| 4561 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c
onst | 4561 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c
onst |
| 4562 { | 4562 { |
| 4563 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); | 4563 RenderBoxModelObject::invalidateDisplayItemClients(displayItemList); |
| 4564 if (LayerScrollableArea* area = scrollableArea()) | 4564 if (LayerScrollableArea* area = scrollableArea()) |
| 4565 displayItemList->invalidate(area->displayItemClient()); | 4565 displayItemList->invalidate(area->displayItemClient()); |
| 4566 } | 4566 } |
| 4567 | 4567 |
| 4568 } // namespace blink | 4568 } // namespace blink |
| OLD | NEW |