Index: Source/core/editing/Caret.cpp |
diff --git a/Source/core/editing/Caret.cpp b/Source/core/editing/Caret.cpp |
index 2b3c1d6ccf2ebb25d5d785e3293dcadc09b02066..c320c0a35d887be68467ca0395c525d5f4268cb2 100644 |
--- a/Source/core/editing/Caret.cpp |
+++ b/Source/core/editing/Caret.cpp |
@@ -190,6 +190,12 @@ void CaretBase::repaintCaretForLocalRect(Node* node, const LayoutRect& rect) |
LayoutRect inflatedRect = rect; |
inflatedRect.inflate(1); |
+ // as extra rect are draw so need to refresh more area |
Inactive
2014/05/22 14:15:05
Comments should start with a capital letter and en
h.joshi
2014/05/23 13:26:31
Okey, will fix this
|
+ TextDirection containerDirection = toRenderBoxModelObject(caretRenderer(node))->style()->direction(); |
Inactive
2014/05/22 14:15:05
You likely want to use caretPainter variable here.
h.joshi
2014/05/23 13:26:31
Okey, will fix this
|
+ inflatedRect.setWidth(inflatedRect.width() + LayoutUnit(2)); |
+ if (containerDirection == RTL) |
+ inflatedRect.setX(inflatedRect.x() - LayoutUnit(2)); |
+ |
caretPainter->repaintRectangle(inflatedRect); |
} |
@@ -223,8 +229,16 @@ void CaretBase::invalidateCaretRect(Node* node, bool caretRectChanged) |
return; |
if (RenderView* view = node->document().renderView()) { |
- if (shouldRepaintCaret(view, node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable))) |
- repaintCaretForLocalRect(node, localCaretRectWithoutUpdate()); |
+ if (shouldRepaintCaret(view, node->isContentEditable(Node::UserSelectAllIsAlwaysNonEditable))) { |
+ // as extra rect are draw so need to refresh more area |
Inactive
2014/05/22 14:15:05
Ditto.
|
+ LayoutRect drawingRect = localCaretRectWithoutUpdate(); |
+ TextDirection containerDirection = toRenderBoxModelObject(caretRenderer(node))->style()->direction(); |
Inactive
2014/05/22 14:15:05
Code duplication, you should probably move the cod
h.joshi
2014/05/23 13:26:31
Okey, will make new utility method
|
+ drawingRect.setWidth(drawingRect.width() + LayoutUnit(2)); |
+ |
+ if (containerDirection == RTL) |
+ drawingRect.setX(drawingRect.x() - LayoutUnit(2)); |
+ repaintCaretForLocalRect(node, drawingRect); |
+ } |
} |
} |
@@ -242,6 +256,18 @@ void CaretBase::paintCaret(Node* node, GraphicsContext* context, const LayoutPoi |
if (caret.isEmpty()) |
return; |
+ TextDirection containerDirection = toRenderBoxModelObject(renderer)->style()->direction(); |
+ LayoutRect ptrCaret = caret; |
Inactive
2014/05/22 14:15:05
please no not use abbreviations in variable names.
|
+ |
+ // drawing different Caret which shows editing style similar to IE |
+ if (containerDirection == LTR) { |
Inactive
2014/05/22 14:15:05
No {} for one-liners.
h.joshi
2014/05/23 13:26:31
Okey, will update condition
|
+ ptrCaret.setX(ptrCaret.x() + 1); |
Inactive
2014/05/22 14:15:05
identation problem
|
+ } else { |
Inactive
2014/05/22 14:15:05
ditto
|
+ ptrCaret.setX(ptrCaret.x() - 2); |
Inactive
2014/05/22 14:15:05
ditto.
|
+ } |
+ ptrCaret.setWidth(LayoutUnit(2)); |
+ ptrCaret.setHeight(LayoutUnit(1)); |
+ |
Color caretColor = Color::black; |
Element* element; |
@@ -254,6 +280,14 @@ void CaretBase::paintCaret(Node* node, GraphicsContext* context, const LayoutPoi |
caretColor = element->renderer()->resolveColor(CSSPropertyColor); |
context->fillRect(caret, caretColor); |
+ context->fillRect(ptrCaret, caretColor); |
+ |
+ // Update ptrCaret points and lets draw one more small rect to match IE |
Inactive
2014/05/22 14:15:05
end with a '.'
h.joshi
2014/05/23 13:26:31
Okey, will update comment
|
+ ptrCaret.setY(caret.y() + LayoutUnit(1)); |
+ ptrCaret.setWidth(LayoutUnit(1)); |
+ if (containerDirection == RTL) |
+ ptrCaret.setX(ptrCaret.x() + 1); |
+ context->fillRect(ptrCaret, caretColor); |
} |
void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const |