| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 inflatedRect.inflate(LayoutUnit(1)); | 139 inflatedRect.inflate(LayoutUnit(1)); |
| 140 | 140 |
| 141 // FIXME: We should not allow paint invalidation out of paint invalidation | 141 // FIXME: We should not allow paint invalidation out of paint invalidation |
| 142 // state. crbug.com/457415 | 142 // state. crbug.com/457415 |
| 143 DisablePaintInvalidationStateAsserts disabler; | 143 DisablePaintInvalidationStateAsserts disabler; |
| 144 | 144 |
| 145 m_visualRect = | 145 m_visualRect = |
| 146 node->layoutObject()->invalidatePaintRectangle(inflatedRect, this); | 146 node->layoutObject()->invalidatePaintRectangle(inflatedRect, this); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool CaretBase::shouldRepaintCaret(Node& node) { | |
| 150 // If PositionAnchorType::BeforeAnchor or PositionAnchorType::AfterAnchor, | |
| 151 // carets need to be repainted not only when the node is contentEditable but | |
| 152 // also when its parentNode() is contentEditable. | |
| 153 node.document().updateStyleAndLayoutTree(); | |
| 154 return hasEditableStyle(node) || | |
| 155 (node.parentNode() && hasEditableStyle(*node.parentNode())); | |
| 156 } | |
| 157 | |
| 158 void CaretBase::invalidateCaretRect(Node* node, | 149 void CaretBase::invalidateCaretRect(Node* node, |
| 159 const LayoutRect& caretLocalRect) { | 150 const LayoutRect& caretLocalRect) { |
| 160 node->document().updateStyleAndLayoutTree(); | 151 node->document().updateStyleAndLayoutTree(); |
| 161 if (hasEditableStyle(*node)) | 152 if (hasEditableStyle(*node)) |
| 162 invalidateLocalCaretRect(node, caretLocalRect); | 153 invalidateLocalCaretRect(node, caretLocalRect); |
| 163 } | 154 } |
| 164 | 155 |
| 165 void CaretBase::paintCaret(Node* node, | 156 void CaretBase::paintCaret(Node* node, |
| 166 GraphicsContext& context, | 157 GraphicsContext& context, |
| 167 const LayoutRect& caretLocalRect, | 158 const LayoutRect& caretLocalRect, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 186 | 177 |
| 187 String CaretBase::debugName() const { | 178 String CaretBase::debugName() const { |
| 188 return "Caret"; | 179 return "Caret"; |
| 189 } | 180 } |
| 190 | 181 |
| 191 LayoutRect CaretBase::visualRect() const { | 182 LayoutRect CaretBase::visualRect() const { |
| 192 return m_visualRect; | 183 return m_visualRect; |
| 193 } | 184 } |
| 194 | 185 |
| 195 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |