Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2105273004: GeometryMapper: Support computing visual rects in spaces that are not direct ancestors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create( 161 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create(
162 context.currentTransform, 162 context.currentTransform,
163 FloatRoundedRect(FloatRect(clipRect)), 163 FloatRoundedRect(FloatRect(clipRect)),
164 context.currentClip); 164 context.currentClip);
165 context.currentClip = clipNode.get(); 165 context.currentClip = clipNode.get();
166 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release()); 166 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release());
167 } 167 }
168 168
169 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context) 169 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context)
170 { 170 {
171 // Note: Currently only layer painter makes use of the pre-computed context. 171 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since we don't need them at the moment.
172 // This condition may be loosened with no adverse effects beside memory use. 172 if (!object.isBox() && !object.hasLayer())
173 if (!object.hasLayer())
174 return; 173 return;
175 174
176 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext = 175 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext =
177 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); 176 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties);
178 borderBoxContext->paintOffset = context.paintOffset; 177 borderBoxContext->paintOffset = context.paintOffset;
179 borderBoxContext->transform = context.currentTransform; 178 borderBoxContext->propertyTreeState = PropertyTreeState(context.currentTrans form, context.currentClip, context.currentEffect);
180 borderBoxContext->clip = context.currentClip;
181 borderBoxContext->effect = context.currentEffect;
182 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext)); 179 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext));
183 } 180 }
184 181
185 // TODO(trchen): Remove this once we bake the paint offset into frameRect. 182 // TODO(trchen): Remove this once we bake the paint offset into frameRect.
186 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context) 183 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context)
187 { 184 {
188 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset); 185 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
189 if (roundedPaintOffset == IntPoint()) 186 if (roundedPaintOffset == IntPoint())
190 return; 187 return;
191 188
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (boxModelObject.isTableCell()) { 380 if (boxModelObject.isTableCell()) {
384 LayoutObject* parentRow = boxModelObject.parent(); 381 LayoutObject* parentRow = boxModelObject.parent();
385 ASSERT(parentRow && parentRow->isTableRow()); 382 ASSERT(parentRow && parentRow->isTableRow());
386 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( )); 383 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( ));
387 } 384 }
388 } 385 }
389 } 386 }
390 387
391 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context) 388 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context)
392 { 389 {
390 object.getMutableForPainting().clearObjectPaintProperties();
391
393 if (!object.isBoxModelObject() && !object.isSVG()) 392 if (!object.isBoxModelObject() && !object.isSVG())
394 return; 393 return;
395 394
396 object.getMutableForPainting().clearObjectPaintProperties();
397
398 deriveBorderBoxFromContainerContext(object, context); 395 deriveBorderBoxFromContainerContext(object, context);
399 396
400 updatePaintOffsetTranslation(object, context); 397 updatePaintOffsetTranslation(object, context);
401 updateTransform(object, context); 398 updateTransform(object, context);
402 updateEffect(object, context); 399 updateEffect(object, context);
403 updateCssClip(object, context); 400 updateCssClip(object, context);
404 updateLocalBorderBoxContext(object, context); 401 updateLocalBorderBoxContext(object, context);
405 updateScrollbarPaintOffset(object, context); 402 updateScrollbarPaintOffset(object, context);
406 updateOverflowClip(object, context); 403 updateOverflowClip(object, context);
407 // TODO(trchen): Insert flattening transform here, as specified by 404 // TODO(trchen): Insert flattening transform here, as specified by
408 // http://www.w3.org/TR/css3-transforms/#transform-style-property 405 // http://www.w3.org/TR/css3-transforms/#transform-style-property
409 updatePerspective(object, context); 406 updatePerspective(object, context);
410 updateSvgLocalToBorderBoxTransform(object, context); 407 updateSvgLocalToBorderBoxTransform(object, context);
411 updateScrollTranslation(object, context); 408 updateScrollTranslation(object, context);
412 updateOutOfFlowContext(object, context); 409 updateOutOfFlowContext(object, context);
413 } 410 }
414 411
415 } // namespace blink 412 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698