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

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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create( 155 RefPtr<ClipPaintPropertyNode> clipNode = ClipPaintPropertyNode::create(
156 context.currentTransform, 156 context.currentTransform,
157 FloatRoundedRect(FloatRect(clipRect)), 157 FloatRoundedRect(FloatRect(clipRect)),
158 context.currentClip); 158 context.currentClip);
159 context.currentClip = clipNode.get(); 159 context.currentClip = clipNode.get();
160 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release()); 160 object.getMutableForPainting().ensureObjectPaintProperties().setCssClip(clip Node.release());
161 } 161 }
162 162
163 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context) 163 void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o bject, const PaintPropertyTreeBuilderContext& context)
164 { 164 {
165 // Note: Currently only layer painter makes use of the pre-computed context. 165 // Avoid adding an ObjectPaintProperties for non-boxes to save memory, since we don't need them at the moment.
166 // This condition may be loosened with no adverse effects beside memory use. 166 if (!object.isBox() && !object.hasLayer())
167 if (!object.hasLayer())
168 return; 167 return;
169 168
170 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext = 169 std::unique_ptr<ObjectPaintProperties::LocalBorderBoxProperties> borderBoxCo ntext =
171 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); 170 wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties);
172 borderBoxContext->paintOffset = context.paintOffset; 171 borderBoxContext->paintOffset = context.paintOffset;
173 borderBoxContext->transform = context.currentTransform; 172 borderBoxContext->propertyTreeState = PropertyTreeState(context.currentTrans form, context.currentClip, context.currentEffect);
174 borderBoxContext->clip = context.currentClip;
175 borderBoxContext->effect = context.currentEffect;
176 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext)); 173 object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderB oxProperties(std::move(borderBoxContext));
177 } 174 }
178 175
179 // TODO(trchen): Remove this once we bake the paint offset into frameRect. 176 // TODO(trchen): Remove this once we bake the paint offset into frameRect.
180 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context) 177 void PaintPropertyTreeBuilder::updateScrollbarPaintOffset(const LayoutObject& ob ject, const PaintPropertyTreeBuilderContext& context)
181 { 178 {
182 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset); 179 IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
183 if (roundedPaintOffset == IntPoint()) 180 if (roundedPaintOffset == IntPoint())
184 return; 181 return;
185 182
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if (boxModelObject.isTableCell()) { 374 if (boxModelObject.isTableCell()) {
378 LayoutObject* parentRow = boxModelObject.parent(); 375 LayoutObject* parentRow = boxModelObject.parent();
379 ASSERT(parentRow && parentRow->isTableRow()); 376 ASSERT(parentRow && parentRow->isTableRow());
380 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( )); 377 context.paintOffset.moveBy(-toLayoutBox(parentRow)->topLeftLocation( ));
381 } 378 }
382 } 379 }
383 } 380 }
384 381
385 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context) 382 void PaintPropertyTreeBuilder::buildTreeNodes(const LayoutObject& object, PaintP ropertyTreeBuilderContext& context)
386 { 383 {
384 object.getMutableForPainting().clearObjectPaintProperties();
pdr. 2016/07/01 18:39:39 Won't this create an object paint properties for a
chrishtr 2016/07/01 22:01:12 This is clearObjectPaintProperties(), which remove
385
387 if (!object.isBoxModelObject() && !object.isSVG()) 386 if (!object.isBoxModelObject() && !object.isSVG())
388 return; 387 return;
389 388
390 object.getMutableForPainting().clearObjectPaintProperties();
391
392 deriveBorderBoxFromContainerContext(object, context); 389 deriveBorderBoxFromContainerContext(object, context);
393 390
394 updatePaintOffsetTranslation(object, context); 391 updatePaintOffsetTranslation(object, context);
395 updateTransform(object, context); 392 updateTransform(object, context);
396 updateEffect(object, context); 393 updateEffect(object, context);
397 updateCssClip(object, context); 394 updateCssClip(object, context);
398 updateLocalBorderBoxContext(object, context); 395 updateLocalBorderBoxContext(object, context);
399 updateScrollbarPaintOffset(object, context); 396 updateScrollbarPaintOffset(object, context);
400 updateOverflowClip(object, context); 397 updateOverflowClip(object, context);
401 // TODO(trchen): Insert flattening transform here, as specified by 398 // TODO(trchen): Insert flattening transform here, as specified by
402 // http://www.w3.org/TR/css3-transforms/#transform-style-property 399 // http://www.w3.org/TR/css3-transforms/#transform-style-property
403 updatePerspective(object, context); 400 updatePerspective(object, context);
404 updateSvgLocalToBorderBoxTransform(object, context); 401 updateSvgLocalToBorderBoxTransform(object, context);
405 updateScrollTranslation(object, context); 402 updateScrollTranslation(object, context);
406 updateOutOfFlowContext(object, context); 403 updateOutOfFlowContext(object, context);
407 } 404 }
408 405
409 } // namespace blink 406 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698