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

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

Issue 2657863004: Move scroll paint property nodes to be owned by the transform tree (Closed)
Patch Set: Rebase & remove parens Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/PaintPropertyTreePrinter.h" 5 #include "core/paint/PaintPropertyTreePrinter.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/layout/LayoutPart.h" 9 #include "core/layout/LayoutPart.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ")"); 212 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ")");
213 } 213 }
214 }; 214 };
215 215
216 template <> 216 template <>
217 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> { 217 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> {
218 public: 218 public:
219 static void addFrameViewProperties( 219 static void addFrameViewProperties(
220 const FrameView& frameView, 220 const FrameView& frameView,
221 PropertyTreePrinter<ScrollPaintPropertyNode>& printer) { 221 PropertyTreePrinter<ScrollPaintPropertyNode>& printer) {
222 if (const ScrollPaintPropertyNode* scroll = frameView.scroll()) 222 if (const auto* scrollTranslation = frameView.scrollTranslation()) {
223 printer.addPropertyNode(scroll, "Scroll (FrameView)"); 223 const auto* scrollNode = scrollTranslation->scrollNode();
224 printer.addPropertyNode(scrollNode, "Scroll (FrameView)");
225 }
224 } 226 }
225 227
226 static void addObjectPaintProperties( 228 static void addObjectPaintProperties(
227 const LayoutObject& object, 229 const LayoutObject& object,
228 const ObjectPaintProperties& paintProperties, 230 const ObjectPaintProperties& paintProperties,
229 PropertyTreePrinter<ScrollPaintPropertyNode>& printer) { 231 PropertyTreePrinter<ScrollPaintPropertyNode>& printer) {
230 if (const ScrollPaintPropertyNode* scroll = paintProperties.scroll()) 232 if (const auto* scrollTranslation = paintProperties.scrollTranslation()) {
231 printer.addPropertyNode(scroll, "Scroll (" + object.debugName() + ")"); 233 printer.addPropertyNode(scrollTranslation->scrollNode(),
234 "Scroll (" + object.debugName() + ")");
235 }
232 } 236 }
233 }; 237 };
234 238
235 class PaintPropertyTreeGraphBuilder { 239 class PaintPropertyTreeGraphBuilder {
236 public: 240 public:
237 PaintPropertyTreeGraphBuilder() {} 241 PaintPropertyTreeGraphBuilder() {}
238 242
239 void generateTreeGraph(const FrameView& frameView, 243 void generateTreeGraph(const FrameView& frameView,
240 StringBuilder& stringBuilder) { 244 StringBuilder& stringBuilder) {
241 m_layout.str(""); 245 m_layout.str("");
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 const ClipPaintPropertyNode* overflowClip = properties->overflowClip(); 426 const ClipPaintPropertyNode* overflowClip = properties->overflowClip();
423 if (overflowClip) { 427 if (overflowClip) {
424 if (const ClipPaintPropertyNode* innerBorderRadiusClip = 428 if (const ClipPaintPropertyNode* innerBorderRadiusClip =
425 properties->innerBorderRadiusClip()) 429 properties->innerBorderRadiusClip())
426 writePaintPropertyNode(*innerBorderRadiusClip, &object, 430 writePaintPropertyNode(*innerBorderRadiusClip, &object,
427 "innerBorderRadiusClip"); 431 "innerBorderRadiusClip");
428 writePaintPropertyNode(*overflowClip, &object, "overflowClip"); 432 writePaintPropertyNode(*overflowClip, &object, "overflowClip");
429 if (object.isLayoutView() && overflowClip->parent()) 433 if (object.isLayoutView() && overflowClip->parent())
430 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootClip"); 434 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootClip");
431 } 435 }
432 const ScrollPaintPropertyNode* scroll = properties->scroll(); 436
437 const auto* scroll =
438 scrollTranslation ? scrollTranslation->scrollNode() : nullptr;
433 if (scroll) 439 if (scroll)
434 writePaintPropertyNode(*scroll, &object, "scroll"); 440 writePaintPropertyNode(*scroll, &object, "scroll");
435 } 441 }
436 442
437 template <typename PropertyTreeNode> 443 template <typename PropertyTreeNode>
438 static const PropertyTreeNode* getRoot(const PropertyTreeNode* node) { 444 static const PropertyTreeNode* getRoot(const PropertyTreeNode* node) {
439 while (node && !node->isRoot()) 445 while (node && !node->isRoot())
440 node = node->parent(); 446 node = node->parent();
441 return node; 447 return node;
442 } 448 }
443 449
444 void writeFrameViewPaintPropertyNodes(const FrameView& frameView) { 450 void writeFrameViewPaintPropertyNodes(const FrameView& frameView) {
445 if (const auto* contentsState = 451 if (const auto* contentsState =
446 frameView.totalPropertyTreeStateForContents()) { 452 frameView.totalPropertyTreeStateForContents()) {
447 if (const auto* root = getRoot(contentsState->transform())) 453 if (const auto* root = getRoot(contentsState->transform()))
448 writePaintPropertyNode(*root, &frameView, "rootTransform"); 454 writePaintPropertyNode(*root, &frameView, "rootTransform");
449 if (const auto* root = getRoot(contentsState->clip())) 455 if (const auto* root = getRoot(contentsState->clip()))
450 writePaintPropertyNode(*root, &frameView, "rootClip"); 456 writePaintPropertyNode(*root, &frameView, "rootClip");
451 if (const auto* root = getRoot(contentsState->effect())) 457 if (const auto* root = getRoot(contentsState->effect()))
452 writePaintPropertyNode(*root, &frameView, "rootEffect"); 458 writePaintPropertyNode(*root, &frameView, "rootEffect");
453 if (const auto* root = getRoot(contentsState->scroll()))
454 writePaintPropertyNode(*root, &frameView, "rootScroll");
455 } 459 }
456 TransformPaintPropertyNode* preTranslation = frameView.preTranslation(); 460 TransformPaintPropertyNode* preTranslation = frameView.preTranslation();
457 if (preTranslation) 461 if (preTranslation)
458 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation"); 462 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation");
459 TransformPaintPropertyNode* scrollTranslation = 463 TransformPaintPropertyNode* scrollTranslation =
460 frameView.scrollTranslation(); 464 frameView.scrollTranslation();
461 if (scrollTranslation) 465 if (scrollTranslation)
462 writePaintPropertyNode(*scrollTranslation, &frameView, 466 writePaintPropertyNode(*scrollTranslation, &frameView,
463 "scrollTranslation"); 467 "scrollTranslation");
464 ClipPaintPropertyNode* contentClip = frameView.contentClip(); 468 ClipPaintPropertyNode* contentClip = frameView.contentClip();
465 if (contentClip) 469 if (contentClip)
466 writePaintPropertyNode(*contentClip, &frameView, "contentClip"); 470 writePaintPropertyNode(*contentClip, &frameView, "contentClip");
467 const ScrollPaintPropertyNode* scroll = frameView.scroll(); 471 const auto* scroll =
472 scrollTranslation ? scrollTranslation->scrollNode() : nullptr;
468 if (scroll) 473 if (scroll)
469 writePaintPropertyNode(*scroll, &frameView, "scroll"); 474 writePaintPropertyNode(*scroll, &frameView, "scroll");
470 } 475 }
471 476
472 void writeLayoutObjectNode(const LayoutObject& object) { 477 void writeLayoutObjectNode(const LayoutObject& object) {
473 std::ostream& os = m_layout; 478 std::ostream& os = m_layout;
474 os << "n" << &object << " [color=" << s_layoutNodeColor 479 os << "n" << &object << " [color=" << s_layoutNodeColor
475 << ", fontcolor=" << s_layoutNodeColor << ", label=\"" << object.name(); 480 << ", fontcolor=" << s_layoutNodeColor << ", label=\"" << object.name();
476 Node* node = object.node(); 481 Node* node = object.node();
477 if (node) { 482 if (node) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 579 }
575 580
576 String paintPropertyTreeGraph(const blink::FrameView& frameView) { 581 String paintPropertyTreeGraph(const blink::FrameView& frameView) {
577 blink::PaintPropertyTreeGraphBuilder builder; 582 blink::PaintPropertyTreeGraphBuilder builder;
578 StringBuilder stringBuilder; 583 StringBuilder stringBuilder;
579 builder.generateTreeGraph(frameView, stringBuilder); 584 builder.generateTreeGraph(frameView, stringBuilder);
580 return stringBuilder.toString(); 585 return stringBuilder.toString();
581 } 586 }
582 587
583 #endif // DCHECK_IS_ON() 588 #endif // DCHECK_IS_ON()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698