Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 return; | 67 return; |
| 68 m_visualRect = LayoutRect(); | 68 m_visualRect = LayoutRect(); |
| 69 m_layoutBlock = nullptr; | 69 m_layoutBlock = nullptr; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Called when a FrameView finishes layout. Updates style and geometry of the | 72 // Called when a FrameView finishes layout. Updates style and geometry of the |
| 73 // caret for paint invalidation and painting. | 73 // caret for paint invalidation and painting. |
| 74 void updateStyleAndLayoutIfNeeded(const PositionWithAffinity& caretPosition); | 74 void updateStyleAndLayoutIfNeeded(const PositionWithAffinity& caretPosition); |
| 75 | 75 |
| 76 // Called during LayoutBlock paint invalidation. | 76 // Called during LayoutBlock paint invalidation. |
| 77 void invalidatePaintIfNeeded( | 77 void invalidatePaintIfNeeded(const LayoutBlock&, |
| 78 const LayoutBlock&, | 78 const PaintInvalidatorContext&); |
| 79 const PaintInvalidatorContext&, | |
| 80 PaintInvalidationReason layoutBlockPaintInvalidationReason); | |
|
Xianzhu
2017/03/08 19:38:22
This parameter is removed because it just indicate
| |
| 81 | 79 |
| 82 bool shouldPaintCaret(const LayoutBlock& block) const { | 80 bool shouldPaintCaret(const LayoutBlock& block) const { |
| 83 return &block == m_layoutBlock; | 81 return &block == m_layoutBlock; |
| 84 } | 82 } |
| 85 void paintCaret(GraphicsContext&, | 83 void paintCaret(GraphicsContext&, |
| 86 const LayoutPoint& paintOffset, | 84 const LayoutPoint& paintOffset, |
| 87 DisplayItem::Type) const; | 85 DisplayItem::Type) const; |
| 88 | 86 |
| 89 // DisplayItemClient methods. | 87 // DisplayItemClient methods. |
| 90 LayoutRect visualRect() const final; | 88 LayoutRect visualRect() const final; |
| 91 String debugName() const final; | 89 String debugName() const final; |
| 92 | 90 |
| 93 private: | 91 private: |
| 94 void invalidatePaintInCurrentLayoutBlock( | 92 void invalidatePaintInCurrentLayoutBlock(const PaintInvalidatorContext&); |
| 95 const PaintInvalidatorContext&, | |
| 96 PaintInvalidationReason layoutBlockPaintInvalidationReason); | |
| 97 | 93 |
| 98 void invalidatePaintInPreviousLayoutBlock( | 94 void invalidatePaintInPreviousLayoutBlock(const PaintInvalidatorContext&); |
| 99 const PaintInvalidatorContext&, | |
| 100 PaintInvalidationReason layoutBlockPaintInvalidationReason); | |
| 101 | 95 |
| 102 // These are updated by updateStyleAndLayoutIfNeeded(). | 96 // These are updated by updateStyleAndLayoutIfNeeded(). |
| 103 Color m_color; | 97 Color m_color; |
| 104 LayoutRect m_localRect; | 98 LayoutRect m_localRect; |
| 105 LayoutBlock* m_layoutBlock = nullptr; | 99 LayoutBlock* m_layoutBlock = nullptr; |
| 106 | 100 |
| 107 // This is set to the previous value of m_layoutBlock during | |
| 108 // updateStyleAndLayoutIfNeeded() and can be used in invalidatePaintIfNeeded() | |
| 109 // only. | |
| 110 const LayoutBlock* m_previousLayoutBlock = nullptr; | |
| 111 | |
| 112 // Visual rect of the caret in m_layoutBlock. This is updated by | 101 // Visual rect of the caret in m_layoutBlock. This is updated by |
| 113 // invalidatePaintIfNeeded(). | 102 // invalidatePaintIfNeeded(). |
| 114 LayoutRect m_visualRect; | 103 LayoutRect m_visualRect; |
| 115 | 104 |
| 116 // This is set to the previous value of m_visualRect during | 105 // These are set to the previous value of m_layoutBlock and m_visualRect |
| 117 // updateStyleAndLayoutIfNeeded() and can be used in invalidatePaintIfNeeded() | 106 // during updateStyleAndLayoutIfNeeded() if they haven't been set since the |
| 118 // only. | 107 // last paint invalidation. They can only be used in invalidatePaintIfNeeded() |
| 119 LayoutRect m_previousVisualRect; | 108 // to invalidate the caret in the previous layout block. |
| 109 const LayoutBlock* m_previousLayoutBlock = nullptr; | |
| 110 LayoutRect m_visualRectInPreviousLayoutBlock; | |
| 120 | 111 |
| 121 bool m_needsPaintInvalidation = false; | 112 bool m_needsPaintInvalidation = false; |
| 122 }; | 113 }; |
| 123 | 114 |
| 124 } // namespace blink | 115 } // namespace blink |
| 125 | 116 |
| 126 #endif // CaretDisplayItemClient_h | 117 #endif // CaretDisplayItemClient_h |
| OLD | NEW |