Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) { | 279 void CompositedLayerMapping::updateFilters(const ComputedStyle& style) { |
| 280 m_graphicsLayer->setFilters( | 280 m_graphicsLayer->setFilters( |
| 281 owningLayer().createCompositorFilterOperationsForFilter(style)); | 281 owningLayer().createCompositorFilterOperationsForFilter(style)); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) { | 284 void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style) { |
| 285 m_graphicsLayer->setBackdropFilters( | 285 m_graphicsLayer->setBackdropFilters( |
| 286 owningLayer().createCompositorFilterOperationsForBackdropFilter(style)); | 286 owningLayer().createCompositorFilterOperationsForBackdropFilter(style)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 namespace { | |
| 290 WebLayer* webLayerFromLayoutBoxModelObject(LayoutBoxModelObject* obj) { | |
| 291 if (!obj) { | |
|
flackr
2017/02/02 18:18:11
nit: no curlies { } on single line if blocks.
smcgruer
2017/02/02 20:21:27
Done.
| |
| 292 return nullptr; | |
| 293 } | |
| 294 | |
| 295 PaintLayer* paintLayer = obj->layer(); | |
| 296 if (!paintLayer) { | |
| 297 return nullptr; | |
| 298 } | |
| 299 | |
| 300 CompositedLayerMapping* mapping = paintLayer->compositedLayerMapping(); | |
| 301 if (!mapping) { | |
| 302 return nullptr; | |
| 303 } | |
| 304 | |
| 305 GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer(); | |
| 306 if (!graphicsLayer) { | |
| 307 return nullptr; | |
| 308 } | |
| 309 | |
| 310 return graphicsLayer->platformLayer(); | |
| 311 } | |
| 312 } // namespace | |
| 313 | |
| 289 void CompositedLayerMapping::updateStickyConstraints( | 314 void CompositedLayerMapping::updateStickyConstraints( |
| 290 const ComputedStyle& style) { | 315 const ComputedStyle& style) { |
| 291 bool sticky = style.position() == EPosition::StickyPosition; | 316 bool sticky = style.position() == EPosition::StickyPosition; |
| 292 const PaintLayer* ancestorOverflowLayer = | 317 const PaintLayer* ancestorOverflowLayer = |
| 293 m_owningLayer.ancestorOverflowLayer(); | 318 m_owningLayer.ancestorOverflowLayer(); |
| 294 // TODO(flackr): Do we still need this? | 319 // TODO(flackr): Do we still need this? |
| 295 if (sticky) { | 320 if (sticky) { |
| 296 if (!ancestorOverflowLayer->isRootLayer()) { | 321 if (!ancestorOverflowLayer->isRootLayer()) { |
| 297 sticky = ancestorOverflowLayer->needsCompositedScrolling(); | 322 sticky = ancestorOverflowLayer->needsCompositedScrolling(); |
| 298 } else { | 323 } else { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 webConstraint.leftOffset = constraints.leftOffset(); | 359 webConstraint.leftOffset = constraints.leftOffset(); |
| 335 webConstraint.rightOffset = constraints.rightOffset(); | 360 webConstraint.rightOffset = constraints.rightOffset(); |
| 336 webConstraint.topOffset = constraints.topOffset(); | 361 webConstraint.topOffset = constraints.topOffset(); |
| 337 webConstraint.bottomOffset = constraints.bottomOffset(); | 362 webConstraint.bottomOffset = constraints.bottomOffset(); |
| 338 webConstraint.parentRelativeStickyBoxOffset = | 363 webConstraint.parentRelativeStickyBoxOffset = |
| 339 roundedIntPoint(stickyBoxOffset); | 364 roundedIntPoint(stickyBoxOffset); |
| 340 webConstraint.scrollContainerRelativeStickyBoxRect = | 365 webConstraint.scrollContainerRelativeStickyBoxRect = |
| 341 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect()); | 366 enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect()); |
| 342 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect( | 367 webConstraint.scrollContainerRelativeContainingBlockRect = enclosingIntRect( |
| 343 constraints.scrollContainerRelativeContainingBlockRect()); | 368 constraints.scrollContainerRelativeContainingBlockRect()); |
| 369 webConstraint.nearestStickyElementShiftingStickyBox = | |
| 370 webLayerFromLayoutBoxModelObject( | |
| 371 constraints.nearestStickyElementShiftingStickyBox()); | |
|
flackr
2017/02/02 18:18:11
If the nearest sticky element is not composited we
smcgruer
2017/02/02 20:21:27
I can have a go at implementing this behavior, but
flackr
2017/02/02 23:31:15
On low dpi this is as simple as
<div id='outer' st
smcgruer
2017/02/07 19:05:26
Thanks for the repro case. Done except I think I n
| |
| 372 webConstraint.nearestStickyElementShiftingContainingBlock = | |
| 373 webLayerFromLayoutBoxModelObject( | |
| 374 constraints.nearestStickyElementShiftingContainingBlock()); | |
| 344 } | 375 } |
| 345 | 376 |
| 346 m_graphicsLayer->setStickyPositionConstraint(webConstraint); | 377 m_graphicsLayer->setStickyPositionConstraint(webConstraint); |
| 347 } | 378 } |
| 348 | 379 |
| 349 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) { | 380 void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style) { |
| 350 setBlendMode(style.blendMode()); | 381 setBlendMode(style.blendMode()); |
| 351 } | 382 } |
| 352 | 383 |
| 353 void CompositedLayerMapping::updateIsRootForIsolatedGroup() { | 384 void CompositedLayerMapping::updateIsRootForIsolatedGroup() { |
| (...skipping 3116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3470 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { | 3501 } else if (graphicsLayer == m_decorationOutlineLayer.get()) { |
| 3471 name = "Decoration Layer"; | 3502 name = "Decoration Layer"; |
| 3472 } else { | 3503 } else { |
| 3473 ASSERT_NOT_REACHED(); | 3504 ASSERT_NOT_REACHED(); |
| 3474 } | 3505 } |
| 3475 | 3506 |
| 3476 return name; | 3507 return name; |
| 3477 } | 3508 } |
| 3478 | 3509 |
| 3479 } // namespace blink | 3510 } // namespace blink |
| OLD | NEW |