Chromium Code Reviews| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 return; | 197 return; |
| 198 | 198 |
| 199 if (DrawingRecorder::useCachedDrawingIfPossible(context, *this, displayItemT ype)) | 199 if (DrawingRecorder::useCachedDrawingIfPossible(context, *this, displayItemT ype)) |
| 200 return; | 200 return; |
| 201 | 201 |
| 202 LayoutRect drawingRect = localCaretRectWithoutUpdate(); | 202 LayoutRect drawingRect = localCaretRectWithoutUpdate(); |
| 203 if (LayoutBlock* layoutObject = caretLayoutObject(node)) | 203 if (LayoutBlock* layoutObject = caretLayoutObject(node)) |
| 204 layoutObject->flipForWritingMode(drawingRect); | 204 layoutObject->flipForWritingMode(drawingRect); |
| 205 drawingRect.moveBy(roundedIntPoint(paintOffset)); | 205 drawingRect.moveBy(roundedIntPoint(paintOffset)); |
| 206 | 206 |
| 207 Color caretColor = Color::black; | 207 const Color caretColor = node->layoutObject()->resolveColor(CSSPropertyColor ); |
|
Xiaocheng
2016/09/09 07:40:43
Do you mean |node| is always a |Text|? If so, coul
yoichio
2016/09/09 07:53:54
node->layoutObject() exists always?
yosin_UTC9
2016/09/09 08:27:21
|node| comes from anchor node of VisiblePosition.
| |
| 208 | |
| 209 Element* element; | |
| 210 if (node->isElementNode()) | |
| 211 element = toElement(node); | |
| 212 else | |
| 213 element = node->parentElement(); | |
| 214 | |
| 215 if (element && element->layoutObject()) | |
| 216 caretColor = element->layoutObject()->resolveColor(CSSPropertyColor); | |
| 217 | |
| 218 IntRect paintRect = pixelSnappedIntRect(drawingRect); | 208 IntRect paintRect = pixelSnappedIntRect(drawingRect); |
| 219 DrawingRecorder drawingRecorder(context, *this, DisplayItem::kCaret, paintRe ct); | 209 DrawingRecorder drawingRecorder(context, *this, DisplayItem::kCaret, paintRe ct); |
| 220 context.fillRect(paintRect, caretColor); | 210 context.fillRect(paintRect, caretColor); |
| 221 } | 211 } |
| 222 | 212 |
| 223 void CaretBase::setCaretVisibility(CaretVisibility visibility) | 213 void CaretBase::setCaretVisibility(CaretVisibility visibility) |
| 224 { | 214 { |
| 225 m_caretVisibility = visibility; | 215 m_caretVisibility = visibility; |
| 226 } | 216 } |
| 227 | 217 |
| 228 String CaretBase::debugName() const | 218 String CaretBase::debugName() const |
| 229 { | 219 { |
| 230 return "Caret"; | 220 return "Caret"; |
| 231 } | 221 } |
| 232 | 222 |
| 233 LayoutRect CaretBase::visualRect() const | 223 LayoutRect CaretBase::visualRect() const |
| 234 { | 224 { |
| 235 return m_visualRect; | 225 return m_visualRect; |
| 236 } | 226 } |
| 237 | 227 |
| 238 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |