| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 3 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| 11 * Randall Jesup <rjesup@wgate.com> | 11 * Randall Jesup <rjesup@wgate.com> |
| 12 * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de> | 12 * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de> |
| 13 * Josh Soref <timeless@mac.com> | 13 * Josh Soref <timeless@mac.com> |
| 14 * Boris Zbarsky <bzbarsky@mit.edu> | 14 * Boris Zbarsky <bzbarsky@mit.edu> |
| 15 * | 15 * |
| 16 * This library is free software; you can redistribute it and/or | 16 * This library is free software; you can redistribute it and/or |
| 17 * modify it under the terms of the GNU Lesser General Public | 17 * modify it under the terms of the GNU Lesser General Public |
| 18 * License as published by the Free Software Foundation; either | 18 * License as published by the Free Software Foundation; either |
| 19 * version 2.1 of the License, or (at your option) any later version. | 19 * version 2.1 of the License, or (at your option) any later version. |
| 20 * | 20 * |
| 21 * This library is distributed in the hope that it will be useful, | 21 * This library is distributed in the hope that it will be useful, |
| 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 24 * Lesser General Public License for more details. | 24 * Lesser General Public License for more details. |
| 25 * | 25 * |
| 26 * You should have received a copy of the GNU Lesser General Public | 26 * You should have received a copy of the GNU Lesser General Public |
| 27 * License along with this library; if not, write to the Free Software | 27 * License along with this library; if not, write to the Free Software |
| 28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 US
A | 28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 29 * | 29 * |
| 30 * Alternatively, the contents of this file may be used under the terms | 30 * Alternatively, the contents of this file may be used under the terms |
| 31 * of either the Mozilla Public License Version 1.1, found at | 31 * of either the Mozilla Public License Version 1.1, found at |
| 32 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public | 32 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public |
| 33 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html | 33 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html |
| 34 * (the "GPL"), in which case the provisions of the MPL or the GPL are | 34 * (the "GPL"), in which case the provisions of the MPL or the GPL are |
| 35 * applicable instead of those above. If you wish to allow use of your | 35 * applicable instead of those above. If you wish to allow use of your |
| 36 * version of this file only under the terms of one of those two | 36 * version of this file only under the terms of one of those two |
| 37 * licenses (the MPL or the GPL) and not to allow others to use your | 37 * licenses (the MPL or the GPL) and not to allow others to use your |
| 38 * version of this file under the LGPL, indicate your decision by | 38 * version of this file under the LGPL, indicate your decision by |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 struct PaintLayerRareData { | 97 struct PaintLayerRareData { |
| 98 PaintLayerRareData(); | 98 PaintLayerRareData(); |
| 99 ~PaintLayerRareData(); | 99 ~PaintLayerRareData(); |
| 100 | 100 |
| 101 // Our current relative position offset. | 101 // Our current relative position offset. |
| 102 LayoutSize offsetForInFlowPosition; | 102 LayoutSize offsetForInFlowPosition; |
| 103 | 103 |
| 104 std::unique_ptr<TransformationMatrix> transform; | 104 std::unique_ptr<TransformationMatrix> transform; |
| 105 | 105 |
| 106 // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if w
e are not paginated. | 106 // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if |
| 107 // we are not paginated. |
| 107 // | 108 // |
| 108 // See LayoutMultiColumnFlowThread and | 109 // See LayoutMultiColumnFlowThread and |
| 109 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/mul
ti-column-layout | 110 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/mul
ti-column-layout |
| 110 // for more information about the multicol implementation. It's important to u
nderstand the | 111 // for more information about the multicol implementation. It's important to |
| 111 // difference between flow thread coordinates and visual coordinates when work
ing with multicol | 112 // understand the difference between flow thread coordinates and visual |
| 112 // in Layer, since Layer is one of the few places where we have to worry about
the | 113 // coordinates when working with multicol in Layer, since Layer is one of the |
| 113 // visual ones. Internally we try to use flow-thread coordinates whenever poss
ible. | 114 // few places where we have to worry about the visual ones. Internally we try |
| 115 // to use flow-thread coordinates whenever possible. |
| 114 PaintLayer* enclosingPaginationLayer; | 116 PaintLayer* enclosingPaginationLayer; |
| 115 | 117 |
| 116 // These compositing reasons are updated whenever style changes, not while upd
ating compositing layers. | 118 // These compositing reasons are updated whenever style changes, not while |
| 117 // They should not be used to infer the compositing state of this layer. | 119 // updating compositing layers. They should not be used to infer the |
| 120 // compositing state of this layer. |
| 118 CompositingReasons potentialCompositingReasonsFromStyle; | 121 CompositingReasons potentialCompositingReasonsFromStyle; |
| 119 | 122 |
| 120 // Once computed, indicates all that a layer needs to become composited using
the CompositingReasons enum bitfield. | 123 // Once computed, indicates all that a layer needs to become composited using |
| 124 // the CompositingReasons enum bitfield. |
| 121 CompositingReasons compositingReasons; | 125 CompositingReasons compositingReasons; |
| 122 | 126 |
| 123 // This captures reasons why a paint layer might be forced to be separately | 127 // This captures reasons why a paint layer might be forced to be separately |
| 124 // composited rather than sharing a backing with another layer. | 128 // composited rather than sharing a backing with another layer. |
| 125 SquashingDisallowedReasons squashingDisallowedReasons; | 129 SquashingDisallowedReasons squashingDisallowedReasons; |
| 126 | 130 |
| 127 // If the layer paints into its own backings, this keeps track of the backings
. | 131 // If the layer paints into its own backings, this keeps track of the |
| 128 // It's nullptr if the layer is not composited or paints into grouped backing. | 132 // backings. It's nullptr if the layer is not composited or paints into |
| 133 // grouped backing. |
| 129 std::unique_ptr<CompositedLayerMapping> compositedLayerMapping; | 134 std::unique_ptr<CompositedLayerMapping> compositedLayerMapping; |
| 130 | 135 |
| 131 // If the layer paints into grouped backing (i.e. squashed), this points to th
e | 136 // If the layer paints into grouped backing (i.e. squashed), this points to |
| 132 // grouped CompositedLayerMapping. It's null if the layer is not composited or | 137 // the grouped CompositedLayerMapping. It's null if the layer is not |
| 133 // paints into its own backing. | 138 // composited or paints into its own backing. |
| 134 CompositedLayerMapping* groupedMapping; | 139 CompositedLayerMapping* groupedMapping; |
| 135 | 140 |
| 136 Persistent<PaintLayerFilterInfo> filterInfo; | 141 Persistent<PaintLayerFilterInfo> filterInfo; |
| 137 | 142 |
| 138 // The accumulated subpixel offset of a composited layer's composited bounds c
ompared to absolute coordinates. | 143 // The accumulated subpixel offset of a composited layer's composited bounds |
| 144 // compared to absolute coordinates. |
| 139 LayoutSize subpixelAccumulation; | 145 LayoutSize subpixelAccumulation; |
| 140 }; | 146 }; |
| 141 | 147 |
| 142 // PaintLayer is an old object that handles lots of unrelated operations. | 148 // PaintLayer is an old object that handles lots of unrelated operations. |
| 143 // | 149 // |
| 144 // We want it to die at some point and be replaced by more focused objects, | 150 // We want it to die at some point and be replaced by more focused objects, |
| 145 // which would remove (or at least compartimentalize) a lot of complexity. | 151 // which would remove (or at least compartimentalize) a lot of complexity. |
| 146 // See the STATUS OF PAINTLAYER section below. | 152 // See the STATUS OF PAINTLAYER section below. |
| 147 // | 153 // |
| 148 // The class is central to painting and hit-testing. That's because it handles | 154 // The class is central to painting and hit-testing. That's because it handles |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return m_layoutObject && m_layoutObject->isBox() | 228 return m_layoutObject && m_layoutObject->isBox() |
| 223 ? toLayoutBox(m_layoutObject) | 229 ? toLayoutBox(m_layoutObject) |
| 224 : 0; | 230 : 0; |
| 225 } | 231 } |
| 226 PaintLayer* parent() const { return m_parent; } | 232 PaintLayer* parent() const { return m_parent; } |
| 227 PaintLayer* previousSibling() const { return m_previous; } | 233 PaintLayer* previousSibling() const { return m_previous; } |
| 228 PaintLayer* nextSibling() const { return m_next; } | 234 PaintLayer* nextSibling() const { return m_next; } |
| 229 PaintLayer* firstChild() const { return m_first; } | 235 PaintLayer* firstChild() const { return m_first; } |
| 230 PaintLayer* lastChild() const { return m_last; } | 236 PaintLayer* lastChild() const { return m_last; } |
| 231 | 237 |
| 232 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be goo
d but | 238 // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be |
| 233 // we can't use it for now because it conflicts with PaintInfo::paintContainer
. | 239 // good but we can't use it for now because it conflicts with |
| 240 // PaintInfo::paintContainer. |
| 234 PaintLayer* compositingContainer() const; | 241 PaintLayer* compositingContainer() const; |
| 235 | 242 |
| 236 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0); | 243 void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0); |
| 237 PaintLayer* removeChild(PaintLayer*); | 244 PaintLayer* removeChild(PaintLayer*); |
| 238 | 245 |
| 239 void removeOnlyThisLayerAfterStyleChange(); | 246 void removeOnlyThisLayerAfterStyleChange(); |
| 240 void insertOnlyThisLayerAfterStyleChange(); | 247 void insertOnlyThisLayerAfterStyleChange(); |
| 241 | 248 |
| 242 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); | 249 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle); |
| 243 | 250 |
| 244 // FIXME: Many people call this function while it has out-of-date information. | 251 // FIXME: Many people call this function while it has out-of-date information. |
| 245 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } | 252 bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; } |
| 246 | 253 |
| 247 // PaintLayers which represent LayoutParts may become self-painting due to bei
ng composited. | 254 // PaintLayers which represent LayoutParts may become self-painting due to |
| 248 // If this is the case, this method returns true. | 255 // being composited. If this is the case, this method returns true. |
| 249 bool isSelfPaintingOnlyBecauseIsCompositedPart() const; | 256 bool isSelfPaintingOnlyBecauseIsCompositedPart() const; |
| 250 | 257 |
| 251 bool isTransparent() const { | 258 bool isTransparent() const { |
| 252 return layoutObject()->isTransparent() || | 259 return layoutObject()->isTransparent() || |
| 253 layoutObject()->style()->hasBlendMode() || layoutObject()->hasMask(); | 260 layoutObject()->style()->hasBlendMode() || layoutObject()->hasMask(); |
| 254 } | 261 } |
| 255 | 262 |
| 256 const PaintLayer* root() const { | 263 const PaintLayer* root() const { |
| 257 const PaintLayer* curr = this; | 264 const PaintLayer* curr = this; |
| 258 while (curr->parent()) | 265 while (curr->parent()) |
| 259 curr = curr->parent(); | 266 curr = curr->parent(); |
| 260 return curr; | 267 return curr; |
| 261 } | 268 } |
| 262 | 269 |
| 263 const LayoutPoint& location() const { | 270 const LayoutPoint& location() const { |
| 264 ASSERT(!m_needsPositionUpdate); | 271 ASSERT(!m_needsPositionUpdate); |
| 265 return m_location; | 272 return m_location; |
| 266 } | 273 } |
| 267 // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fails
in some tests, | 274 // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fails |
| 268 // for example, fast/repaint/clipped-relative.html. | 275 // in some tests, for example, fast/repaint/clipped-relative.html. |
| 269 const IntSize& size() const { return m_size; } | 276 const IntSize& size() const { return m_size; } |
| 270 void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; } | 277 void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; } |
| 271 | 278 |
| 272 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); } | 279 LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); } |
| 273 | 280 |
| 274 bool isRootLayer() const { return m_isRootLayer; } | 281 bool isRootLayer() const { return m_isRootLayer; } |
| 275 | 282 |
| 276 PaintLayerCompositor* compositor() const; | 283 PaintLayerCompositor* compositor() const; |
| 277 | 284 |
| 278 // Notification from the layoutObject that its content changed (e.g. current f
rame of image changed). | 285 // Notification from the layoutObject that its content changed (e.g. current |
| 279 // Allows updates of layer content without invalidating paint. | 286 // frame of image changed). Allows updates of layer content without |
| 287 // invalidating paint. |
| 280 void contentChanged(ContentChangeType); | 288 void contentChanged(ContentChangeType); |
| 281 | 289 |
| 282 void updateLayerPosition(); | 290 void updateLayerPosition(); |
| 283 | 291 |
| 284 void updateLayerPositionsAfterLayout(); | 292 void updateLayerPositionsAfterLayout(); |
| 285 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta); | 293 void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta); |
| 286 | 294 |
| 287 PaintLayer* enclosingPaginationLayer() const { | 295 PaintLayer* enclosingPaginationLayer() const { |
| 288 return m_rareData ? m_rareData->enclosingPaginationLayer : nullptr; | 296 return m_rareData ? m_rareData->enclosingPaginationLayer : nullptr; |
| 289 } | 297 } |
| 290 | 298 |
| 291 void updateTransformationMatrix(); | 299 void updateTransformationMatrix(); |
| 292 PaintLayer* renderingContextRoot(); | 300 PaintLayer* renderingContextRoot(); |
| 293 const PaintLayer* renderingContextRoot() const; | 301 const PaintLayer* renderingContextRoot() const; |
| 294 | 302 |
| 295 LayoutSize offsetForInFlowPosition() const { | 303 LayoutSize offsetForInFlowPosition() const { |
| 296 return m_rareData ? m_rareData->offsetForInFlowPosition : LayoutSize(); | 304 return m_rareData ? m_rareData->offsetForInFlowPosition : LayoutSize(); |
| 297 } | 305 } |
| 298 | 306 |
| 299 PaintLayerStackingNode* stackingNode() { return m_stackingNode.get(); } | 307 PaintLayerStackingNode* stackingNode() { return m_stackingNode.get(); } |
| 300 const PaintLayerStackingNode* stackingNode() const { | 308 const PaintLayerStackingNode* stackingNode() const { |
| 301 return m_stackingNode.get(); | 309 return m_stackingNode.get(); |
| 302 } | 310 } |
| 303 | 311 |
| 304 bool subtreeIsInvisible() const { | 312 bool subtreeIsInvisible() const { |
| 305 return !hasVisibleContent() && !hasVisibleDescendant(); | 313 return !hasVisibleContent() && !hasVisibleDescendant(); |
| 306 } | 314 } |
| 307 | 315 |
| 308 // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() if
m_isVisibleContentDirty. | 316 // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() if |
| 317 // m_isVisibleContentDirty. |
| 309 bool hasVisibleContent() const { | 318 bool hasVisibleContent() const { |
| 310 DCHECK(!m_isVisibleContentDirty); | 319 DCHECK(!m_isVisibleContentDirty); |
| 311 return m_hasVisibleContent; | 320 return m_hasVisibleContent; |
| 312 } | 321 } |
| 313 | 322 |
| 314 // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags()
if m_isVisibleDescendantDirty. | 323 // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags() |
| 324 // if m_isVisibleDescendantDirty. |
| 315 bool hasVisibleDescendant() const { | 325 bool hasVisibleDescendant() const { |
| 316 DCHECK(!m_isVisibleDescendantDirty); | 326 DCHECK(!m_isVisibleDescendantDirty); |
| 317 return m_hasVisibleDescendant; | 327 return m_hasVisibleDescendant; |
| 318 } | 328 } |
| 319 | 329 |
| 320 void dirtyVisibleContentStatus(); | 330 void dirtyVisibleContentStatus(); |
| 321 void potentiallyDirtyVisibleContentStatus(EVisibility); | 331 void potentiallyDirtyVisibleContentStatus(EVisibility); |
| 322 | 332 |
| 323 bool hasBoxDecorationsOrBackground() const; | 333 bool hasBoxDecorationsOrBackground() const; |
| 324 bool hasVisibleBoxDecorations() const; | 334 bool hasVisibleBoxDecorations() const; |
| 325 // True if this layer container layoutObjects that paint. | 335 // True if this layer container layoutObjects that paint. |
| 326 bool hasNonEmptyChildLayoutObjects() const; | 336 bool hasNonEmptyChildLayoutObjects() const; |
| 327 | 337 |
| 328 // Will ensure that isAllScrollingContentComposited() is up to date. | 338 // Will ensure that isAllScrollingContentComposited() is up to date. |
| 329 void updateScrollingStateAfterCompositingChange(); | 339 void updateScrollingStateAfterCompositingChange(); |
| 330 bool isAllScrollingContentComposited() const { | 340 bool isAllScrollingContentComposited() const { |
| 331 return m_isAllScrollingContentComposited; | 341 return m_isAllScrollingContentComposited; |
| 332 } | 342 } |
| 333 | 343 |
| 334 // Gets the ancestor layer that serves as the containing block of this layer.
This is either | 344 // Gets the ancestor layer that serves as the containing block of this layer. |
| 335 // another out of flow positioned layer, or one that contains paint. | 345 // This is either another out of flow positioned layer, or one that contains |
| 336 // If |ancestor| is specified, |*skippedAncestor| will be set to true if |ance
stor| is found in | 346 // paint. If |ancestor| is specified, |*skippedAncestor| will be set to true |
| 337 // the ancestry chain between this layer and the containing block layer; if no
t found, it will | 347 // if |ancestor| is found in the ancestry chain between this layer and the |
| 338 // be set to false. Either both |ancestor| and |skippedAncestor| should be nul
lptr, or none of | 348 // containing block layer; if not found, it will be set to false. Either both |
| 339 // them should. | 349 // |ancestor| and |skippedAncestor| should be nullptr, or none of them should. |
| 340 PaintLayer* containingLayerForOutOfFlowPositioned( | 350 PaintLayer* containingLayerForOutOfFlowPositioned( |
| 341 const PaintLayer* ancestor = nullptr, | 351 const PaintLayer* ancestor = nullptr, |
| 342 bool* skippedAncestor = nullptr) const; | 352 bool* skippedAncestor = nullptr) const; |
| 343 | 353 |
| 344 bool isPaintInvalidationContainer() const; | 354 bool isPaintInvalidationContainer() const; |
| 345 | 355 |
| 346 // Do *not* call this method unless you know what you are dooing. You probably
want to call enclosingCompositingLayerForPaintInvalidation() instead. | 356 // Do *not* call this method unless you know what you are dooing. You probably |
| 357 // want to call enclosingCompositingLayerForPaintInvalidation() instead. |
| 347 // If includeSelf is true, may return this. | 358 // If includeSelf is true, may return this. |
| 348 PaintLayer* enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot) const; | 359 PaintLayer* enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot) const; |
| 349 | 360 |
| 350 // Returns the enclosing layer root into which this layer paints, inclusive of
this one. Note that the enclosing layer may or may not have its own | 361 // Returns the enclosing layer root into which this layer paints, inclusive of |
| 351 // GraphicsLayer backing, but is nevertheless the root for a call to the Layer
::paint*() methods. | 362 // this one. Note that the enclosing layer may or may not have its own |
| 363 // GraphicsLayer backing, but is nevertheless the root for a call to the |
| 364 // Layer::paint*() methods. |
| 352 PaintLayer* enclosingLayerForPaintInvalidation() const; | 365 PaintLayer* enclosingLayerForPaintInvalidation() const; |
| 353 | 366 |
| 354 PaintLayer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const; | 367 PaintLayer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const; |
| 355 | 368 |
| 356 bool hasAncestorWithFilterThatMovesPixels() const; | 369 bool hasAncestorWithFilterThatMovesPixels() const; |
| 357 | 370 |
| 358 bool canUseConvertToLayerCoords() const { | 371 bool canUseConvertToLayerCoords() const { |
| 359 // These LayoutObjects have an impact on their layers without the layoutObje
cts knowing about it. | 372 // These LayoutObjects have an impact on their layers without the |
| 373 // layoutObjects knowing about it. |
| 360 return !layoutObject()->hasTransformRelatedProperty() && | 374 return !layoutObject()->hasTransformRelatedProperty() && |
| 361 !layoutObject()->isSVGRoot(); | 375 !layoutObject()->isSVGRoot(); |
| 362 } | 376 } |
| 363 | 377 |
| 364 void convertToLayerCoords(const PaintLayer* ancestorLayer, | 378 void convertToLayerCoords(const PaintLayer* ancestorLayer, |
| 365 LayoutPoint&) const; | 379 LayoutPoint&) const; |
| 366 void convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutRect&) const; | 380 void convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutRect&) const; |
| 367 | 381 |
| 368 // Does the same as convertToLayerCoords() when not in multicol. For multicol,
however, | 382 // Does the same as convertToLayerCoords() when not in multicol. For multicol, |
| 369 // convertToLayerCoords() calculates the offset in flow-thread coordinates (wh
at the layout | 383 // however, convertToLayerCoords() calculates the offset in flow-thread |
| 370 // engine uses internally), while this method calculates the visual coordinate
s; i.e. it figures | 384 // coordinates (what the layout engine uses internally), while this method |
| 371 // out which column the layer starts in and adds in the offset. See | 385 // calculates the visual coordinates; i.e. it figures out which column the |
| 372 // http://www.chromium.org/developers/design-documents/multi-column-layout for
more info. | 386 // layer starts in and adds in the offset. See |
| 387 // http://www.chromium.org/developers/design-documents/multi-column-layout for |
| 388 // more info. |
| 373 LayoutPoint visualOffsetFromAncestor(const PaintLayer* ancestorLayer) const; | 389 LayoutPoint visualOffsetFromAncestor(const PaintLayer* ancestorLayer) const; |
| 374 | 390 |
| 375 // Convert a bounding box from flow thread coordinates, relative to |this|, to
visual coordinates, relative to |ancestorLayer|. | 391 // Convert a bounding box from flow thread coordinates, relative to |this|, to |
| 376 // See http://www.chromium.org/developers/design-documents/multi-column-layout
for more info on these coordinate types. | 392 // visual coordinates, relative to |ancestorLayer|. |
| 377 // This method requires this layer to be paginated; i.e. it must have an enclo
singPaginationLayer(). | 393 // See http://www.chromium.org/developers/design-documents/multi-column-layout |
| 394 // for more info on these coordinate types. This method requires this layer |
| 395 // to be paginated; i.e. it must have an enclosingPaginationLayer(). |
| 378 void convertFromFlowThreadToVisualBoundingBoxInAncestor( | 396 void convertFromFlowThreadToVisualBoundingBoxInAncestor( |
| 379 const PaintLayer* ancestorLayer, | 397 const PaintLayer* ancestorLayer, |
| 380 LayoutRect&) const; | 398 LayoutRect&) const; |
| 381 | 399 |
| 382 // The hitTest() method looks for mouse events by walking layers that intersec
t the point from front to back. | 400 // The hitTest() method looks for mouse events by walking layers that |
| 401 // intersect the point from front to back. |
| 383 bool hitTest(HitTestResult&); | 402 bool hitTest(HitTestResult&); |
| 384 | 403 |
| 385 bool intersectsDamageRect(const LayoutRect& layerBounds, | 404 bool intersectsDamageRect(const LayoutRect& layerBounds, |
| 386 const LayoutRect& damageRect, | 405 const LayoutRect& damageRect, |
| 387 const LayoutPoint& offsetFromRoot) const; | 406 const LayoutPoint& offsetFromRoot) const; |
| 388 | 407 |
| 389 // MaybeIncludeTransformForAncestorLayer means that a transform on |ancestorLa
yer| may be applied to the bounding box, | 408 // MaybeIncludeTransformForAncestorLayer means that a transform on |
| 390 // in particular if paintsWithTransform() is true. | 409 // |ancestorLayer| may be applied to the bounding box, in particular if |
| 410 // paintsWithTransform() is true. |
| 391 enum CalculateBoundsOptions { | 411 enum CalculateBoundsOptions { |
| 392 MaybeIncludeTransformForAncestorLayer, | 412 MaybeIncludeTransformForAncestorLayer, |
| 393 NeverIncludeTransformForAncestorLayer, | 413 NeverIncludeTransformForAncestorLayer, |
| 394 IncludeTransformsAndCompositedChildLayers, | 414 IncludeTransformsAndCompositedChildLayers, |
| 395 }; | 415 }; |
| 396 | 416 |
| 397 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known. | 417 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known. |
| 398 LayoutRect physicalBoundingBox(const LayoutPoint& offsetFromRoot) const; | 418 LayoutRect physicalBoundingBox(const LayoutPoint& offsetFromRoot) const; |
| 399 LayoutRect physicalBoundingBox(const PaintLayer* ancestorLayer) const; | 419 LayoutRect physicalBoundingBox(const PaintLayer* ancestorLayer) const; |
| 400 LayoutRect physicalBoundingBoxIncludingStackingChildren( | 420 LayoutRect physicalBoundingBoxIncludingStackingChildren( |
| 401 const LayoutPoint& offsetFromRoot, | 421 const LayoutPoint& offsetFromRoot, |
| 402 CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const; | 422 CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const; |
| 403 LayoutRect fragmentsBoundingBox(const PaintLayer* ancestorLayer) const; | 423 LayoutRect fragmentsBoundingBox(const PaintLayer* ancestorLayer) const; |
| 404 | 424 |
| 405 FloatRect boxForFilter() const; | 425 FloatRect boxForFilter() const; |
| 406 LayoutRect boxForClipPath() const; | 426 LayoutRect boxForClipPath() const; |
| 407 | 427 |
| 408 LayoutRect boundingBoxForCompositingOverlapTest() const; | 428 LayoutRect boundingBoxForCompositingOverlapTest() const; |
| 409 | 429 |
| 410 // If true, this layer's children are included in its bounds for overlap testi
ng. | 430 // If true, this layer's children are included in its bounds for overlap |
| 411 // We can't rely on the children's positions if this layer has a filter that c
ould have moved the children's pixels around. | 431 // testing. We can't rely on the children's positions if this layer has a |
| 432 // filter that could have moved the children's pixels around. |
| 412 bool overlapBoundsIncludeChildren() const; | 433 bool overlapBoundsIncludeChildren() const; |
| 413 LayoutRect boundingBoxForCompositing( | 434 LayoutRect boundingBoxForCompositing( |
| 414 const PaintLayer* ancestorLayer = 0, | 435 const PaintLayer* ancestorLayer = 0, |
| 415 CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const; | 436 CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const; |
| 416 | 437 |
| 417 LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; } | 438 LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; } |
| 418 LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; } | 439 LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; } |
| 419 | 440 |
| 420 void setStaticInlinePosition(LayoutUnit position) { | 441 void setStaticInlinePosition(LayoutUnit position) { |
| 421 m_staticInlinePosition = position; | 442 m_staticInlinePosition = position; |
| 422 } | 443 } |
| 423 void setStaticBlockPosition(LayoutUnit position) { | 444 void setStaticBlockPosition(LayoutUnit position) { |
| 424 m_staticBlockPosition = position; | 445 m_staticBlockPosition = position; |
| 425 } | 446 } |
| 426 | 447 |
| 427 LayoutSize subpixelAccumulation() const; | 448 LayoutSize subpixelAccumulation() const; |
| 428 void setSubpixelAccumulation(const LayoutSize&); | 449 void setSubpixelAccumulation(const LayoutSize&); |
| 429 | 450 |
| 430 bool hasTransformRelatedProperty() const { | 451 bool hasTransformRelatedProperty() const { |
| 431 return layoutObject()->hasTransformRelatedProperty(); | 452 return layoutObject()->hasTransformRelatedProperty(); |
| 432 } | 453 } |
| 433 // Note that this transform has the transform-origin baked in. | 454 // Note that this transform has the transform-origin baked in. |
| 434 TransformationMatrix* transform() const { | 455 TransformationMatrix* transform() const { |
| 435 return m_rareData ? m_rareData->transform.get() : nullptr; | 456 return m_rareData ? m_rareData->transform.get() : nullptr; |
| 436 } | 457 } |
| 437 | 458 |
| 438 // currentTransform computes a transform which takes accelerated animations in
to account. The | 459 // currentTransform computes a transform which takes accelerated animations |
| 439 // resulting transform has transform-origin baked in. If the layer does not ha
ve a transform, | 460 // into account. The resulting transform has transform-origin baked in. If the |
| 440 // returns the identity matrix. | 461 // layer does not have a transform, returns the identity matrix. |
| 441 TransformationMatrix currentTransform() const; | 462 TransformationMatrix currentTransform() const; |
| 442 TransformationMatrix renderableTransform(GlobalPaintFlags) const; | 463 TransformationMatrix renderableTransform(GlobalPaintFlags) const; |
| 443 | 464 |
| 444 // Get the perspective transform, which is applied to transformed sublayers. | 465 // Get the perspective transform, which is applied to transformed sublayers. |
| 445 // Returns true if the layer has a -webkit-perspective. | 466 // Returns true if the layer has a -webkit-perspective. |
| 446 // Note that this transform does not have the perspective-origin baked in. | 467 // Note that this transform does not have the perspective-origin baked in. |
| 447 TransformationMatrix perspectiveTransform() const; | 468 TransformationMatrix perspectiveTransform() const; |
| 448 FloatPoint perspectiveOrigin() const; | 469 FloatPoint perspectiveOrigin() const; |
| 449 bool preserves3D() const { return layoutObject()->style()->preserves3D(); } | 470 bool preserves3D() const { return layoutObject()->style()->preserves3D(); } |
| 450 bool has3DTransform() const { | 471 bool has3DTransform() const { |
| 451 return m_rareData && m_rareData->transform && | 472 return m_rareData && m_rareData->transform && |
| 452 !m_rareData->transform->isAffine(); | 473 !m_rareData->transform->isAffine(); |
| 453 } | 474 } |
| 454 | 475 |
| 455 // FIXME: reflections should force transform-style to be flat in the style: ht
tps://bugs.webkit.org/show_bug.cgi?id=106959 | 476 // FIXME: reflections should force transform-style to be flat in the style: |
| 477 // https://bugs.webkit.org/show_bug.cgi?id=106959 |
| 456 bool shouldPreserve3D() const { | 478 bool shouldPreserve3D() const { |
| 457 return !layoutObject()->hasReflection() && | 479 return !layoutObject()->hasReflection() && |
| 458 layoutObject()->style()->preserves3D(); | 480 layoutObject()->style()->preserves3D(); |
| 459 } | 481 } |
| 460 | 482 |
| 461 void filterNeedsPaintInvalidation(); | 483 void filterNeedsPaintInvalidation(); |
| 462 | 484 |
| 463 // Returns |true| if any property that renders using filter operations is | 485 // Returns |true| if any property that renders using filter operations is |
| 464 // used (including, but not limited to, 'filter' and 'box-reflect'). | 486 // used (including, but not limited to, 'filter' and 'box-reflect'). |
| 465 bool hasFilterInducingProperty() const { | 487 bool hasFilterInducingProperty() const { |
| 466 return layoutObject()->hasFilterInducingProperty(); | 488 return layoutObject()->hasFilterInducingProperty(); |
| 467 } | 489 } |
| 468 | 490 |
| 469 void* operator new(size_t); | 491 void* operator new(size_t); |
| 470 // Only safe to call from LayoutBoxModelObject::destroyLayer() | 492 // Only safe to call from LayoutBoxModelObject::destroyLayer() |
| 471 void operator delete(void*); | 493 void operator delete(void*); |
| 472 | 494 |
| 473 CompositingState compositingState() const; | 495 CompositingState compositingState() const; |
| 474 | 496 |
| 475 // This returns true if our document is in a phase of its lifestyle during whi
ch | 497 // This returns true if our document is in a phase of its lifestyle during |
| 476 // compositing state may legally be read. | 498 // which compositing state may legally be read. |
| 477 bool isAllowedToQueryCompositingState() const; | 499 bool isAllowedToQueryCompositingState() const; |
| 478 | 500 |
| 479 // Don't null check this. | 501 // Don't null check this. |
| 480 // FIXME: Rename. | 502 // FIXME: Rename. |
| 481 CompositedLayerMapping* compositedLayerMapping() const; | 503 CompositedLayerMapping* compositedLayerMapping() const; |
| 482 GraphicsLayer* graphicsLayerBacking() const; | 504 GraphicsLayer* graphicsLayerBacking() const; |
| 483 GraphicsLayer* graphicsLayerBackingForScrolling() const; | 505 GraphicsLayer* graphicsLayerBackingForScrolling() const; |
| 484 // Returns true for layers with scrollable overflow which have a background | 506 // Returns true for layers with scrollable overflow which have a background |
| 485 // that can be painted into the composited scrolling contents layer when it ex
ist | 507 // that can be painted into the composited scrolling contents layer when it |
| 486 // (i.e. the background can scroll with the content). When the background is a
lso | 508 // exist (i.e. the background can scroll with the content). When the |
| 487 // opaque this allows us to composite the scroller even on low DPI as we can | 509 // background is also opaque this allows us to composite the scroller even on |
| 488 // draw with subpixel anti-aliasing. | 510 // low DPI as we can draw with subpixel anti-aliasing. |
| 489 bool canPaintBackgroundOntoScrollingContentsLayer() const; | 511 bool canPaintBackgroundOntoScrollingContentsLayer() const; |
| 490 // NOTE: If you are using hasCompositedLayerMapping to determine the state of
compositing for this layer, | 512 // NOTE: If you are using hasCompositedLayerMapping to determine the state of |
| 491 // (and not just to do bookkeeping related to the mapping like, say, allocatin
g or deallocating a mapping), | 513 // compositing for this layer, (and not just to do bookkeeping related to the |
| 492 // then you may have incorrect logic. Use compositingState() instead. | 514 // mapping like, say, allocating or deallocating a mapping), then you may have |
| 493 // FIXME: This is identical to null checking compositedLayerMapping(), why not
just call that? | 515 // incorrect logic. Use compositingState() instead. |
| 516 // FIXME: This is identical to null checking compositedLayerMapping(), why not |
| 517 // just call that? |
| 494 bool hasCompositedLayerMapping() const { | 518 bool hasCompositedLayerMapping() const { |
| 495 return m_rareData && m_rareData->compositedLayerMapping; | 519 return m_rareData && m_rareData->compositedLayerMapping; |
| 496 } | 520 } |
| 497 void ensureCompositedLayerMapping(); | 521 void ensureCompositedLayerMapping(); |
| 498 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); | 522 void clearCompositedLayerMapping(bool layerBeingDestroyed = false); |
| 499 CompositedLayerMapping* groupedMapping() const { | 523 CompositedLayerMapping* groupedMapping() const { |
| 500 return m_rareData ? m_rareData->groupedMapping : nullptr; | 524 return m_rareData ? m_rareData->groupedMapping : nullptr; |
| 501 } | 525 } |
| 502 enum SetGroupMappingOptions { | 526 enum SetGroupMappingOptions { |
| 503 InvalidateLayerAndRemoveFromMapping, | 527 InvalidateLayerAndRemoveFromMapping, |
| 504 DoNotInvalidateLayerAndRemoveFromMapping | 528 DoNotInvalidateLayerAndRemoveFromMapping |
| 505 }; | 529 }; |
| 506 void setGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions); | 530 void setGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions); |
| 507 | 531 |
| 508 bool hasCompositedMask() const; | 532 bool hasCompositedMask() const; |
| 509 bool hasCompositedClippingMask() const; | 533 bool hasCompositedClippingMask() const; |
| 510 bool needsCompositedScrolling() const { | 534 bool needsCompositedScrolling() const { |
| 511 return m_scrollableArea && m_scrollableArea->needsCompositedScrolling(); | 535 return m_scrollableArea && m_scrollableArea->needsCompositedScrolling(); |
| 512 } | 536 } |
| 513 | 537 |
| 514 static void mapPointInPaintInvalidationContainerToBacking( | 538 static void mapPointInPaintInvalidationContainerToBacking( |
| 515 const LayoutBoxModelObject& paintInvalidationContainer, | 539 const LayoutBoxModelObject& paintInvalidationContainer, |
| 516 FloatPoint&); | 540 FloatPoint&); |
| 517 static void mapRectInPaintInvalidationContainerToBacking( | 541 static void mapRectInPaintInvalidationContainerToBacking( |
| 518 const LayoutBoxModelObject& paintInvalidationContainer, | 542 const LayoutBoxModelObject& paintInvalidationContainer, |
| 519 LayoutRect&); | 543 LayoutRect&); |
| 520 | 544 |
| 521 // Adjusts the given rect (in the coordinate space of the LayoutObject) to the
coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. | 545 // Adjusts the given rect (in the coordinate space of the LayoutObject) to the |
| 522 // Should use PaintInvalidationState::mapRectToPaintInvalidationBacking() inst
ead if PaintInvalidationState is available. | 546 // coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing. |
| 547 // Should use PaintInvalidationState::mapRectToPaintInvalidationBacking() |
| 548 // instead if PaintInvalidationState is available. |
| 523 static void mapRectToPaintInvalidationBacking( | 549 static void mapRectToPaintInvalidationBacking( |
| 524 const LayoutObject&, | 550 const LayoutObject&, |
| 525 const LayoutBoxModelObject& paintInvalidationContainer, | 551 const LayoutBoxModelObject& paintInvalidationContainer, |
| 526 LayoutRect&); | 552 LayoutRect&); |
| 527 | 553 |
| 528 bool paintsWithTransparency(GlobalPaintFlags globalPaintFlags) const { | 554 bool paintsWithTransparency(GlobalPaintFlags globalPaintFlags) const { |
| 529 return isTransparent() && | 555 return isTransparent() && |
| 530 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || | 556 ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || |
| 531 compositingState() != PaintsIntoOwnBacking); | 557 compositingState() != PaintsIntoOwnBacking); |
| 532 } | 558 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 bool isInTopLayer() const; | 601 bool isInTopLayer() const; |
| 576 | 602 |
| 577 bool scrollsWithViewport() const; | 603 bool scrollsWithViewport() const; |
| 578 bool scrollsWithRespectTo(const PaintLayer*) const; | 604 bool scrollsWithRespectTo(const PaintLayer*) const; |
| 579 | 605 |
| 580 void addLayerHitTestRects(LayerHitTestRects&) const; | 606 void addLayerHitTestRects(LayerHitTestRects&) const; |
| 581 | 607 |
| 582 // Compute rects only for this layer | 608 // Compute rects only for this layer |
| 583 void computeSelfHitTestRects(LayerHitTestRects&) const; | 609 void computeSelfHitTestRects(LayerHitTestRects&) const; |
| 584 | 610 |
| 585 // FIXME: This should probably return a ScrollableArea but a lot of internal m
ethods are mistakenly exposed. | 611 // FIXME: This should probably return a ScrollableArea but a lot of internal |
| 612 // methods are mistakenly exposed. |
| 586 PaintLayerScrollableArea* getScrollableArea() const { | 613 PaintLayerScrollableArea* getScrollableArea() const { |
| 587 return m_scrollableArea.get(); | 614 return m_scrollableArea.get(); |
| 588 } | 615 } |
| 589 | 616 |
| 590 PaintLayerClipper clipper() const { return PaintLayerClipper(*this); } | 617 PaintLayerClipper clipper() const { return PaintLayerClipper(*this); } |
| 591 | 618 |
| 592 bool scrollsOverflow() const; | 619 bool scrollsOverflow() const; |
| 593 | 620 |
| 594 CompositingReasons potentialCompositingReasonsFromStyle() const { | 621 CompositingReasons potentialCompositingReasonsFromStyle() const { |
| 595 return m_rareData ? m_rareData->potentialCompositingReasonsFromStyle | 622 return m_rareData ? m_rareData->potentialCompositingReasonsFromStyle |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 ASSERT(isAllowedToQueryCompositingState()); | 812 ASSERT(isAllowedToQueryCompositingState()); |
| 786 return m_shouldIsolateCompositedDescendants; | 813 return m_shouldIsolateCompositedDescendants; |
| 787 } | 814 } |
| 788 void setShouldIsolateCompositedDescendants(bool); | 815 void setShouldIsolateCompositedDescendants(bool); |
| 789 | 816 |
| 790 void updateDescendantDependentFlags(); | 817 void updateDescendantDependentFlags(); |
| 791 | 818 |
| 792 void updateOrRemoveFilterEffect(); | 819 void updateOrRemoveFilterEffect(); |
| 793 | 820 |
| 794 void updateSelfPaintingLayer(); | 821 void updateSelfPaintingLayer(); |
| 795 // This is O(depth) so avoid calling this in loops. Instead use optimizations
like | 822 // This is O(depth) so avoid calling this in loops. Instead use optimizations |
| 796 // those in PaintInvalidationState. | 823 // like those in PaintInvalidationState. |
| 797 PaintLayer* enclosingSelfPaintingLayer(); | 824 PaintLayer* enclosingSelfPaintingLayer(); |
| 798 | 825 |
| 799 PaintLayer* enclosingTransformedAncestor() const; | 826 PaintLayer* enclosingTransformedAncestor() const; |
| 800 LayoutPoint computeOffsetFromTransformedAncestor() const; | 827 LayoutPoint computeOffsetFromTransformedAncestor() const; |
| 801 | 828 |
| 802 void didUpdateNeedsCompositedScrolling(); | 829 void didUpdateNeedsCompositedScrolling(); |
| 803 | 830 |
| 804 bool hasSelfPaintingLayerDescendant() const { | 831 bool hasSelfPaintingLayerDescendant() const { |
| 805 if (m_hasSelfPaintingLayerDescendantDirty) | 832 if (m_hasSelfPaintingLayerDescendantDirty) |
| 806 updateHasSelfPaintingLayerDescendant(); | 833 updateHasSelfPaintingLayerDescendant(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 const PaintLayer* rootLayer, | 877 const PaintLayer* rootLayer, |
| 851 TransparencyClipBoxBehavior transparencyBehavior, | 878 TransparencyClipBoxBehavior transparencyBehavior, |
| 852 TransparencyClipBoxMode transparencyMode, | 879 TransparencyClipBoxMode transparencyMode, |
| 853 const LayoutSize& subPixelAccumulation, | 880 const LayoutSize& subPixelAccumulation, |
| 854 GlobalPaintFlags = GlobalPaintNormalPhase); | 881 GlobalPaintFlags = GlobalPaintNormalPhase); |
| 855 | 882 |
| 856 bool needsRepaint() const { return m_needsRepaint; } | 883 bool needsRepaint() const { return m_needsRepaint; } |
| 857 void setNeedsRepaint(); | 884 void setNeedsRepaint(); |
| 858 void clearNeedsRepaintRecursively(); | 885 void clearNeedsRepaintRecursively(); |
| 859 | 886 |
| 860 // These previousXXX() functions are for subsequence caching. They save the pa
inting status of the layer | 887 // These previousXXX() functions are for subsequence caching. They save the |
| 861 // during the previous painting with subsequence. A painting without subsequen
ce [1] doesn't change this status. | 888 // painting status of the layer during the previous painting with subsequence. |
| 862 // [1] See shouldCreateSubsequence() in PaintLayerPainter.cpp for the cases we
use subsequence when painting a PaintLayer. | 889 // A painting without subsequence [1] doesn't change this status. [1] See |
| 890 // shouldCreateSubsequence() in PaintLayerPainter.cpp for the cases we use |
| 891 // subsequence when painting a PaintLayer. |
| 863 | 892 |
| 864 IntSize previousScrollOffsetAccumulationForPainting() const { | 893 IntSize previousScrollOffsetAccumulationForPainting() const { |
| 865 return m_previousScrollOffsetAccumulationForPainting; | 894 return m_previousScrollOffsetAccumulationForPainting; |
| 866 } | 895 } |
| 867 void setPreviousScrollOffsetAccumulationForPainting(const IntSize& s) { | 896 void setPreviousScrollOffsetAccumulationForPainting(const IntSize& s) { |
| 868 m_previousScrollOffsetAccumulationForPainting = s; | 897 m_previousScrollOffsetAccumulationForPainting = s; |
| 869 } | 898 } |
| 870 | 899 |
| 871 ClipRects* previousPaintingClipRects() const { | 900 ClipRects* previousPaintingClipRects() const { |
| 872 return m_previousPaintingClipRects.get(); | 901 return m_previousPaintingClipRects.get(); |
| 873 } | 902 } |
| 874 void setPreviousPaintingClipRects(ClipRects& clipRects) { | 903 void setPreviousPaintingClipRects(ClipRects& clipRects) { |
| 875 m_previousPaintingClipRects = &clipRects; | 904 m_previousPaintingClipRects = &clipRects; |
| 876 } | 905 } |
| 877 | 906 |
| 878 LayoutRect previousPaintDirtyRect() const { return m_previousPaintDirtyRect; } | 907 LayoutRect previousPaintDirtyRect() const { return m_previousPaintDirtyRect; } |
| 879 void setPreviousPaintDirtyRect(const LayoutRect& rect) { | 908 void setPreviousPaintDirtyRect(const LayoutRect& rect) { |
| 880 m_previousPaintDirtyRect = rect; | 909 m_previousPaintDirtyRect = rect; |
| 881 } | 910 } |
| 882 | 911 |
| 883 PaintLayerPainter::PaintResult previousPaintResult() const { | 912 PaintLayerPainter::PaintResult previousPaintResult() const { |
| 884 return static_cast<PaintLayerPainter::PaintResult>(m_previousPaintResult); | 913 return static_cast<PaintLayerPainter::PaintResult>(m_previousPaintResult); |
| 885 } | 914 } |
| 886 void setPreviousPaintResult(PaintLayerPainter::PaintResult result) { | 915 void setPreviousPaintResult(PaintLayerPainter::PaintResult result) { |
| 887 m_previousPaintResult = static_cast<unsigned>(result); | 916 m_previousPaintResult = static_cast<unsigned>(result); |
| 888 ASSERT(m_previousPaintResult == static_cast<unsigned>(result)); | 917 ASSERT(m_previousPaintResult == static_cast<unsigned>(result)); |
| 889 } | 918 } |
| 890 | 919 |
| 891 // Used to skip PaintPhaseDescendantOutlinesOnly for layers that have never ha
d descendant outlines. | 920 // Used to skip PaintPhaseDescendantOutlinesOnly for layers that have never |
| 892 // The flag is set during paint invalidation on a self painting layer if any c
ontained object has outline. | 921 // had descendant outlines. The flag is set during paint invalidation on a |
| 893 // It's cleared during painting if PaintPhaseDescendantOutlinesOnly painted no
thing. | 922 // self painting layer if any contained object has outline. It's cleared |
| 923 // during painting if PaintPhaseDescendantOutlinesOnly painted nothing. |
| 894 // For more details, see core/paint/REAME.md#Empty paint phase optimization. | 924 // For more details, see core/paint/REAME.md#Empty paint phase optimization. |
| 895 bool needsPaintPhaseDescendantOutlines() const { | 925 bool needsPaintPhaseDescendantOutlines() const { |
| 896 return m_needsPaintPhaseDescendantOutlines && | 926 return m_needsPaintPhaseDescendantOutlines && |
| 897 !m_previousPaintPhaseDescendantOutlinesWasEmpty; | 927 !m_previousPaintPhaseDescendantOutlinesWasEmpty; |
| 898 } | 928 } |
| 899 void setNeedsPaintPhaseDescendantOutlines() { | 929 void setNeedsPaintPhaseDescendantOutlines() { |
| 900 DCHECK(isSelfPaintingLayer()); | 930 DCHECK(isSelfPaintingLayer()); |
| 901 m_needsPaintPhaseDescendantOutlines = true; | 931 m_needsPaintPhaseDescendantOutlines = true; |
| 902 m_previousPaintPhaseDescendantOutlinesWasEmpty = false; | 932 m_previousPaintPhaseDescendantOutlinesWasEmpty = false; |
| 903 } | 933 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 | 1065 |
| 1036 bool shouldBeSelfPaintingLayer() const; | 1066 bool shouldBeSelfPaintingLayer() const; |
| 1037 | 1067 |
| 1038 // FIXME: We should only create the stacking node if needed. | 1068 // FIXME: We should only create the stacking node if needed. |
| 1039 bool requiresStackingNode() const { return true; } | 1069 bool requiresStackingNode() const { return true; } |
| 1040 void updateStackingNode(); | 1070 void updateStackingNode(); |
| 1041 | 1071 |
| 1042 FilterOperations addReflectionToFilterOperations(const ComputedStyle&) const; | 1072 FilterOperations addReflectionToFilterOperations(const ComputedStyle&) const; |
| 1043 FilterEffect* updateFilterEffect() const; | 1073 FilterEffect* updateFilterEffect() const; |
| 1044 | 1074 |
| 1045 // FIXME: We could lazily allocate our ScrollableArea based on style propertie
s ('overflow', ...) | 1075 // FIXME: We could lazily allocate our ScrollableArea based on style |
| 1046 // but for now, we are always allocating it for LayoutBox as it's safer. crbug
.com/467721. | 1076 // properties ('overflow', ...) but for now, we are always allocating it for |
| 1077 // LayoutBox as it's safer. crbug.com/467721. |
| 1047 bool requiresScrollableArea() const { return layoutBox(); } | 1078 bool requiresScrollableArea() const { return layoutBox(); } |
| 1048 void updateScrollableArea(); | 1079 void updateScrollableArea(); |
| 1049 | 1080 |
| 1050 void dirtyAncestorChainVisibleDescendantStatus(); | 1081 void dirtyAncestorChainVisibleDescendantStatus(); |
| 1051 | 1082 |
| 1052 bool attemptDirectCompositingUpdate(StyleDifference, | 1083 bool attemptDirectCompositingUpdate(StyleDifference, |
| 1053 const ComputedStyle* oldStyle); | 1084 const ComputedStyle* oldStyle); |
| 1054 void updateTransform(const ComputedStyle* oldStyle, | 1085 void updateTransform(const ComputedStyle* oldStyle, |
| 1055 const ComputedStyle& newStyle); | 1086 const ComputedStyle& newStyle); |
| 1056 | 1087 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1075 layer.m_needsPaintPhaseDescendantOutlines; | 1106 layer.m_needsPaintPhaseDescendantOutlines; |
| 1076 m_needsPaintPhaseFloat |= layer.m_needsPaintPhaseFloat; | 1107 m_needsPaintPhaseFloat |= layer.m_needsPaintPhaseFloat; |
| 1077 m_needsPaintPhaseDescendantBlockBackgrounds |= | 1108 m_needsPaintPhaseDescendantBlockBackgrounds |= |
| 1078 layer.m_needsPaintPhaseDescendantBlockBackgrounds; | 1109 layer.m_needsPaintPhaseDescendantBlockBackgrounds; |
| 1079 } | 1110 } |
| 1080 | 1111 |
| 1081 bool isSelfPaintingLayerForIntrinsicOrScrollingReasons() const; | 1112 bool isSelfPaintingLayerForIntrinsicOrScrollingReasons() const; |
| 1082 | 1113 |
| 1083 bool shouldFragmentCompositedBounds(const PaintLayer* compositingLayer) const; | 1114 bool shouldFragmentCompositedBounds(const PaintLayer* compositingLayer) const; |
| 1084 | 1115 |
| 1085 // Self-painting layer is an optimization where we avoid the heavy Layer paint
ing | 1116 // Self-painting layer is an optimization where we avoid the heavy Layer |
| 1086 // machinery for a Layer allocated only to handle the overflow clip case. | 1117 // painting machinery for a Layer allocated only to handle the overflow clip |
| 1087 // FIXME(crbug.com/332791): Self-painting layer should be merged into the over
flow-only concept. | 1118 // case. |
| 1119 // FIXME(crbug.com/332791): Self-painting layer should be merged into the |
| 1120 // overflow-only concept. |
| 1088 unsigned m_isSelfPaintingLayer : 1; | 1121 unsigned m_isSelfPaintingLayer : 1; |
| 1089 | 1122 |
| 1090 // If have no self-painting descendants, we don't have to walk our children du
ring painting. This can lead to | 1123 // If have no self-painting descendants, we don't have to walk our children |
| 1091 // significant savings, especially if the tree has lots of non-self-painting l
ayers grouped together (e.g. table cells). | 1124 // during painting. This can lead to significant savings, especially if the |
| 1125 // tree has lots of non-self-painting layers grouped together (e.g. table |
| 1126 // cells). |
| 1092 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; | 1127 mutable unsigned m_hasSelfPaintingLayerDescendant : 1; |
| 1093 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; | 1128 mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1; |
| 1094 | 1129 |
| 1095 const unsigned m_isRootLayer : 1; | 1130 const unsigned m_isRootLayer : 1; |
| 1096 | 1131 |
| 1097 unsigned m_isVisibleContentDirty : 1; | 1132 unsigned m_isVisibleContentDirty : 1; |
| 1098 unsigned m_hasVisibleContent : 1; | 1133 unsigned m_hasVisibleContent : 1; |
| 1099 unsigned m_isVisibleDescendantDirty : 1; | 1134 unsigned m_isVisibleDescendantDirty : 1; |
| 1100 unsigned m_hasVisibleDescendant : 1; | 1135 unsigned m_hasVisibleDescendant : 1; |
| 1101 | 1136 |
| 1102 #if ENABLE(ASSERT) | 1137 #if ENABLE(ASSERT) |
| 1103 unsigned m_needsPositionUpdate : 1; | 1138 unsigned m_needsPositionUpdate : 1; |
| 1104 #endif | 1139 #endif |
| 1105 | 1140 |
| 1106 unsigned m_is3DTransformedDescendantDirty : 1; | 1141 unsigned m_is3DTransformedDescendantDirty : 1; |
| 1107 // Set on a stacking context layer that has 3D descendants anywhere | 1142 // Set on a stacking context layer that has 3D descendants anywhere |
| 1108 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. | 1143 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. |
| 1109 unsigned m_has3DTransformedDescendant : 1; | 1144 unsigned m_has3DTransformedDescendant : 1; |
| 1110 | 1145 |
| 1111 unsigned m_containsDirtyOverlayScrollbars : 1; | 1146 unsigned m_containsDirtyOverlayScrollbars : 1; |
| 1112 | 1147 |
| 1113 unsigned m_needsAncestorDependentCompositingInputsUpdate : 1; | 1148 unsigned m_needsAncestorDependentCompositingInputsUpdate : 1; |
| 1114 unsigned m_needsDescendantDependentCompositingInputsUpdate : 1; | 1149 unsigned m_needsDescendantDependentCompositingInputsUpdate : 1; |
| 1115 unsigned m_childNeedsCompositingInputsUpdate : 1; | 1150 unsigned m_childNeedsCompositingInputsUpdate : 1; |
| 1116 | 1151 |
| 1117 // Used only while determining what layers should be composited. Applies to th
e tree of z-order lists. | 1152 // Used only while determining what layers should be composited. Applies to |
| 1153 // the tree of z-order lists. |
| 1118 unsigned m_hasCompositingDescendant : 1; | 1154 unsigned m_hasCompositingDescendant : 1; |
| 1119 | 1155 |
| 1120 // True iff we have scrollable overflow and all children of m_layoutObject are
known to paint | 1156 // True iff we have scrollable overflow and all children of m_layoutObject are |
| 1121 // exclusively into their own composited layers. Set by updateScrollingStateA
fterCompositingChange(). | 1157 // known to paint exclusively into their own composited layers. Set by |
| 1158 // updateScrollingStateAfterCompositingChange(). |
| 1122 unsigned m_isAllScrollingContentComposited : 1; | 1159 unsigned m_isAllScrollingContentComposited : 1; |
| 1123 | 1160 |
| 1124 // Should be for stacking contexts having unisolated blending descendants. | 1161 // Should be for stacking contexts having unisolated blending descendants. |
| 1125 unsigned m_shouldIsolateCompositedDescendants : 1; | 1162 unsigned m_shouldIsolateCompositedDescendants : 1; |
| 1126 | 1163 |
| 1127 // True if this layout layer just lost its grouped mapping due to the Composit
edLayerMapping being destroyed, | 1164 // True if this layout layer just lost its grouped mapping due to the |
| 1128 // and we don't yet know to what graphics layer this Layer will be assigned. | 1165 // CompositedLayerMapping being destroyed, and we don't yet know to what |
| 1166 // graphics layer this Layer will be assigned. |
| 1129 unsigned m_lostGroupedMapping : 1; | 1167 unsigned m_lostGroupedMapping : 1; |
| 1130 | 1168 |
| 1131 unsigned m_needsRepaint : 1; | 1169 unsigned m_needsRepaint : 1; |
| 1132 unsigned m_previousPaintResult : 1; // PaintLayerPainter::PaintResult | 1170 unsigned m_previousPaintResult : 1; // PaintLayerPainter::PaintResult |
| 1133 | 1171 |
| 1134 unsigned m_needsPaintPhaseDescendantOutlines : 1; | 1172 unsigned m_needsPaintPhaseDescendantOutlines : 1; |
| 1135 unsigned m_previousPaintPhaseDescendantOutlinesWasEmpty : 1; | 1173 unsigned m_previousPaintPhaseDescendantOutlinesWasEmpty : 1; |
| 1136 unsigned m_needsPaintPhaseFloat : 1; | 1174 unsigned m_needsPaintPhaseFloat : 1; |
| 1137 unsigned m_previousPaintPhaseFloatWasEmpty : 1; | 1175 unsigned m_previousPaintPhaseFloatWasEmpty : 1; |
| 1138 unsigned m_needsPaintPhaseDescendantBlockBackgrounds : 1; | 1176 unsigned m_needsPaintPhaseDescendantBlockBackgrounds : 1; |
| 1139 unsigned m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty : 1; | 1177 unsigned m_previousPaintPhaseDescendantBlockBackgroundsWasEmpty : 1; |
| 1140 | 1178 |
| 1141 // These bitfields are part of ancestor/descendant dependent compositing input
s. | 1179 // These bitfields are part of ancestor/descendant dependent compositing |
| 1180 // inputs. |
| 1142 unsigned m_hasDescendantWithClipPath : 1; | 1181 unsigned m_hasDescendantWithClipPath : 1; |
| 1143 unsigned m_hasNonIsolatedDescendantWithBlendMode : 1; | 1182 unsigned m_hasNonIsolatedDescendantWithBlendMode : 1; |
| 1144 unsigned m_hasAncestorWithClipPath : 1; | 1183 unsigned m_hasAncestorWithClipPath : 1; |
| 1145 unsigned m_hasRootScrollerAsDescendant : 1; | 1184 unsigned m_hasRootScrollerAsDescendant : 1; |
| 1146 | 1185 |
| 1147 LayoutBoxModelObject* m_layoutObject; | 1186 LayoutBoxModelObject* m_layoutObject; |
| 1148 | 1187 |
| 1149 PaintLayer* m_parent; | 1188 PaintLayer* m_parent; |
| 1150 PaintLayer* m_previous; | 1189 PaintLayer* m_previous; |
| 1151 PaintLayer* m_next; | 1190 PaintLayer* m_next; |
| 1152 PaintLayer* m_first; | 1191 PaintLayer* m_first; |
| 1153 PaintLayer* m_last; | 1192 PaintLayer* m_last; |
| 1154 | 1193 |
| 1155 // Our (x,y) coordinates are in our parent layer's coordinate space. | 1194 // Our (x,y) coordinates are in our parent layer's coordinate space. |
| 1156 LayoutPoint m_location; | 1195 LayoutPoint m_location; |
| 1157 | 1196 |
| 1158 // The layer's size. | 1197 // The layer's size. |
| 1159 // | 1198 // |
| 1160 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border | 1199 // If the associated LayoutBoxModelObject is a LayoutBox, it's its border |
| 1161 // box. Otherwise, this is the LayoutInline's lines' bounding box. | 1200 // box. Otherwise, this is the LayoutInline's lines' bounding box. |
| 1162 IntSize m_size; | 1201 IntSize m_size; |
| 1163 | 1202 |
| 1164 // Cached normal flow values for absolute positioned elements with static left
/top values. | 1203 // Cached normal flow values for absolute positioned elements with static |
| 1204 // left/top values. |
| 1165 LayoutUnit m_staticInlinePosition; | 1205 LayoutUnit m_staticInlinePosition; |
| 1166 LayoutUnit m_staticBlockPosition; | 1206 LayoutUnit m_staticBlockPosition; |
| 1167 | 1207 |
| 1168 // The first ancestor having a non visible overflow. | 1208 // The first ancestor having a non visible overflow. |
| 1169 const PaintLayer* m_ancestorOverflowLayer; | 1209 const PaintLayer* m_ancestorOverflowLayer; |
| 1170 | 1210 |
| 1171 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; | 1211 AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs; |
| 1172 std::unique_ptr<RareAncestorDependentCompositingInputs> | 1212 std::unique_ptr<RareAncestorDependentCompositingInputs> |
| 1173 m_rareAncestorDependentCompositingInputs; | 1213 m_rareAncestorDependentCompositingInputs; |
| 1174 | 1214 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1187 | 1227 |
| 1188 } // namespace blink | 1228 } // namespace blink |
| 1189 | 1229 |
| 1190 #ifndef NDEBUG | 1230 #ifndef NDEBUG |
| 1191 // Outside the WebCore namespace for ease of invocation from gdb. | 1231 // Outside the WebCore namespace for ease of invocation from gdb. |
| 1192 void showLayerTree(const blink::PaintLayer*); | 1232 void showLayerTree(const blink::PaintLayer*); |
| 1193 void showLayerTree(const blink::LayoutObject*); | 1233 void showLayerTree(const blink::LayoutObject*); |
| 1194 #endif | 1234 #endif |
| 1195 | 1235 |
| 1196 #endif // Layer_h | 1236 #endif // Layer_h |
| OLD | NEW |