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

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

Issue 2320463002: [SPV2] Implement the blink-side scroll property tree (Closed)
Patch Set: Prevent circular reference caught by lsan Created 4 years, 3 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (const EffectPaintPropertyNode* effect = paintProperties.effect()) 186 if (const EffectPaintPropertyNode* effect = paintProperties.effect())
187 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") "); 187 printer.addPropertyNode(effect, "Effect (" + object.debugName() + ") ");
188 } 188 }
189 189
190 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder) 190 static void printNodeAsString(const EffectPaintPropertyNode* node, StringBui lder& stringBuilder)
191 { 191 {
192 stringBuilder.append(String::format(" opacity=%f", node->opacity())); 192 stringBuilder.append(String::format(" opacity=%f", node->opacity()));
193 } 193 }
194 }; 194 };
195 195
196 template <>
197 class PropertyTreePrinterTraits<ScrollPaintPropertyNode> {
198 public:
199 static void addFrameViewProperties(const FrameView& frameView, PropertyTreeP rinter<ScrollPaintPropertyNode>& printer)
200 {
201 if (const ScrollPaintPropertyNode* rootScroll = frameView.rootScroll())
202 printer.addPropertyNode(rootScroll, "RootScroll (FrameView)");
203 if (const ScrollPaintPropertyNode* scroll = frameView.scroll())
204 printer.addPropertyNode(scroll, "Scroll (FrameView)");
205 }
206
207 static void addObjectPaintProperties(const LayoutObject& object, const Objec tPaintProperties& paintProperties, PropertyTreePrinter<ScrollPaintPropertyNode>& printer)
208 {
209 if (const ScrollPaintPropertyNode* scroll = paintProperties.scroll())
210 printer.addPropertyNode(scroll, "Scroll (" + object.debugName() + ") ");
211 }
212
213 static void printNodeAsString(const ScrollPaintPropertyNode* node, StringBui lder& stringBuilder)
214 {
215 FloatSize scrollOffset = node->scrollOffsetTranslation()->matrix().to2DT ranslation();
216 stringBuilder.append(" scrollOffsetTranslation=");
217 stringBuilder.append(scrollOffset.toString());
218 stringBuilder.append(" clip=");
219 stringBuilder.append(node->clip().toString());
220 stringBuilder.append(" bounds=");
221 stringBuilder.append(node->bounds().toString());
222 stringBuilder.append(" userScrollableHorizontal=");
223 stringBuilder.append(node->userScrollableHorizontal() ? "yes" : "no");
224 stringBuilder.append(" userScrollableVertical=");
225 stringBuilder.append(node->userScrollableVertical() ? "yes" : "no");
226 }
227 };
228
196 class PaintPropertyTreeGraphBuilder { 229 class PaintPropertyTreeGraphBuilder {
197 public: 230 public:
198 PaintPropertyTreeGraphBuilder() { } 231 PaintPropertyTreeGraphBuilder() { }
199 232
200 void generateTreeGraph(const FrameView& frameView, StringBuilder& stringBuil der) 233 void generateTreeGraph(const FrameView& frameView, StringBuilder& stringBuil der)
201 { 234 {
202 m_layout.str(""); 235 m_layout.str("");
203 m_properties.str(""); 236 m_properties.str("");
204 m_ownerEdges.str(""); 237 m_ownerEdges.str("");
205 m_properties << std::setprecision(2) << std::setiosflags(std::ios_base:: fixed); 238 m_properties << std::setprecision(2) << std::setiosflags(std::ios_base:: fixed);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 std::ostream& os = m_properties; 345 std::ostream& os = m_properties;
313 os << "n" << &node << " [shape=diamond, label=\"" << label << "\\n"; 346 os << "n" << &node << " [shape=diamond, label=\"" << label << "\\n";
314 os << "opacity=" << node.opacity() << "\"];" << std::endl; 347 os << "opacity=" << node.opacity() << "\"];" << std::endl;
315 348
316 if (owner) 349 if (owner)
317 writeOwnerEdge(&node, owner); 350 writeOwnerEdge(&node, owner);
318 if (node.parent()) 351 if (node.parent())
319 writeParentEdge(&node, node.parent(), s_effectNodeColor, os); 352 writeParentEdge(&node, node.parent(), s_effectNodeColor, os);
320 } 353 }
321 354
355 void writePaintPropertyNode(const ScrollPaintPropertyNode&, const void*, con st char*)
356 {
357 // TODO(pdr): fill this out.
358 }
359
322 void writeObjectPaintPropertyNodes(const LayoutObject& object) 360 void writeObjectPaintPropertyNodes(const LayoutObject& object)
323 { 361 {
324 const ObjectPaintProperties* properties = object.objectPaintProperties() ; 362 const ObjectPaintProperties* properties = object.objectPaintProperties() ;
325 if (!properties) 363 if (!properties)
326 return; 364 return;
327 const TransformPaintPropertyNode* paintOffset = properties->paintOffsetT ranslation(); 365 const TransformPaintPropertyNode* paintOffset = properties->paintOffsetT ranslation();
328 if (paintOffset) 366 if (paintOffset)
329 writePaintPropertyNode(*paintOffset, &object, "paintOffset"); 367 writePaintPropertyNode(*paintOffset, &object, "paintOffset");
330 const TransformPaintPropertyNode* transform = properties->transform(); 368 const TransformPaintPropertyNode* transform = properties->transform();
331 if (transform) 369 if (transform)
(...skipping 18 matching lines...) Expand all
350 writePaintPropertyNode(*cssClip, &object, "cssClip"); 388 writePaintPropertyNode(*cssClip, &object, "cssClip");
351 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition(); 389 const ClipPaintPropertyNode* cssClipFixedPosition = properties->cssClipF ixedPosition();
352 if (cssClipFixedPosition) 390 if (cssClipFixedPosition)
353 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position"); 391 writePaintPropertyNode(*cssClipFixedPosition, &object, "cssClipFixed Position");
354 const ClipPaintPropertyNode* overflowClip = properties->overflowClip(); 392 const ClipPaintPropertyNode* overflowClip = properties->overflowClip();
355 if (overflowClip) { 393 if (overflowClip) {
356 writePaintPropertyNode(*overflowClip, &object, "overflowClip"); 394 writePaintPropertyNode(*overflowClip, &object, "overflowClip");
357 if (object.isLayoutView() && overflowClip->parent()) 395 if (object.isLayoutView() && overflowClip->parent())
358 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootCl ip"); 396 writePaintPropertyNode(*overflowClip->parent(), nullptr, "rootCl ip");
359 } 397 }
398 const ScrollPaintPropertyNode* scroll = properties->scroll();
399 if (scroll)
400 writePaintPropertyNode(*scroll, &object, "scroll");
360 } 401 }
361 402
362 void writeFrameViewPaintPropertyNodes(const FrameView& frameView) 403 void writeFrameViewPaintPropertyNodes(const FrameView& frameView)
363 { 404 {
364 TransformPaintPropertyNode* rootTransform = frameView.rootTransform(); 405 TransformPaintPropertyNode* rootTransform = frameView.rootTransform();
365 if (rootTransform) 406 if (rootTransform)
366 writePaintPropertyNode(*rootTransform, &frameView, "rootTransform"); 407 writePaintPropertyNode(*rootTransform, &frameView, "rootTransform");
367 ClipPaintPropertyNode* rootClip = frameView.rootClip(); 408 ClipPaintPropertyNode* rootClip = frameView.rootClip();
368 if (rootClip) 409 if (rootClip)
369 writePaintPropertyNode(*rootClip, &frameView, "rootClip"); 410 writePaintPropertyNode(*rootClip, &frameView, "rootClip");
370 EffectPaintPropertyNode* rootEffect = frameView.rootEffect(); 411 EffectPaintPropertyNode* rootEffect = frameView.rootEffect();
371 if (rootEffect) 412 if (rootEffect)
372 writePaintPropertyNode(*rootEffect, &frameView, "rootEffect"); 413 writePaintPropertyNode(*rootEffect, &frameView, "rootEffect");
373 TransformPaintPropertyNode* preTranslation = frameView.preTranslation(); 414 TransformPaintPropertyNode* preTranslation = frameView.preTranslation();
374 if (preTranslation) 415 if (preTranslation)
375 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" ); 416 writePaintPropertyNode(*preTranslation, &frameView, "preTranslation" );
376 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion(); 417 TransformPaintPropertyNode* scrollTranslation = frameView.scrollTranslat ion();
377 if (scrollTranslation) 418 if (scrollTranslation)
378 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation"); 419 writePaintPropertyNode(*scrollTranslation, &frameView, "scrollTransl ation");
379 ClipPaintPropertyNode* contentClip = frameView.contentClip(); 420 ClipPaintPropertyNode* contentClip = frameView.contentClip();
380 if (contentClip) 421 if (contentClip)
381 writePaintPropertyNode(*contentClip, &frameView, "contentClip"); 422 writePaintPropertyNode(*contentClip, &frameView, "contentClip");
423 ScrollPaintPropertyNode* scroll = frameView.scroll();
424 if (scroll)
425 writePaintPropertyNode(*scroll, &frameView, "scroll");
382 } 426 }
383 427
384 void writeLayoutObjectNode(const LayoutObject& object) 428 void writeLayoutObjectNode(const LayoutObject& object)
385 { 429 {
386 std::ostream& os = m_layout; 430 std::ostream& os = m_layout;
387 os << "n" << &object 431 os << "n" << &object
388 << " [color=" << s_layoutNodeColor 432 << " [color=" << s_layoutNodeColor
389 << ", fontcolor=" << s_layoutNodeColor 433 << ", fontcolor=" << s_layoutNodeColor
390 << ", label=\"" << object.name(); 434 << ", label=\"" << object.name();
391 Node* node = object.node(); 435 Node* node = object.node();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 void showClipPropertyTree(const blink::FrameView& rootFrame) 494 void showClipPropertyTree(const blink::FrameView& rootFrame)
451 { 495 {
452 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showTree(rootFram e); 496 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showTree(rootFram e);
453 } 497 }
454 498
455 void showEffectPropertyTree(const blink::FrameView& rootFrame) 499 void showEffectPropertyTree(const blink::FrameView& rootFrame)
456 { 500 {
457 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showTree(rootFr ame); 501 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showTree(rootFr ame);
458 } 502 }
459 503
504 void showScrollPropertyTree(const blink::FrameView& rootFrame)
505 {
506 blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().showTree(rootFr ame);
507 }
508
460 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node) 509 void showPaintPropertyPath(const blink::TransformPaintPropertyNode* node)
461 { 510 {
462 blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>().showPath(nod e); 511 blink::PropertyTreePrinter<blink::TransformPaintPropertyNode>().showPath(nod e);
463 } 512 }
464 513
465 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node) 514 void showPaintPropertyPath(const blink::ClipPaintPropertyNode* node)
466 { 515 {
467 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showPath(node); 516 blink::PropertyTreePrinter<blink::ClipPaintPropertyNode>().showPath(node);
468 } 517 }
469 518
470 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node) 519 void showPaintPropertyPath(const blink::EffectPaintPropertyNode* node)
471 { 520 {
472 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showPath(node); 521 blink::PropertyTreePrinter<blink::EffectPaintPropertyNode>().showPath(node);
473 } 522 }
474 523
524 void showPaintPropertyPath(const blink::ScrollPaintPropertyNode* node)
525 {
526 blink::PropertyTreePrinter<blink::ScrollPaintPropertyNode>().showPath(node);
527 }
528
475 String paintPropertyTreeGraph(const blink::FrameView& frameView) 529 String paintPropertyTreeGraph(const blink::FrameView& frameView)
476 { 530 {
477 blink::PaintPropertyTreeGraphBuilder builder; 531 blink::PaintPropertyTreeGraphBuilder builder;
478 StringBuilder stringBuilder; 532 StringBuilder stringBuilder;
479 builder.generateTreeGraph(frameView, stringBuilder); 533 builder.generateTreeGraph(frameView, stringBuilder);
480 return stringBuilder.toString(); 534 return stringBuilder.toString();
481 } 535 }
482 536
483 #endif 537 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698