Title: [123797] trunk/Source/WebKit/blackberry
Revision
123797
Author
mifen...@rim.com
Date
2012-07-26 15:03:48 -0700 (Thu, 26 Jul 2012)

Log Message

[BlackBerry] Improve the logs in Selection Handler.
https://bugs.webkit.org/show_bug.cgi?id=92405

Reviewed by Rob Buis.

Clean up selection logging, fix priority and style
of helper function.

Reviewed Internally by Nima Ghanavatian.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::cancelSelection):
(BlackBerry::WebKit::SelectionHandler::shouldUpdateSelectionOrCaretForPoint):
(BlackBerry::WebKit::SelectionHandler::setCaretPosition):
(BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
(BlackBerry::WebKit::SelectionHandler::setSelection):
(BlackBerry::WebKit::SelectionHandler::selectObject):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
(BlackBerry::WebKit::SelectionHandler::caretPositionChanged):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (123796 => 123797)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-07-26 21:46:16 UTC (rev 123796)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-07-26 22:03:48 UTC (rev 123797)
@@ -1,5 +1,27 @@
 2012-07-26  Mike Fenton  <mifen...@rim.com>
 
+        [BlackBerry] Improve the logs in Selection Handler.
+        https://bugs.webkit.org/show_bug.cgi?id=92405
+
+        Reviewed by Rob Buis.
+
+        Clean up selection logging, fix priority and style
+        of helper function.
+
+        Reviewed Internally by Nima Ghanavatian.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::cancelSelection):
+        (BlackBerry::WebKit::SelectionHandler::shouldUpdateSelectionOrCaretForPoint):
+        (BlackBerry::WebKit::SelectionHandler::setCaretPosition):
+        (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
+        (BlackBerry::WebKit::SelectionHandler::setSelection):
+        (BlackBerry::WebKit::SelectionHandler::selectObject):
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+        (BlackBerry::WebKit::SelectionHandler::caretPositionChanged):
+
+2012-07-26  Mike Fenton  <mifen...@rim.com>
+
         [BlackBerry] Add timing logs to SelectionHandler.
         https://bugs.webkit.org/show_bug.cgi?id=92404
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (123796 => 123797)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-07-26 21:46:16 UTC (rev 123796)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-07-26 22:03:48 UTC (rev 123797)
@@ -51,15 +51,15 @@
 using namespace WebCore;
 
 #if SHOWDEBUG_SELECTIONHANDLER
-#define DEBUG_SELECTION(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
+#define SelectionLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
 #else
-#define DEBUG_SELECTION(severity, format, ...)
+#define SelectionLog(severity, format, ...)
 #endif // SHOWDEBUG_SELECTIONHANDLER
 
 #if SHOWDEBUG_SELECTIONHANDLER_TIMING
-#define DEBUG_SELECTION_TIMING(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
+#define SelectionTimingLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
 #else
-#define DEBUG_SELECTION_TIMING(severity, format, ...)
+#define SelectionTimingLog(severity, format, ...)
 #endif // SHOWDEBUG_SELECTIONHANDLER_TIMING
 
 namespace BlackBerry {
@@ -82,7 +82,7 @@
     m_selectionActive = false;
     m_lastSelectionRegion = IntRectRegion();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::cancelSelection");
+    SelectionLog(LogLevelInfo, "SelectionHandler::cancelSelection");
 
     if (m_webPage->m_inputHandler->isInputMode())
         m_webPage->m_inputHandler->cancelSelection();
@@ -212,7 +212,7 @@
     bool aboveCaret = point.y() < caretRect.y();
     bool belowCaret = point.y() >= caretRect.maxY();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s \n"
+    SelectionLog(LogLevelInfo, "SelectionHandler::shouldUpdateSelectionOrCaretForPoint multiline = %s above = %s below = %s first line = %s last line = %s start = %s"
             , m_webPage->m_inputHandler->isMultilineInputMode() ? "true" : "false", aboveCaret ? "true" : "false", belowCaret ? "true" : "false"
             , inSameLine(currentSelection.visibleStart(), startOfEditableContent(currentSelection.visibleStart())) ? "true" : "false"
             , inSameLine(currentSelection.visibleEnd(), endOfEditableContent(currentSelection.visibleEnd())) ? "true" : "false"
@@ -235,7 +235,7 @@
 
     m_caretActive = true;
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y());
+    SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition requested point %d, %d", position.x(), position.y());
 
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
     FrameSelection* controller = focusedFrame->selection();
@@ -265,7 +265,7 @@
 
     controller->setSelection(newSelection);
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated");
+    SelectionLog(LogLevelInfo, "SelectionHandler::setCaretPosition point valid, cursor updated");
 }
 
 // This function makes sure we are not reducing the selection to a caret selection.
@@ -433,7 +433,7 @@
     if (!character)
         return false;
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection making selection change attempt using key event %d", character);
+    SelectionLog(LogLevelInfo, "SelectionHandler::updateOrHandleInputSelection making selection change attempt using key event %d", character);
 
     if (shouldExtendSelectionInDirection(controller->selection(), character))
         m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character, Platform::KeyboardEvent::KeyDown, KEYMOD_SHIFT));
@@ -459,7 +459,7 @@
     m_timer.start();
 #endif
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y());
+    SelectionLog(LogLevelInfo, "SelectionHandler::setSelection adjusted points %d, %d, %d, %d", start.x(), start.y(), end.x(), end.y());
 
     // Note that IntPoint(-1, -1) is being our sentinel so far for
     // clipped out selection starting or ending location.
@@ -532,12 +532,12 @@
 
         controller->setSelection(newSelection);
 
-        DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated\n");
+        SelectionLog(LogLevelInfo, "SelectionHandler::setSelection selection points valid, selection updated.");
     } else {
         // Requested selection results in an empty selection, skip this change.
         selectionPositionChanged();
 
-        DEBUG_SELECTION(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated\n");
+        SelectionLog(LogLevelWarn, "SelectionHandler::setSelection selection points invalid, selection not updated.");
     }
 }
 
@@ -617,7 +617,7 @@
     ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y());
+    SelectionLog(LogLevelInfo, "SelectionHandler::selectObject adjusted points %d, %d", location.x(), location.y());
 
     WebCore::IntPoint relativePoint = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, location);
     VisiblePosition pointLocation(focusedFrame->visiblePositionForPoint(relativePoint));
@@ -636,7 +636,7 @@
     ASSERT(m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectObject using current selection");
+    SelectionLog(LogLevelInfo, "SelectionHandler::selectObject using current selection");
 
     // Use the current selection as the selection point.
     ASSERT(focusedFrame->selection()->selectionType() != VisibleSelection::NoSelection);
@@ -653,7 +653,7 @@
     ASSERT(m_webPage && m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->selection());
     Frame* focusedFrame = m_webPage->focusedOrMainFrame();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectNode");
+    SelectionLog(LogLevelInfo, "SelectionHandler::selectNode");
 
     VisibleSelection selection = VisibleSelection::selectionFromContentsOfNode(node);
     focusedFrame->selection()->setSelection(selection);
@@ -840,7 +840,7 @@
 // system is not entirely WebKit.
 void SelectionHandler::selectionPositionChanged(bool visualChangeOnly)
 {
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false");
+    SelectionLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged visibleChangeOnly = %s", visualChangeOnly ? "true" : "false");
 
     // This method can get called during WebPage shutdown process.
     // If that is the case, just bail out since the client is not
@@ -869,7 +869,7 @@
     else if (!m_selectionActive)
         return;
 
-    DEBUG_SELECTION_TIMING(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed());
+    SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed());
 
     WebCore::IntRect startCaret;
     WebCore::IntRect endCaret;
@@ -902,11 +902,11 @@
 
         regionForTextQuads(quads, visibleSelectionRegion);
 
-#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on DEBUG_SELECTION to avoid loop.
+#if SHOWDEBUG_SELECTIONHANDLER // Don't rely just on SelectionLog to avoid loop.
         for (unsigned int i = 0; i < unclippedRegion.numRects(); i++)
-            DEBUG_SELECTION(LogLevelCritical, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height());
+            SelectionLog(LogLevelInfo, "Rect list - Unmodified #%d, (%d, %d) (%d x %d)", i, unclippedRegion.rects()[i].x(), unclippedRegion.rects()[i].y(), unclippedRegion.rects()[i].width(), unclippedRegion.rects()[i].height());
         for (unsigned int i = 0; i < visibleSelectionRegion.numRects(); i++)
-            DEBUG_SELECTION(LogLevelCritical, "Rect list  - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height());
+            SelectionLog(LogLevelInfo, "Rect list  - Clipped to Visible #%d, (%d, %d) (%d x %d)", i, visibleSelectionRegion.rects()[i].x(), visibleSelectionRegion.rects()[i].y(), visibleSelectionRegion.rects()[i].width(), visibleSelectionRegion.rects()[i].height());
 #endif
 
         bool shouldCareAboutPossibleClippedOutSelection = frame != m_webPage->mainFrame() || m_webPage->m_inputHandler->isInputMode();
@@ -935,20 +935,20 @@
         }
     }
 
-    DEBUG_SELECTION(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)",
+    SelectionLog(BlackBerry::Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged Start Rect=(%d, %d) (%d x %d) End Rect=(%d, %d) (%d x %d)",
                     startCaret.x(), startCaret.y(), startCaret.width(), startCaret.height(), endCaret.x(), endCaret.y(), endCaret.width(), endCaret.height());
 
     if (m_webPage->m_selectionOverlay)
         m_webPage->m_selectionOverlay->draw(visibleSelectionRegion);
 
     m_webPage->m_client->notifySelectionDetailsChanged(startCaret, endCaret, visibleSelectionRegion, inputNodeOverridesTouch());
-    DEBUG_SELECTION_TIMING(LogLevelInfo, "SelectionHandler::selectionPositionChanged completed at %f", m_timer.elapsed());
+    SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged completed at %f", m_timer.elapsed());
 }
 
 // NOTE: This function is not in WebKit coordinates.
 void SelectionHandler::caretPositionChanged()
 {
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged");
+    SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged");
 
     WebCore::IntRect caretLocation;
     // If the input field is empty, we always turn off the caret.
@@ -979,7 +979,7 @@
 
     m_caretActive = !caretLocation.isEmpty();
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d",
+    SelectionLog(LogLevelInfo, "SelectionHandler::caretPositionChanged caret Rect %d, %d, %dx%d",
                         caretLocation.x(), caretLocation.y(), caretLocation.width(), caretLocation.height());
 
     caretLocation = m_webPage->mapToTransformed(caretLocation);
@@ -998,7 +998,7 @@
         m_webPage->clipToTransformedContentsRect(nodeBoundingBox);
     }
 
-    DEBUG_SELECTION(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d",
+    SelectionLog(LogLevelInfo, "SelectionHandler::single line %s single line bounding box %d, %d, %dx%d",
                     singleLineInput ? "true" : "false", nodeBoundingBox.x(), nodeBoundingBox.y(), nodeBoundingBox.width(), nodeBoundingBox.height());
 
     m_webPage->m_client->notifyCaretChanged(caretLocation, m_webPage->m_touchEventHandler->lastFatFingersResult().isTextInput() /* userTouchTriggered */, singleLineInput, nodeBoundingBox);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to