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

Side by Side Diff: third_party/WebKit/Source/core/editing/CaretBase.cpp

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 { 168 {
169 if (caretRectChanged) 169 if (caretRectChanged)
170 return; 170 return;
171 171
172 if (LayoutView* view = node->document().layoutView()) { 172 if (LayoutView* view = node->document().layoutView()) {
173 if (node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) || s houldRepaintCaret(view)) 173 if (node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable) || s houldRepaintCaret(view))
174 invalidateLocalCaretRect(node, localCaretRectWithoutUpdate()); 174 invalidateLocalCaretRect(node, localCaretRectWithoutUpdate());
175 } 175 }
176 } 176 }
177 177
178 void CaretBase::paintCaret(Node* node, GraphicsContext* context, const LayoutPoi nt& paintOffset) const 178 void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoi nt& paintOffset) const
179 { 179 {
180 if (m_caretVisibility == Hidden) 180 if (m_caretVisibility == Hidden)
181 return; 181 return;
182 182
183 LayoutRect drawingRect = localCaretRectWithoutUpdate(); 183 LayoutRect drawingRect = localCaretRectWithoutUpdate();
184 if (LayoutBlock* layoutObject = caretLayoutObject(node)) 184 if (LayoutBlock* layoutObject = caretLayoutObject(node))
185 layoutObject->flipForWritingMode(drawingRect); 185 layoutObject->flipForWritingMode(drawingRect);
186 drawingRect.moveBy(roundedIntPoint(paintOffset)); 186 drawingRect.moveBy(roundedIntPoint(paintOffset));
187 187
188 Color caretColor = Color::black; 188 Color caretColor = Color::black;
189 189
190 Element* element; 190 Element* element;
191 if (node->isElementNode()) 191 if (node->isElementNode())
192 element = toElement(node); 192 element = toElement(node);
193 else 193 else
194 element = node->parentElement(); 194 element = node->parentElement();
195 195
196 if (element && element->layoutObject()) 196 if (element && element->layoutObject())
197 caretColor = element->layoutObject()->resolveColor(CSSPropertyColor); 197 caretColor = element->layoutObject()->resolveColor(CSSPropertyColor);
198 198
199 context->fillRect(FloatRect(drawingRect), caretColor); 199 context.fillRect(FloatRect(drawingRect), caretColor);
200 } 200 }
201 201
202 } // namespace blink 202 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/CaretBase.h ('k') | third_party/WebKit/Source/core/editing/DragCaretController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698