| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/PaintPropertyTreeBuilder.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/layout/LayoutPart.h" | 8 #include "core/layout/LayoutPart.h" |
| 9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/paint/ObjectPaintProperties.h" | 10 #include "core/paint/ObjectPaintProperties.h" |
| 11 #include "core/paint/PaintLayer.h" | 11 #include "core/paint/PaintLayer.h" |
| 12 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 12 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
| 13 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 13 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
| 14 #include "platform/transforms/TransformationMatrix.h" | 14 #include "platform/transforms/TransformationMatrix.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 // The context for layout tree walk. | 18 // The context for layout tree walk. |
| 19 // The walk will be done in the primary tree order (= DOM order), thus the conte
xt will also be | 19 // The walk will be done in the primary tree order (= DOM order), thus the conte
xt will also be |
| 20 // responsible for bookkeeping tree state in other order, for example, the most
recent position | 20 // responsible for bookkeeping tree state in other order, for example, the most
recent position |
| 21 // container seen. | 21 // container seen. |
| 22 struct PaintPropertyTreeBuilderContext { | 22 struct PrePaintTreeWalkContext { |
| 23 PaintPropertyTreeBuilderContext() | 23 PrePaintTreeWalkContext() |
| 24 : currentTransform(nullptr) | 24 : currentTransform(nullptr) |
| 25 , currentClip(nullptr) | 25 , currentClip(nullptr) |
| 26 , transformForAbsolutePosition(nullptr) | 26 , transformForAbsolutePosition(nullptr) |
| 27 , clipForAbsolutePosition(nullptr) | 27 , clipForAbsolutePosition(nullptr) |
| 28 , transformForFixedPosition(nullptr) | 28 , transformForFixedPosition(nullptr) |
| 29 , clipForFixedPosition(nullptr) | 29 , clipForFixedPosition(nullptr) |
| 30 , currentEffect(nullptr) { } | 30 , currentEffect(nullptr) { } |
| 31 | 31 |
| 32 // The combination of a transform and paint offset describes a linear space. | 32 // The combination of a transform and paint offset describes a linear space. |
| 33 // When a layout object recur to its children, the main context is expected
to refer | 33 // When a layout object recur to its children, the main context is expected
to refer |
| (...skipping 21 matching lines...) Expand all Loading... |
| 55 TransformPaintPropertyNode* transformForFixedPosition; | 55 TransformPaintPropertyNode* transformForFixedPosition; |
| 56 LayoutPoint paintOffsetForFixedPosition; | 56 LayoutPoint paintOffsetForFixedPosition; |
| 57 ClipPaintPropertyNode* clipForFixedPosition; | 57 ClipPaintPropertyNode* clipForFixedPosition; |
| 58 | 58 |
| 59 // The effect hierarchy is applied by the stacking context tree. It is guara
nteed that every | 59 // The effect hierarchy is applied by the stacking context tree. It is guara
nteed that every |
| 60 // DOM descendant is also a stacking context descendant. Therefore, we don't
need extra | 60 // DOM descendant is also a stacking context descendant. Therefore, we don't
need extra |
| 61 // bookkeeping for effect nodes and can generate the effect tree from a DOM-
order traversal. | 61 // bookkeeping for effect nodes and can generate the effect tree from a DOM-
order traversal. |
| 62 EffectPaintPropertyNode* currentEffect; | 62 EffectPaintPropertyNode* currentEffect; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 void PaintPropertyTreeBuilder::buildPropertyTrees(FrameView& rootFrame) | 65 void PrePaintTreeWalk::buildPropertyTrees(FrameView& rootFrame) |
| 66 { | 66 { |
| 67 walk(rootFrame, PaintPropertyTreeBuilderContext()); | 67 walk(rootFrame, PrePaintTreeWalkContext()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void PaintPropertyTreeBuilder::walk(FrameView& frameView, const PaintPropertyTre
eBuilderContext& context) | 70 void PrePaintTreeWalk::walk(FrameView& frameView, const PrePaintTreeWalkContext&
context) |
| 71 { | 71 { |
| 72 PaintPropertyTreeBuilderContext localContext(context); | 72 PrePaintTreeWalkContext localContext(context); |
| 73 | 73 |
| 74 // TODO(pdr): Creating paint properties for FrameView here will not be | 74 // TODO(pdr): Creating paint properties for FrameView here will not be |
| 75 // needed once settings()->rootLayerScrolls() is enabled. | 75 // needed once settings()->rootLayerScrolls() is enabled. |
| 76 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. | 76 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
| 77 | 77 |
| 78 TransformationMatrix frameTranslate; | 78 TransformationMatrix frameTranslate; |
| 79 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); | 79 frameTranslate.translate(frameView.x() + context.paintOffset.x(), frameView.
y() + context.paintOffset.y()); |
| 80 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = Trans
formPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.currentTra
nsform); | 80 RefPtr<TransformPaintPropertyNode> newTransformNodeForPreTranslation = Trans
formPaintPropertyNode::create(frameTranslate, FloatPoint3D(), context.currentTra
nsform); |
| 81 localContext.transformForFixedPosition = newTransformNodeForPreTranslation.g
et(); | 81 localContext.transformForFixedPosition = newTransformNodeForPreTranslation.g
et(); |
| 82 localContext.paintOffsetForFixedPosition = LayoutPoint(); | 82 localContext.paintOffsetForFixedPosition = LayoutPoint(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 93 localContext.paintOffset = localContext.paintOffsetForAbsolutePosition = Lay
outPoint(); | 93 localContext.paintOffset = localContext.paintOffsetForAbsolutePosition = Lay
outPoint(); |
| 94 | 94 |
| 95 frameView.setPreTranslation(newTransformNodeForPreTranslation.release()); | 95 frameView.setPreTranslation(newTransformNodeForPreTranslation.release()); |
| 96 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release(
)); | 96 frameView.setScrollTranslation(newTransformNodeForScrollTranslation.release(
)); |
| 97 frameView.setContentClip(newClipNodeForContentClip.release()); | 97 frameView.setContentClip(newClipNodeForContentClip.release()); |
| 98 | 98 |
| 99 if (LayoutView* layoutView = frameView.layoutView()) | 99 if (LayoutView* layoutView = frameView.layoutView()) |
| 100 walk(*layoutView, localContext); | 100 walk(*layoutView, localContext); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain
tPropertyTreeBuilderContext& context) | 103 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, PreP
aintTreeWalkContext& context) |
| 104 { | 104 { |
| 105 if (!object.isBoxModelObject()) | 105 if (!object.isBoxModelObject()) |
| 106 return; | 106 return; |
| 107 | 107 |
| 108 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); | 108 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); |
| 109 | 109 |
| 110 // TODO(trchen): There is some insanity going on with tables. Double check r
esults. | 110 // TODO(trchen): There is some insanity going on with tables. Double check r
esults. |
| 111 switch (object.styleRef().position()) { | 111 switch (object.styleRef().position()) { |
| 112 case StaticPosition: | 112 case StaticPosition: |
| 113 break; | 113 break; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 127 context.paintOffset = context.paintOffsetForFixedPosition; | 127 context.paintOffset = context.paintOffsetForFixedPosition; |
| 128 context.currentClip = context.clipForFixedPosition; | 128 context.currentClip = context.clipForFixedPosition; |
| 129 break; | 129 break; |
| 130 default: | 130 default: |
| 131 ASSERT_NOT_REACHED(); | 131 ASSERT_NOT_REACHED(); |
| 132 } | 132 } |
| 133 if (boxModelObject.isBox()) | 133 if (boxModelObject.isBox()) |
| 134 context.paintOffset += toLayoutBox(boxModelObject).locationOffset(); | 134 context.paintOffset += toLayoutBox(boxModelObject).locationOffset(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed
ed(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) | 137 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed
ed(const LayoutObject& object, PrePaintTreeWalkContext& context) |
| 138 { | 138 { |
| 139 bool shouldCreatePaintOffsetTranslationNode = false; | 139 bool shouldCreatePaintOffsetTranslationNode = false; |
| 140 if (object.isSVGRoot()) { | 140 if (object.isSVGRoot()) { |
| 141 // SVG doesn't use paint offset internally so emit a paint offset at the
html->svg boundary. | 141 // SVG doesn't use paint offset internally so emit a paint offset at the
html->svg boundary. |
| 142 shouldCreatePaintOffsetTranslationNode = true; | 142 shouldCreatePaintOffsetTranslationNode = true; |
| 143 } else if (object.isBoxModelObject()) { | 143 } else if (object.isBoxModelObject()) { |
| 144 // TODO(trchen): Eliminate PaintLayer dependency. | 144 // TODO(trchen): Eliminate PaintLayer dependency. |
| 145 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); | 145 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
| 146 shouldCreatePaintOffsetTranslationNode = layer && layer->paintsWithTrans
form(GlobalPaintNormalPhase); | 146 shouldCreatePaintOffsetTranslationNode = layer && layer->paintsWithTrans
form(GlobalPaintNormalPhase); |
| 147 } | 147 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 160 static FloatPoint3D transformOrigin(const LayoutBox& box) | 160 static FloatPoint3D transformOrigin(const LayoutBox& box) |
| 161 { | 161 { |
| 162 const ComputedStyle& style = box.styleRef(); | 162 const ComputedStyle& style = box.styleRef(); |
| 163 FloatSize borderBoxSize(box.size()); | 163 FloatSize borderBoxSize(box.size()); |
| 164 return FloatPoint3D( | 164 return FloatPoint3D( |
| 165 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), | 165 floatValueForLength(style.transformOriginX(), borderBoxSize.width()), |
| 166 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), | 166 floatValueForLength(style.transformOriginY(), borderBoxSize.height()), |
| 167 style.transformOriginZ()); | 167 style.transformOriginZ()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 static PassRefPtr<TransformPaintPropertyNode> createTransformIfNeeded(const Layo
utObject& object, PaintPropertyTreeBuilderContext& context) | 170 static PassRefPtr<TransformPaintPropertyNode> createTransformIfNeeded(const Layo
utObject& object, PrePaintTreeWalkContext& context) |
| 171 { | 171 { |
| 172 if (object.isSVG() && !object.isSVGRoot()) { | 172 if (object.isSVG() && !object.isSVGRoot()) { |
| 173 const AffineTransform& transform = object.localToParentTransform(); | 173 const AffineTransform& transform = object.localToParentTransform(); |
| 174 if (transform.isIdentity()) | 174 if (transform.isIdentity()) |
| 175 return nullptr; | 175 return nullptr; |
| 176 | 176 |
| 177 // SVG's transform origin is baked into the localToParentTransform. | 177 // SVG's transform origin is baked into the localToParentTransform. |
| 178 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = Transf
ormPaintPropertyNode::create( | 178 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = Transf
ormPaintPropertyNode::create( |
| 179 transform, FloatPoint3D(0, 0, 0), context.currentTransform); | 179 transform, FloatPoint3D(0, 0, 0), context.currentTransform); |
| 180 context.currentTransform = newTransformNodeForTransform.get(); | 180 context.currentTransform = newTransformNodeForTransform.get(); |
| 181 return newTransformNodeForTransform.release(); | 181 return newTransformNodeForTransform.release(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 const ComputedStyle& style = object.styleRef(); | 184 const ComputedStyle& style = object.styleRef(); |
| 185 if (!object.isBox() || !style.hasTransform()) | 185 if (!object.isBox() || !style.hasTransform()) |
| 186 return nullptr; | 186 return nullptr; |
| 187 | 187 |
| 188 ASSERT(context.paintOffset == LayoutPoint()); | 188 ASSERT(context.paintOffset == LayoutPoint()); |
| 189 | 189 |
| 190 TransformationMatrix matrix; | 190 TransformationMatrix matrix; |
| 191 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::Excl
udeTransformOrigin, | 191 style.applyTransform(matrix, toLayoutBox(object).size(), ComputedStyle::Excl
udeTransformOrigin, |
| 192 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTrans
formProperties); | 192 ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTrans
formProperties); |
| 193 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = TransformP
aintPropertyNode::create( | 193 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = TransformP
aintPropertyNode::create( |
| 194 matrix, transformOrigin(toLayoutBox(object)), context.currentTransform); | 194 matrix, transformOrigin(toLayoutBox(object)), context.currentTransform); |
| 195 context.currentTransform = newTransformNodeForTransform.get(); | 195 context.currentTransform = newTransformNodeForTransform.get(); |
| 196 return newTransformNodeForTransform.release(); | 196 return newTransformNodeForTransform.release(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 static PassRefPtr<EffectPaintPropertyNode> createEffectIfNeeded(const LayoutObje
ct& object, PaintPropertyTreeBuilderContext& context) | 199 static PassRefPtr<EffectPaintPropertyNode> createEffectIfNeeded(const LayoutObje
ct& object, PrePaintTreeWalkContext& context) |
| 200 { | 200 { |
| 201 const ComputedStyle& style = object.styleRef(); | 201 const ComputedStyle& style = object.styleRef(); |
| 202 if (!style.hasOpacity()) | 202 if (!style.hasOpacity()) |
| 203 return nullptr; | 203 return nullptr; |
| 204 RefPtr<EffectPaintPropertyNode> newEffectNode = EffectPaintPropertyNode::cre
ate(style.opacity(), context.currentEffect); | 204 RefPtr<EffectPaintPropertyNode> newEffectNode = EffectPaintPropertyNode::cre
ate(style.opacity(), context.currentEffect); |
| 205 context.currentEffect = newEffectNode.get(); | 205 context.currentEffect = newEffectNode.get(); |
| 206 return newEffectNode.release(); | 206 return newEffectNode.release(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 static PassRefPtr<ClipPaintPropertyNode> createOverflowClipIfNeeded(const Layout
Object& object, PaintPropertyTreeBuilderContext& context) | 209 static PassRefPtr<ClipPaintPropertyNode> createOverflowClipIfNeeded(const Layout
Object& object, PrePaintTreeWalkContext& context) |
| 210 { | 210 { |
| 211 if (!object.isBox()) | 211 if (!object.isBox()) |
| 212 return nullptr; | 212 return nullptr; |
| 213 const LayoutBox& box = toLayoutBox(object); | 213 const LayoutBox& box = toLayoutBox(object); |
| 214 | 214 |
| 215 // The <input> elements can't have contents thus CSS overflow property doesn
't apply. | 215 // The <input> elements can't have contents thus CSS overflow property doesn
't apply. |
| 216 // However for layout purposes we do generate child layout objects for them,
e.g. button label. | 216 // However for layout purposes we do generate child layout objects for them,
e.g. button label. |
| 217 // We should clip the overflow from those children. This is called control c
lip and we | 217 // We should clip the overflow from those children. This is called control c
lip and we |
| 218 // technically treat them like overflow clip. | 218 // technically treat them like overflow clip. |
| 219 LayoutRect clipRect; | 219 LayoutRect clipRect; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 243 | 243 |
| 244 static FloatPoint perspectiveOrigin(const LayoutBox& box) | 244 static FloatPoint perspectiveOrigin(const LayoutBox& box) |
| 245 { | 245 { |
| 246 const ComputedStyle& style = box.styleRef(); | 246 const ComputedStyle& style = box.styleRef(); |
| 247 FloatSize borderBoxSize(box.size()); | 247 FloatSize borderBoxSize(box.size()); |
| 248 return FloatPoint( | 248 return FloatPoint( |
| 249 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), | 249 floatValueForLength(style.perspectiveOriginX(), borderBoxSize.width()), |
| 250 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height()))
; | 250 floatValueForLength(style.perspectiveOriginY(), borderBoxSize.height()))
; |
| 251 } | 251 } |
| 252 | 252 |
| 253 static PassRefPtr<TransformPaintPropertyNode> createPerspectiveIfNeeded(const La
youtObject& object, PaintPropertyTreeBuilderContext& context) | 253 static PassRefPtr<TransformPaintPropertyNode> createPerspectiveIfNeeded(const La
youtObject& object, PrePaintTreeWalkContext& context) |
| 254 { | 254 { |
| 255 const ComputedStyle& style = object.styleRef(); | 255 const ComputedStyle& style = object.styleRef(); |
| 256 if (!object.isBox() || !style.hasPerspective()) | 256 if (!object.isBox() || !style.hasPerspective()) |
| 257 return nullptr; | 257 return nullptr; |
| 258 | 258 |
| 259 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = Transfor
mPaintPropertyNode::create( | 259 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = Transfor
mPaintPropertyNode::create( |
| 260 TransformationMatrix().applyPerspective(style.perspective()), | 260 TransformationMatrix().applyPerspective(style.perspective()), |
| 261 perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.paintOffse
t), context.currentTransform); | 261 perspectiveOrigin(toLayoutBox(object)) + toLayoutSize(context.paintOffse
t), context.currentTransform); |
| 262 context.currentTransform = newTransformNodeForPerspective.get(); | 262 context.currentTransform = newTransformNodeForPerspective.get(); |
| 263 return newTransformNodeForPerspective.release(); | 263 return newTransformNodeForPerspective.release(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 static PassRefPtr<TransformPaintPropertyNode> createScrollTranslationIfNeeded(co
nst LayoutObject& object, PaintPropertyTreeBuilderContext& context) | 266 static PassRefPtr<TransformPaintPropertyNode> createScrollTranslationIfNeeded(co
nst LayoutObject& object, PrePaintTreeWalkContext& context) |
| 267 { | 267 { |
| 268 if (!object.isBoxModelObject() || !object.hasOverflowClip()) | 268 if (!object.isBoxModelObject() || !object.hasOverflowClip()) |
| 269 return nullptr; | 269 return nullptr; |
| 270 | 270 |
| 271 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); | 271 PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
| 272 ASSERT(layer); | 272 ASSERT(layer); |
| 273 DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); | 273 DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); |
| 274 if (scrollOffset.isZero() && !layer->scrollsOverflow()) | 274 if (scrollOffset.isZero() && !layer->scrollsOverflow()) |
| 275 return nullptr; | 275 return nullptr; |
| 276 | 276 |
| 277 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr
ansformPaintPropertyNode::create( | 277 RefPtr<TransformPaintPropertyNode> newTransformNodeForScrollTranslation = Tr
ansformPaintPropertyNode::create( |
| 278 TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.he
ight()), | 278 TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.he
ight()), |
| 279 FloatPoint3D(), context.currentTransform); | 279 FloatPoint3D(), context.currentTransform); |
| 280 context.currentTransform = newTransformNodeForScrollTranslation.get(); | 280 context.currentTransform = newTransformNodeForScrollTranslation.get(); |
| 281 return newTransformNodeForScrollTranslation.release(); | 281 return newTransformNodeForScrollTranslation.release(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 static void updateOutOfFlowContext(const LayoutObject& object, PaintPropertyTree
BuilderContext& context) | 284 static void updateOutOfFlowContext(const LayoutObject& object, PrePaintTreeWalkC
ontext& context) |
| 285 { | 285 { |
| 286 // At the html->svg boundary (see: createPaintOffsetTranslationIfNeeded) the
currentTransform is | 286 // At the html->svg boundary (see: createPaintOffsetTranslationIfNeeded) the
currentTransform is |
| 287 // up-to-date for all children of the svg root element. Additionally, inside
SVG, all positioning | 287 // up-to-date for all children of the svg root element. Additionally, inside
SVG, all positioning |
| 288 // uses transforms. Therefore, we only need to check createdNewTransform and
isSVGRoot() to | 288 // uses transforms. Therefore, we only need to check createdNewTransform and
isSVGRoot() to |
| 289 // ensure out-of-flow and fixed positioning is correct at the svg->html boun
dary. | 289 // ensure out-of-flow and fixed positioning is correct at the svg->html boun
dary. |
| 290 | 290 |
| 291 if (object.canContainAbsolutePositionObjects()) { | 291 if (object.canContainAbsolutePositionObjects()) { |
| 292 context.transformForAbsolutePosition = context.currentTransform; | 292 context.transformForAbsolutePosition = context.currentTransform; |
| 293 context.paintOffsetForAbsolutePosition = context.paintOffset; | 293 context.paintOffsetForAbsolutePosition = context.paintOffset; |
| 294 context.clipForAbsolutePosition = context.currentClip; | 294 context.clipForAbsolutePosition = context.currentClip; |
| 295 } | 295 } |
| 296 | 296 |
| 297 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram
eView | 297 // TODO(pdr): Remove the !object.isLayoutView() condition when removing Fram
eView |
| 298 // paint properties for rootLayerScrolls. | 298 // paint properties for rootLayerScrolls. |
| 299 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { | 299 if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { |
| 300 context.transformForFixedPosition = context.currentTransform; | 300 context.transformForFixedPosition = context.currentTransform; |
| 301 context.paintOffsetForFixedPosition = context.paintOffset; | 301 context.paintOffsetForFixedPosition = context.paintOffset; |
| 302 context.clipForFixedPosition = context.currentClip; | 302 context.clipForFixedPosition = context.currentClip; |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 static PassOwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordTreeCon
textIfNeeded(LayoutObject& object, const PaintPropertyTreeBuilderContext& contex
t) | 306 static PassOwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordTreeCon
textIfNeeded(LayoutObject& object, const PrePaintTreeWalkContext& context) |
| 307 { | 307 { |
| 308 // Note: Currently only layer painter makes use of the pre-computed context. | 308 // Note: Currently only layer painter makes use of the pre-computed context. |
| 309 // This condition may be loosened with no adverse effects beside memory use. | 309 // This condition may be loosened with no adverse effects beside memory use. |
| 310 if (!object.hasLayer()) | 310 if (!object.hasLayer()) |
| 311 return nullptr; | 311 return nullptr; |
| 312 | 312 |
| 313 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordedContext = ad
optPtr(new ObjectPaintProperties::LocalBorderBoxProperties); | 313 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> recordedContext = ad
optPtr(new ObjectPaintProperties::LocalBorderBoxProperties); |
| 314 recordedContext->paintOffset = context.paintOffset; | 314 recordedContext->paintOffset = context.paintOffset; |
| 315 recordedContext->transform = context.currentTransform; | 315 recordedContext->transform = context.currentTransform; |
| 316 recordedContext->clip = context.currentClip; | 316 recordedContext->clip = context.currentClip; |
| 317 recordedContext->effect = context.currentEffect; | 317 recordedContext->effect = context.currentEffect; |
| 318 return recordedContext.release(); | 318 return recordedContext.release(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void PaintPropertyTreeBuilder::walk(LayoutObject& object, const PaintPropertyTre
eBuilderContext& context) | 321 void PrePaintTreeWalk::walk(LayoutObject& object, const PrePaintTreeWalkContext&
context) |
| 322 { | 322 { |
| 323 PaintPropertyTreeBuilderContext localContext(context); | 323 PrePaintTreeWalkContext localContext(context); |
| 324 | 324 |
| 325 deriveBorderBoxFromContainerContext(object, localContext); | 325 deriveBorderBoxFromContainerContext(object, localContext); |
| 326 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation
= createPaintOffsetTranslationIfNeeded(object, localContext); | 326 RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation
= createPaintOffsetTranslationIfNeeded(object, localContext); |
| 327 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTran
sformIfNeeded(object, localContext); | 327 RefPtr<TransformPaintPropertyNode> newTransformNodeForTransform = createTran
sformIfNeeded(object, localContext); |
| 328 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object,
localContext); | 328 RefPtr<EffectPaintPropertyNode> newEffectNode = createEffectIfNeeded(object,
localContext); |
| 329 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> newRecordedContext =
recordTreeContextIfNeeded(object, localContext); | 329 OwnPtr<ObjectPaintProperties::LocalBorderBoxProperties> newRecordedContext =
recordTreeContextIfNeeded(object, localContext); |
| 330 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowCli
pIfNeeded(object, localContext); | 330 RefPtr<ClipPaintPropertyNode> newClipNodeForOverflowClip = createOverflowCli
pIfNeeded(object, localContext); |
| 331 // TODO(trchen): Insert flattening transform here, as specified by | 331 // TODO(trchen): Insert flattening transform here, as specified by |
| 332 // http://www.w3.org/TR/css3-transforms/#transform-style-property | 332 // http://www.w3.org/TR/css3-transforms/#transform-style-property |
| 333 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPe
rspectiveIfNeeded(object, localContext); | 333 RefPtr<TransformPaintPropertyNode> newTransformNodeForPerspective = createPe
rspectiveIfNeeded(object, localContext); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 355 | 355 |
| 356 if (object.isLayoutPart()) { | 356 if (object.isLayoutPart()) { |
| 357 Widget* widget = toLayoutPart(object).widget(); | 357 Widget* widget = toLayoutPart(object).widget(); |
| 358 if (widget && widget->isFrameView()) | 358 if (widget && widget->isFrameView()) |
| 359 walk(*toFrameView(widget), localContext); | 359 walk(*toFrameView(widget), localContext); |
| 360 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 360 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace blink | 364 } // namespace blink |
| OLD | NEW |