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

Side by Side Diff: third_party/WebKit/Source/core/style/CollapsedBorderValue.h

Issue 1549693002: Optimize collapsed border painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Field instead of global HashMap Created 4 years, 12 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 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool isSameIgnoringColor(const CollapsedBorderValue& o) const 63 bool isSameIgnoringColor(const CollapsedBorderValue& o) const
64 { 64 {
65 return width() == o.width() && style() == o.style() && precedence() == o .precedence(); 65 return width() == o.width() && style() == o.style() && precedence() == o .precedence();
66 } 66 }
67 67
68 bool equals(const CollapsedBorderValue& o) const 68 bool equals(const CollapsedBorderValue& o) const
69 { 69 {
70 return color() == o.color() && isTransparent() == o.isTransparent() && i sSameIgnoringColor(o); 70 return color() == o.color() && isTransparent() == o.isTransparent() && i sSameIgnoringColor(o);
71 } 71 }
72 72
73 bool isVisible() const
74 {
75 return style() > BHIDDEN && !isTransparent() && exists();
76 }
77
73 bool shouldPaint(const CollapsedBorderValue& tableCurrentBorderValue) const 78 bool shouldPaint(const CollapsedBorderValue& tableCurrentBorderValue) const
74 { 79 {
75 return style() > BHIDDEN && !isTransparent() && exists() && isSameIgnori ngColor(tableCurrentBorderValue); 80 return isVisible() && isSameIgnoringColor(tableCurrentBorderValue);
Julien - ping for review 2016/01/08 14:18:15 Shouldn't this be ASSERT(isVisible()) as we don't
Xianzhu 2016/01/08 17:50:45 A cell may have e.g. 2 visible borders and 2 invis
Julien - ping for review 2016/01/11 18:11:36 OK!
81 }
82
83 bool isEquivalentForPainting(const CollapsedBorderValue& o) const
84 {
85 if (!isVisible() && !o.isVisible())
86 return true;
87 return equals(o);
76 } 88 }
77 89
78 private: 90 private:
79 Color m_color; 91 Color m_color;
80 unsigned m_colorIsCurrentColor : 1; 92 unsigned m_colorIsCurrentColor : 1;
81 unsigned m_width : 23; 93 unsigned m_width : 23;
82 unsigned m_style : 4; // EBorderStyle 94 unsigned m_style : 4; // EBorderStyle
83 unsigned m_precedence : 3; // EBorderPrecedence 95 unsigned m_precedence : 3; // EBorderPrecedence
84 unsigned m_transparent : 1; 96 unsigned m_transparent : 1;
85 }; 97 };
86 98
87 } // namespace blink 99 } // namespace blink
88 100
89 #endif // CollapsedBorderValue_h 101 #endif // CollapsedBorderValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698