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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.cpp

Issue 2657253003: Make ScrollPaintPropertyNode::toString() 26% more concise (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/graphics/paint/ScrollPaintPropertyNode.h" 5 #include "platform/graphics/paint/ScrollPaintPropertyNode.h"
6 6
7 #include "platform/graphics/paint/PropertyTreeState.h" 7 #include "platform/graphics/paint/PropertyTreeState.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 ScrollPaintPropertyNode* ScrollPaintPropertyNode::root() { 11 ScrollPaintPropertyNode* ScrollPaintPropertyNode::root() {
12 DEFINE_STATIC_REF(ScrollPaintPropertyNode, root, 12 DEFINE_STATIC_REF(ScrollPaintPropertyNode, root,
13 (ScrollPaintPropertyNode::create( 13 (ScrollPaintPropertyNode::create(
14 nullptr, IntSize(), IntSize(), false, false, 0))); 14 nullptr, IntSize(), IntSize(), false, false, 0)));
15 return root; 15 return root;
16 } 16 }
17 17
18 String ScrollPaintPropertyNode::toString() const { 18 String ScrollPaintPropertyNode::toString() const {
19 std::string mainThreadScrollingReasonsAsText = 19 StringBuilder text;
20 MainThreadScrollingReason::mainThreadScrollingReasonsAsText( 20 text.append("parent=");
21 m_mainThreadScrollingReasons); 21 text.append(String::format("%p", m_parent.get()));
22 return String::format( 22 text.append(" clip=");
23 "parent=%p clip=%s bounds=%s " 23 text.append(m_clip.toString());
24 "userScrollableHorizontal=%s" 24 text.append(" bounds=");
25 " userScrollableVertical=%s mainThreadScrollingReasons=%s", 25 text.append(m_bounds.toString());
26 m_parent.get(), m_clip.toString().ascii().data(), 26
27 m_bounds.toString().ascii().data(), 27 text.append(" userScrollable=");
28 m_userScrollableHorizontal ? "yes" : "no", 28 if (m_userScrollableHorizontal && m_userScrollableVertical)
29 m_userScrollableVertical ? "yes" : "no", 29 text.append("both");
30 mainThreadScrollingReasonsAsText.c_str()); 30 else if (!m_userScrollableHorizontal && !m_userScrollableHorizontal)
brucedawson 2017/01/31 20:21:28 The experimental /analyze builder pointed out that
31 text.append("none");
32 else
33 text.append(m_userScrollableHorizontal ? "horizontal" : "vertical");
34
35 text.append(" mainThreadReasons=");
36 if (m_mainThreadScrollingReasons) {
37 text.append(MainThreadScrollingReason::mainThreadScrollingReasonsAsText(
38 m_mainThreadScrollingReasons)
39 .c_str());
40 } else {
41 text.append("none");
42 }
43 return text.toString();
31 } 44 }
32 45
33 #if DCHECK_IS_ON() 46 #if DCHECK_IS_ON()
34 47
35 String ScrollPaintPropertyNode::toTreeString() const { 48 String ScrollPaintPropertyNode::toTreeString() const {
36 return blink::PropertyTreeStatePrinter<blink::ScrollPaintPropertyNode>() 49 return blink::PropertyTreeStatePrinter<blink::ScrollPaintPropertyNode>()
37 .pathAsString(this); 50 .pathAsString(this);
38 } 51 }
39 52
40 #endif 53 #endif
41 54
42 } // namespace blink 55 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698