Blocked painting of selection for inline inputbox
authorprathmesh.m <prathmesh.m@samsung.com>
Wed, 19 Jun 2013 10:39:09 +0000 (16:09 +0530)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 25 Jul 2013 06:22:04 +0000 (06:22 +0000)
[Title] Blocked painting of selection for inline inputbox
[Issue#] N/A
[Problem] Select content and extend it to input box when
     the IME is not up (input node not focused) and the
     copy the text. Text inside the input box is not copied
     but painted for selection
[Cause] The input box content is in shadow root. So this
     content is not selected. But while painting there is
     such condition. All the contents are getting painted
[Solution] Checking if the content is in shadow root then
     do not paint the selection as it is not selected in the
     dom selection

Change-Id: Ieaf87576d9ec961016982a7c0a1dd1c003315bb3

Source/WTF/wtf/Platform.h
Source/WebCore/rendering/InlineTextBox.cpp

index 0621ea4..ec13002 100755 (executable)
@@ -681,6 +681,7 @@ com) : Patch to do not adjust cover rect as fixed pixel size*/
 #define ENABLE_TIZEN_WEBKIT2_CONTEXT_X_WINDOW 1 /* Changhyup Jwa(ch.jwa@samsung.com) : WebProcess cannot access to evas, so it needs to obtain window id to get window's orientation. Default root window has sync issue. */
 #define ENABLE_TIZEN_WEBKIT2_FOR_MOVING_TEXT_SELECTION_HANDLE_FROM_OSP 1 /* Yuni Jeong(yhnet.jung@samsung.com) : Patchs for moving text selection handle from OSP */
 #define ENABLE_TIZEN_WEBKIT2_FIX_INVAlID_SCROLL_FOR_NEW_PAGE 1 /* Jongseok Yang (js45.yang@samsung.com) : Patch to fix the invalid scroll position by open source patch */
+#define ENABLE_TIZEN_WEBKIT2_TEXT_SELECTION_NOT_PAINT_SELECTION_FOR_INPUTBOX 1 /* Prathmesh Manurkar(prathmesh.m@samsung.com) : Patch for not painting the selection for Contents Inside the input.Selection is not painted when the focus in outside the input box */
 #endif /* ENABLE(TIZEN_WEBKIT2) */
 
 /* When displaying menu list using menu icon, a additional scrollbar is displayed in the screen center
index 19a3b1b..f5f821b 100644 (file)
@@ -852,6 +852,21 @@ void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& b
     // See if we have a selection to paint at all.
     int sPos, ePos;
     selectionStartEnd(sPos, ePos);
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION_NOT_PAINT_SELECTION_FOR_INPUTBOX)
+    Node* shadowAncestor = 0;
+    if (renderer() && renderer()->node())
+        shadowAncestor = renderer()->node()->shadowAncestorNode();
+
+    if (shadowAncestor && (shadowAncestor->renderer()->isTextField() || shadowAncestor->renderer()->isTextArea())) {
+        if (selectionState() != RenderObject::SelectionBoth) {
+            RenderObject* startObj = textRenderer()->view()->selectionStart();
+            RenderObject* endObj = textRenderer()->view()->selectionEnd();
+            if (!(startObj->node()->isInShadowTree() && endObj->node()->isInShadowTree()))
+                return;
+        }
+    }
+#endif
+
     if (sPos >= ePos)
         return;