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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.h

Issue 2669003002: Optimize outline paint invalidation (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
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 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2009 Google Inc. All rights reserved. 8 * Copyright (C) 2009 Google Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 } 1742 }
1743 void setHasPreviousSelectionVisualRect(bool b) { 1743 void setHasPreviousSelectionVisualRect(bool b) {
1744 m_layoutObject.m_bitfields.setHasPreviousSelectionVisualRect(b); 1744 m_layoutObject.m_bitfields.setHasPreviousSelectionVisualRect(b);
1745 } 1745 }
1746 void setHasPreviousBoxGeometries(bool b) { 1746 void setHasPreviousBoxGeometries(bool b) {
1747 m_layoutObject.m_bitfields.setHasPreviousBoxGeometries(b); 1747 m_layoutObject.m_bitfields.setHasPreviousBoxGeometries(b);
1748 } 1748 }
1749 void setPreviousBackgroundObscured(bool b) { 1749 void setPreviousBackgroundObscured(bool b) {
1750 m_layoutObject.setPreviousBackgroundObscured(b); 1750 m_layoutObject.setPreviousBackgroundObscured(b);
1751 } 1751 }
1752 void updatePreviousOutlineMayBeAffectedByDescendants() {
1753 m_layoutObject.setPreviousOutlineMayBeAffectedByDescendants(
1754 m_layoutObject.outlineMayBeAffectedByDescendants());
1755 }
1752 1756
1753 void clearPreviousVisualRects() { 1757 void clearPreviousVisualRects() {
1754 m_layoutObject.clearPreviousVisualRects(); 1758 m_layoutObject.clearPreviousVisualRects();
1755 } 1759 }
1756 void setNeedsPaintPropertyUpdate() { 1760 void setNeedsPaintPropertyUpdate() {
1757 m_layoutObject.setNeedsPaintPropertyUpdate(); 1761 m_layoutObject.setNeedsPaintPropertyUpdate();
1758 } 1762 }
1763
1759 #if DCHECK_IS_ON() 1764 #if DCHECK_IS_ON()
1760 // Same as setNeedsPaintPropertyUpdate() but does not mark ancestors as 1765 // Same as setNeedsPaintPropertyUpdate() but does not mark ancestors as
1761 // having a descendant needing a paint property update. 1766 // having a descendant needing a paint property update.
1762 void setOnlyThisNeedsPaintPropertyUpdateForTesting() { 1767 void setOnlyThisNeedsPaintPropertyUpdateForTesting() {
1763 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(true); 1768 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(true);
1764 } 1769 }
1765 void clearNeedsPaintPropertyUpdateForTesting() { 1770 void clearNeedsPaintPropertyUpdateForTesting() {
1766 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(false); 1771 m_layoutObject.m_bitfields.setNeedsPaintPropertyUpdate(false);
1767 } 1772 }
1768 #endif 1773 #endif
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 return m_bitfields.hasPreviousBoxGeometries(); 1869 return m_bitfields.hasPreviousBoxGeometries();
1865 } 1870 }
1866 1871
1867 bool backgroundChangedSinceLastPaintInvalidation() const { 1872 bool backgroundChangedSinceLastPaintInvalidation() const {
1868 return m_bitfields.backgroundChangedSinceLastPaintInvalidation(); 1873 return m_bitfields.backgroundChangedSinceLastPaintInvalidation();
1869 } 1874 }
1870 void setBackgroundChangedSinceLastPaintInvalidation() { 1875 void setBackgroundChangedSinceLastPaintInvalidation() {
1871 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(true); 1876 m_bitfields.setBackgroundChangedSinceLastPaintInvalidation(true);
1872 } 1877 }
1873 1878
1879 bool outlineMayBeAffectedByDescendants() const {
1880 return m_bitfields.outlineMayBeAffectedByDescendants();
1881 }
1882 bool previousOutlineMayBeAffectedByDescendants() const {
1883 return m_bitfields.previousOutlineMayBeAffectedByDescendants();
1884 }
1885
1874 protected: 1886 protected:
1875 enum LayoutObjectType { 1887 enum LayoutObjectType {
1876 LayoutObjectBr, 1888 LayoutObjectBr,
1877 LayoutObjectCanvas, 1889 LayoutObjectCanvas,
1878 LayoutObjectFieldset, 1890 LayoutObjectFieldset,
1879 LayoutObjectCounter, 1891 LayoutObjectCounter,
1880 LayoutObjectDetailsMarker, 1892 LayoutObjectDetailsMarker,
1881 LayoutObjectEmbeddedObject, 1893 LayoutObjectEmbeddedObject,
1882 LayoutObjectFileUploadControl, 1894 LayoutObjectFileUploadControl,
1883 LayoutObjectFrame, 1895 LayoutObjectFrame,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 // LayoutFlowThread. 2054 // LayoutFlowThread.
2043 void removeFromLayoutFlowThread(); 2055 void removeFromLayoutFlowThread();
2044 2056
2045 bool containsInlineWithOutlineAndContinuation() const { 2057 bool containsInlineWithOutlineAndContinuation() const {
2046 return m_bitfields.containsInlineWithOutlineAndContinuation(); 2058 return m_bitfields.containsInlineWithOutlineAndContinuation();
2047 } 2059 }
2048 void setContainsInlineWithOutlineAndContinuation(bool b) { 2060 void setContainsInlineWithOutlineAndContinuation(bool b) {
2049 m_bitfields.setContainsInlineWithOutlineAndContinuation(b); 2061 m_bitfields.setContainsInlineWithOutlineAndContinuation(b);
2050 } 2062 }
2051 2063
2064 void setOutlineMayBeAffectedByDescendants(bool b) {
2065 m_bitfields.setOutlineMayBeAffectedByDescendants(b);
2066 }
2067 void setPreviousOutlineMayBeAffectedByDescendants(bool b) {
2068 m_bitfields.setPreviousOutlineMayBeAffectedByDescendants(b);
2069 }
2070
2052 private: 2071 private:
2053 // Adjusts a visual rect in the space of |m_previousVisualRect| to be in the 2072 // Adjusts a visual rect in the space of |m_previousVisualRect| to be in the
2054 // space of the |paintInvalidationContainer|, if needed. They can be different 2073 // space of the |paintInvalidationContainer|, if needed. They can be different
2055 // only if |paintInvalidationContainer| is a composited scroller. 2074 // only if |paintInvalidationContainer| is a composited scroller.
2056 void adjustVisualRectForCompositedScrolling( 2075 void adjustVisualRectForCompositedScrolling(
2057 LayoutRect&, 2076 LayoutRect&,
2058 const LayoutBoxModelObject& paintInvalidationContainer) const; 2077 const LayoutBoxModelObject& paintInvalidationContainer) const;
2059 2078
2060 FloatQuad localToAncestorQuadInternal(const FloatQuad&, 2079 FloatQuad localToAncestorQuadInternal(const FloatQuad&,
2061 const LayoutBoxModelObject* ancestor, 2080 const LayoutBoxModelObject* ancestor,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 m_isScrollAnchorObject(false), 2227 m_isScrollAnchorObject(false),
2209 m_scrollAnchorDisablingStyleChanged(false), 2228 m_scrollAnchorDisablingStyleChanged(false),
2210 m_hasBoxDecorationBackground(false), 2229 m_hasBoxDecorationBackground(false),
2211 m_hasPreviousLocationInBacking(false), 2230 m_hasPreviousLocationInBacking(false),
2212 m_hasPreviousSelectionVisualRect(false), 2231 m_hasPreviousSelectionVisualRect(false),
2213 m_hasPreviousBoxGeometries(false), 2232 m_hasPreviousBoxGeometries(false),
2214 m_needsPaintPropertyUpdate(true), 2233 m_needsPaintPropertyUpdate(true),
2215 m_subtreeNeedsPaintPropertyUpdate(true), 2234 m_subtreeNeedsPaintPropertyUpdate(true),
2216 m_descendantNeedsPaintPropertyUpdate(true), 2235 m_descendantNeedsPaintPropertyUpdate(true),
2217 m_backgroundChangedSinceLastPaintInvalidation(false), 2236 m_backgroundChangedSinceLastPaintInvalidation(false),
2237 m_outlineMayBeAffectedByDescendants(false),
2238 m_previousOutlineMayBeAffectedByDescendants(false),
2218 m_positionedState(IsStaticallyPositioned), 2239 m_positionedState(IsStaticallyPositioned),
2219 m_selectionState(SelectionNone), 2240 m_selectionState(SelectionNone),
2220 m_backgroundObscurationState(BackgroundObscurationStatusInvalid), 2241 m_backgroundObscurationState(BackgroundObscurationStatusInvalid),
2221 m_fullPaintInvalidationReason(PaintInvalidationNone) {} 2242 m_fullPaintInvalidationReason(PaintInvalidationNone) {}
2222 2243
2223 // Self needs layout means that this layout object is marked for a full 2244 // Self needs layout means that this layout object is marked for a full
2224 // layout. This is the default layout but it is expensive as it recomputes 2245 // layout. This is the default layout but it is expensive as it recomputes
2225 // everything. For CSS boxes, this includes the width (laying out the line 2246 // everything. For CSS boxes, this includes the width (laying out the line
2226 // boxes again), the margins (due to block collapsing margins), the 2247 // boxes again), the margins (due to block collapsing margins), the
2227 // positions, the height and the potential overflow. 2248 // positions, the height and the potential overflow.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 ADD_BOOLEAN_BITFIELD(subtreeNeedsPaintPropertyUpdate, 2411 ADD_BOOLEAN_BITFIELD(subtreeNeedsPaintPropertyUpdate,
2391 SubtreeNeedsPaintPropertyUpdate) 2412 SubtreeNeedsPaintPropertyUpdate)
2392 // Whether the paint properties of a descendant need to be updated. For more 2413 // Whether the paint properties of a descendant need to be updated. For more
2393 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate(). 2414 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate().
2394 ADD_BOOLEAN_BITFIELD(descendantNeedsPaintPropertyUpdate, 2415 ADD_BOOLEAN_BITFIELD(descendantNeedsPaintPropertyUpdate,
2395 DescendantNeedsPaintPropertyUpdate); 2416 DescendantNeedsPaintPropertyUpdate);
2396 2417
2397 ADD_BOOLEAN_BITFIELD(backgroundChangedSinceLastPaintInvalidation, 2418 ADD_BOOLEAN_BITFIELD(backgroundChangedSinceLastPaintInvalidation,
2398 BackgroundChangedSinceLastPaintInvalidation); 2419 BackgroundChangedSinceLastPaintInvalidation);
2399 2420
2421 // Whether shape of outline may be affected by any descendants. This is
2422 // updated before paint invalidation, checked during paint invalidation.
2423 ADD_BOOLEAN_BITFIELD(outlineMayBeAffectedByDescendants,
2424 OutlineMayBeAffectedByDescendants);
2425 // The outlineMayBeAffectedByDescendants status of the last paint
2426 // invalidation.
2427 ADD_BOOLEAN_BITFIELD(previousOutlineMayBeAffectedByDescendants,
2428 PreviousOutlineMayBeAffectedByDescendants);
2429
2400 protected: 2430 protected:
2401 // Use protected to avoid warning about unused variable. 2431 // Use protected to avoid warning about unused variable.
2402 unsigned m_unusedBits : 6; 2432 unsigned m_unusedBits : 4;
2403 2433
2404 private: 2434 private:
2405 // This is the cached 'position' value of this object 2435 // This is the cached 'position' value of this object
2406 // (see ComputedStyle::position). 2436 // (see ComputedStyle::position).
2407 unsigned m_positionedState : 2; // PositionedState 2437 unsigned m_positionedState : 2; // PositionedState
2408 unsigned m_selectionState : 3; // SelectionState 2438 unsigned m_selectionState : 3; // SelectionState
2409 // Mutable for getter which lazily update this field. 2439 // Mutable for getter which lazily update this field.
2410 mutable unsigned 2440 mutable unsigned
2411 m_backgroundObscurationState : 2; // BackgroundObscurationState 2441 m_backgroundObscurationState : 2; // BackgroundObscurationState
2412 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason 2442 unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 CORE_EXPORT void showLineTree(const blink::LayoutObject*); 2770 CORE_EXPORT void showLineTree(const blink::LayoutObject*);
2741 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); 2771 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1);
2742 // We don't make object2 an optional parameter so that showLayoutTree 2772 // We don't make object2 an optional parameter so that showLayoutTree
2743 // can be called from gdb easily. 2773 // can be called from gdb easily.
2744 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, 2774 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1,
2745 const blink::LayoutObject* object2); 2775 const blink::LayoutObject* object2);
2746 2776
2747 #endif 2777 #endif
2748 2778
2749 #endif // LayoutObject_h 2779 #endif // LayoutObject_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698