| 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 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 else | 341 else |
| 342 toLayoutBox(child)->unmarkOrthogonalWritingModeRoot(); | 342 toLayoutBox(child)->unmarkOrthogonalWritingModeRoot(); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 // Fixed-position is painted using transform. In the case that the object | 346 // Fixed-position is painted using transform. In the case that the object |
| 347 // gets the same layout after changing position property, although no | 347 // gets the same layout after changing position property, although no |
| 348 // re-raster (rect-based invalidation) is needed, display items should | 348 // re-raster (rect-based invalidation) is needed, display items should |
| 349 // still update their paint offset. | 349 // still update their paint offset. |
| 350 if (oldStyle) { | 350 if (oldStyle) { |
| 351 bool newStyleIsFixedPosition = style()->position() == FixedPosition; | 351 bool newStyleIsFixedPosition = style()->position() == EPosition::kFixed; |
| 352 bool oldStyleIsFixedPosition = oldStyle->position() == FixedPosition; | 352 bool oldStyleIsFixedPosition = oldStyle->position() == EPosition::kFixed; |
| 353 if (newStyleIsFixedPosition != oldStyleIsFixedPosition) | 353 if (newStyleIsFixedPosition != oldStyleIsFixedPosition) |
| 354 ObjectPaintInvalidator(*this) | 354 ObjectPaintInvalidator(*this) |
| 355 .invalidateDisplayItemClientsIncludingNonCompositingDescendants( | 355 .invalidateDisplayItemClientsIncludingNonCompositingDescendants( |
| 356 PaintInvalidationStyleChange); | 356 PaintInvalidationStyleChange); |
| 357 } | 357 } |
| 358 | 358 |
| 359 // The used style for body background may change due to computed style change | 359 // The used style for body background may change due to computed style change |
| 360 // on the document element because of background stealing. | 360 // on the document element because of background stealing. |
| 361 // Refer to backgroundStolenForBeingBody() and | 361 // Refer to backgroundStolenForBeingBody() and |
| 362 // http://www.w3.org/TR/css3-background/#body-background for more info. | 362 // http://www.w3.org/TR/css3-background/#body-background for more info. |
| 363 if (isDocumentElement()) { | 363 if (isDocumentElement()) { |
| 364 HTMLBodyElement* body = document().firstBodyElement(); | 364 HTMLBodyElement* body = document().firstBodyElement(); |
| 365 LayoutObject* bodyLayout = body ? body->layoutObject() : nullptr; | 365 LayoutObject* bodyLayout = body ? body->layoutObject() : nullptr; |
| 366 if (bodyLayout && bodyLayout->isBoxModelObject()) { | 366 if (bodyLayout && bodyLayout->isBoxModelObject()) { |
| 367 bool newStoleBodyBackground = toLayoutBoxModelObject(bodyLayout) | 367 bool newStoleBodyBackground = toLayoutBoxModelObject(bodyLayout) |
| 368 ->backgroundStolenForBeingBody(style()); | 368 ->backgroundStolenForBeingBody(style()); |
| 369 bool oldStoleBodyBackground = | 369 bool oldStoleBodyBackground = |
| 370 oldStyle && | 370 oldStyle && |
| 371 toLayoutBoxModelObject(bodyLayout) | 371 toLayoutBoxModelObject(bodyLayout) |
| 372 ->backgroundStolenForBeingBody(oldStyle); | 372 ->backgroundStolenForBeingBody(oldStyle); |
| 373 if (newStoleBodyBackground != oldStoleBodyBackground && | 373 if (newStoleBodyBackground != oldStoleBodyBackground && |
| 374 bodyLayout->style() && bodyLayout->style()->hasBackground()) { | 374 bodyLayout->style() && bodyLayout->style()->hasBackground()) { |
| 375 bodyLayout->setShouldDoFullPaintInvalidation(); | 375 bodyLayout->setShouldDoFullPaintInvalidation(); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 if (FrameView* frameView = view()->frameView()) { | 380 if (FrameView* frameView = view()->frameView()) { |
| 381 bool newStyleIsViewportConstained = style()->position() == FixedPosition; | 381 bool newStyleIsViewportConstained = |
| 382 style()->position() == EPosition::kFixed; |
| 382 bool oldStyleIsViewportConstrained = | 383 bool oldStyleIsViewportConstrained = |
| 383 oldStyle && oldStyle->position() == FixedPosition; | 384 oldStyle && oldStyle->position() == EPosition::kFixed; |
| 384 bool newStyleIsSticky = style()->position() == StickyPosition; | 385 bool newStyleIsSticky = style()->position() == EPosition::kSticky; |
| 385 bool oldStyleIsSticky = oldStyle && oldStyle->position() == StickyPosition; | 386 bool oldStyleIsSticky = |
| 387 oldStyle && oldStyle->position() == EPosition::kSticky; |
| 386 | 388 |
| 387 if (newStyleIsSticky != oldStyleIsSticky) { | 389 if (newStyleIsSticky != oldStyleIsSticky) { |
| 388 if (newStyleIsSticky) { | 390 if (newStyleIsSticky) { |
| 389 // During compositing inputs update we'll have the scroll ancestor | 391 // During compositing inputs update we'll have the scroll ancestor |
| 390 // without having to walk up the tree and can compute the sticky | 392 // without having to walk up the tree and can compute the sticky |
| 391 // position constraints then. | 393 // position constraints then. |
| 392 if (layer()) | 394 if (layer()) |
| 393 layer()->setNeedsCompositingInputsUpdate(); | 395 layer()->setNeedsCompositingInputsUpdate(); |
| 394 | 396 |
| 395 // TODO(pdr): When slimming paint v2 is enabled, we will need to | 397 // TODO(pdr): When slimming paint v2 is enabled, we will need to |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 if (offsetParentObject->isBox() && offsetParentObject->isBody() && | 1040 if (offsetParentObject->isBox() && offsetParentObject->isBody() && |
| 1039 !offsetParentObject->isPositioned()) { | 1041 !offsetParentObject->isPositioned()) { |
| 1040 referencePoint.moveBy( | 1042 referencePoint.moveBy( |
| 1041 toLayoutBox(offsetParentObject)->physicalLocation()); | 1043 toLayoutBox(offsetParentObject)->physicalLocation()); |
| 1042 } | 1044 } |
| 1043 } | 1045 } |
| 1044 | 1046 |
| 1045 if (offsetParentObject->isLayoutInline()) { | 1047 if (offsetParentObject->isLayoutInline()) { |
| 1046 const LayoutInline* inlineParent = toLayoutInline(offsetParentObject); | 1048 const LayoutInline* inlineParent = toLayoutInline(offsetParentObject); |
| 1047 | 1049 |
| 1048 if (isBox() && style()->position() == AbsolutePosition && | 1050 if (isBox() && style()->position() == EPosition::kAbsolute && |
| 1049 inlineParent->isInFlowPositioned()) { | 1051 inlineParent->isInFlowPositioned()) { |
| 1050 // Offset for absolute elements with inline parent is a special | 1052 // Offset for absolute elements with inline parent is a special |
| 1051 // case in the CSS spec | 1053 // case in the CSS spec |
| 1052 referencePoint += | 1054 referencePoint += |
| 1053 inlineParent->offsetForInFlowPositionedInline(*toLayoutBox(this)); | 1055 inlineParent->offsetForInFlowPositionedInline(*toLayoutBox(this)); |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 referencePoint -= inlineParent->firstLineBoxTopLeft(); | 1058 referencePoint -= inlineParent->firstLineBoxTopLeft(); |
| 1057 } | 1059 } |
| 1058 | 1060 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 const LayoutBoxModelObject* ancestorToStopAt, | 1221 const LayoutBoxModelObject* ancestorToStopAt, |
| 1220 LayoutGeometryMap& geometryMap) const { | 1222 LayoutGeometryMap& geometryMap) const { |
| 1221 ASSERT(ancestorToStopAt != this); | 1223 ASSERT(ancestorToStopAt != this); |
| 1222 | 1224 |
| 1223 AncestorSkipInfo skipInfo(ancestorToStopAt); | 1225 AncestorSkipInfo skipInfo(ancestorToStopAt); |
| 1224 LayoutObject* container = this->container(&skipInfo); | 1226 LayoutObject* container = this->container(&skipInfo); |
| 1225 if (!container) | 1227 if (!container) |
| 1226 return nullptr; | 1228 return nullptr; |
| 1227 | 1229 |
| 1228 bool isInline = isLayoutInline(); | 1230 bool isInline = isLayoutInline(); |
| 1229 bool isFixedPos = !isInline && style()->position() == FixedPosition; | 1231 bool isFixedPos = !isInline && style()->position() == EPosition::kFixed; |
| 1230 bool containsFixedPosition = canContainFixedPositionObjects(); | 1232 bool containsFixedPosition = canContainFixedPositionObjects(); |
| 1231 | 1233 |
| 1232 LayoutSize adjustmentForSkippedAncestor; | 1234 LayoutSize adjustmentForSkippedAncestor; |
| 1233 if (skipInfo.ancestorSkipped()) { | 1235 if (skipInfo.ancestorSkipped()) { |
| 1234 // There can't be a transform between paintInvalidationContainer and | 1236 // There can't be a transform between paintInvalidationContainer and |
| 1235 // ancestorToStopAt, because transforms create containers, so it should be | 1237 // ancestorToStopAt, because transforms create containers, so it should be |
| 1236 // safe to just subtract the delta between the ancestor and | 1238 // safe to just subtract the delta between the ancestor and |
| 1237 // ancestorToStopAt. | 1239 // ancestorToStopAt. |
| 1238 adjustmentForSkippedAncestor = | 1240 adjustmentForSkippedAncestor = |
| 1239 -ancestorToStopAt->offsetFromAncestorContainer(container); | 1241 -ancestorToStopAt->offsetFromAncestorContainer(container); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 if (rootElementStyle->hasBackground()) | 1361 if (rootElementStyle->hasBackground()) |
| 1360 return false; | 1362 return false; |
| 1361 | 1363 |
| 1362 if (node() != document().firstBodyElement()) | 1364 if (node() != document().firstBodyElement()) |
| 1363 return false; | 1365 return false; |
| 1364 | 1366 |
| 1365 return true; | 1367 return true; |
| 1366 } | 1368 } |
| 1367 | 1369 |
| 1368 } // namespace blink | 1370 } // namespace blink |
| OLD | NEW |