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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.h

Issue 2551963003: Reland of Paint collapsed borders of a table as one display item (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTableCell.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
index 12f5210b8c87e472bff5a1a03769562b718dde65..e9a9716262deff97d260a79156ee439b17f7afd4 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -185,8 +185,9 @@
int borderBefore() const override;
int borderAfter() const override;
- void collectBorderValues(LayoutTable::CollapsedBorderValues&);
- static void sortBorderValues(LayoutTable::CollapsedBorderValues&);
+ // Returns true if any collapsed borders related to this cell changed.
+ bool collectBorderValues(Vector<CollapsedBorderValue>&);
+ static void sortBorderValues(Vector<CollapsedBorderValue>&);
void layout() override;
@@ -289,48 +290,38 @@
bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override;
void invalidateDisplayItemClients(PaintInvalidationReason) const override;
- // TODO(wkorman): Consider renaming to more clearly differentiate from
- // CollapsedBorderValue.
- class CollapsedBorderValues : public DisplayItemClient {
+ struct CollapsedBorderValues {
+ CollapsedBorderValue startBorder;
+ CollapsedBorderValue endBorder;
+ CollapsedBorderValue beforeBorder;
+ CollapsedBorderValue afterBorder;
+
+ bool allBordersAreInvisible() const {
+ return !startBorder.isVisible() && !endBorder.isVisible() &&
+ !beforeBorder.isVisible() && !afterBorder.isVisible();
+ }
+ bool bordersVisuallyEqual(const CollapsedBorderValues& other) const {
+ return startBorder.visuallyEquals(other.startBorder) &&
+ endBorder.visuallyEquals(other.endBorder) &&
+ beforeBorder.visuallyEquals(other.beforeBorder) &&
+ afterBorder.visuallyEquals(other.afterBorder);
+ }
+ };
+
+ class RowBackgroundDisplayItemClient : public DisplayItemClient {
public:
- CollapsedBorderValues(const LayoutTable&,
- const CollapsedBorderValue& startBorder,
- const CollapsedBorderValue& endBorder,
- const CollapsedBorderValue& beforeBorder,
- const CollapsedBorderValue& afterBorder);
-
- const CollapsedBorderValue& startBorder() const { return m_startBorder; }
- const CollapsedBorderValue& endBorder() const { return m_endBorder; }
- const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; }
- const CollapsedBorderValue& afterBorder() const { return m_afterBorder; }
-
- void setCollapsedBorderValues(const CollapsedBorderValues& other);
+ RowBackgroundDisplayItemClient(const LayoutTableCell&);
// DisplayItemClient methods.
String debugName() const;
LayoutRect visualRect() const;
private:
- const LayoutTable& m_layoutTable;
- CollapsedBorderValue m_startBorder;
- CollapsedBorderValue m_endBorder;
- CollapsedBorderValue m_beforeBorder;
- CollapsedBorderValue m_afterBorder;
- };
-
- class RowBackgroundDisplayItemClient : public DisplayItemClient {
- public:
- RowBackgroundDisplayItemClient(const LayoutTableCell&);
-
- // DisplayItemClient methods.
- String debugName() const;
- LayoutRect visualRect() const;
-
- private:
const LayoutTableCell& m_layoutTableCell;
};
bool usesCompositedCellDisplayItemClients() const;
+
const CollapsedBorderValues* collapsedBorderValues() const {
return m_collapsedBorderValues.get();
}
@@ -350,6 +341,8 @@
void ensureIsReadyForPaintInvalidation() override;
+ LayoutRect localVisualRect() const override;
+
protected:
void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
void computePreferredLogicalWidths() override;
@@ -373,7 +366,6 @@
void paintMask(const PaintInfo&, const LayoutPoint&) const override;
LayoutSize offsetFromContainer(const LayoutObject*) const override;
- LayoutRect localVisualRect() const override;
int borderHalfLeft(bool outer) const;
int borderHalfRight(bool outer) const;
@@ -411,8 +403,8 @@
// See also https://code.google.com/p/chromium/issues/detail?id=128227 for
// some history.
//
- // Those functions are called when the cache (m_collapsedBorders) is
- // invalidated on LayoutTable.
+ // Those functions are called before paint invalidation if the collapsed
+ // borders cache is invalidated on LayoutTable.
CollapsedBorderValue computeCollapsedStartBorder(
IncludeBorderColorOrNot = IncludeBorderColor) const;
CollapsedBorderValue computeCollapsedEndBorder(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698