Title: [87352] trunk/Source/WebCore
Revision
87352
Author
[email protected]
Date
2011-05-25 20:13:31 -0700 (Wed, 25 May 2011)

Log Message

2011-05-25  Levi Weintraub  <[email protected]>

        Reviewed by Eric Seidel.

        Switch itemBoundingBoxRect to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=60789

        Changing itemBoundingBoxRect to use an IntPoint representing the offset
        to be added tot he box rect instead of a pair of ints.

        No new tests since this is just refactoring.

        * accessibility/AccessibilityListBox.cpp:
        (WebCore::AccessibilityListBox::elementAccessibilityHitTest):
        * accessibility/AccessibilityListBoxOption.cpp:
        (WebCore::AccessibilityListBoxOption::elementRect):
        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::itemBoundingBoxRect):
        (WebCore::RenderListBox::addFocusRingRects):
        (WebCore::RenderListBox::paintItemForeground):
        (WebCore::RenderListBox::paintItemBackground):
        (WebCore::RenderListBox::nodeAtPoint):
        * rendering/RenderListBox.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87351 => 87352)


--- trunk/Source/WebCore/ChangeLog	2011-05-26 02:31:38 UTC (rev 87351)
+++ trunk/Source/WebCore/ChangeLog	2011-05-26 03:13:31 UTC (rev 87352)
@@ -1,3 +1,27 @@
+2011-05-25  Levi Weintraub  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Switch itemBoundingBoxRect to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=60789
+
+        Changing itemBoundingBoxRect to use an IntPoint representing the offset
+        to be added tot he box rect instead of a pair of ints.
+
+        No new tests since this is just refactoring.
+
+        * accessibility/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::elementAccessibilityHitTest):
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::elementRect):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::itemBoundingBoxRect):
+        (WebCore::RenderListBox::addFocusRingRects):
+        (WebCore::RenderListBox::paintItemForeground):
+        (WebCore::RenderListBox::paintItemBackground):
+        (WebCore::RenderListBox::nodeAtPoint):
+        * rendering/RenderListBox.h:
+
 2011-05-24  MORITA Hajime  <[email protected]>
 
         Reviewed by Dimitri Glazkov.

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp (87351 => 87352)


--- trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2011-05-26 02:31:38 UTC (rev 87351)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBox.cpp	2011-05-26 03:13:31 UTC (rev 87352)
@@ -179,7 +179,7 @@
     AccessibilityObject* listBoxOption = 0;
     unsigned length = m_children.size();
     for (unsigned i = 0; i < length; i++) {
-        IntRect rect = toRenderListBox(m_renderer)->itemBoundingBoxRect(parentRect.x(), parentRect.y(), i);
+        IntRect rect = toRenderListBox(m_renderer)->itemBoundingBoxRect(parentRect.location(), i);
         // The cast to HTMLElement below is safe because the only other possible listItem type
         // would be a WMLElement, but WML builds don't use accessibility features at all.
         if (rect.contains(point)) {

Modified: trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp (87351 => 87352)


--- trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp	2011-05-26 02:31:38 UTC (rev 87351)
+++ trunk/Source/WebCore/accessibility/AccessibilityListBoxOption.cpp	2011-05-26 03:13:31 UTC (rev 87352)
@@ -100,7 +100,7 @@
     IntRect parentRect = listBoxRenderer->document()->axObjectCache()->getOrCreate(listBoxRenderer)->boundingBoxRect();
     int index = listBoxOptionIndex();
     if (index != -1)
-        rect = toRenderListBox(listBoxRenderer)->itemBoundingBoxRect(parentRect.x(), parentRect.y(), index);
+        rect = toRenderListBox(listBoxRenderer)->itemBoundingBoxRect(parentRect.location(), index);
     
     return rect;
 }

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (87351 => 87352)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-05-26 02:31:38 UTC (rev 87351)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-05-26 03:13:31 UTC (rev 87352)
@@ -249,10 +249,10 @@
     return RenderBox::baselinePosition(baselineType, firstLine, lineDirection, linePositionMode) - baselineAdjustment;
 }
 
-IntRect RenderListBox::itemBoundingBoxRect(int tx, int ty, int index)
+IntRect RenderListBox::itemBoundingBoxRect(const IntPoint& additionalOffset, int index)
 {
-    return IntRect(tx + borderLeft() + paddingLeft(),
-                   ty + borderTop() + paddingTop() + itemHeight() * (index - m_indexOffset),
+    return IntRect(additionalOffset.x() + borderLeft() + paddingLeft(),
+                   additionalOffset.y() + borderTop() + paddingTop() + itemHeight() * (index - m_indexOffset),
                    contentWidth(), itemHeight());
 }
     
@@ -309,7 +309,7 @@
     // Focus the last selected item.
     int selectedItem = select->activeSelectionEndListIndex();
     if (selectedItem >= 0) {
-        rects.append(itemBoundingBoxRect(additionalOffset.x(), additionalOffset.y(), selectedItem));
+        rects.append(itemBoundingBoxRect(additionalOffset, selectedItem));
         return;
     }
 
@@ -319,7 +319,7 @@
     for (int i = 0; i < size; ++i) {
         OptionElement* optionElement = toOptionElement(listItems[i]);
         if (optionElement && !optionElement->disabled()) {
-            rects.append(itemBoundingBoxRect(additionalOffset.x(), additionalOffset.y(), i));
+            rects.append(itemBoundingBoxRect(additionalOffset, i));
             return;
         }
     }
@@ -392,7 +392,7 @@
     const UChar* string = itemText.characters();
     TextRun textRun(string, length, false, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->direction(), itemStyle->unicodeBidi() == Override);
     Font itemFont = style()->font();
-    IntRect r = itemBoundingBoxRect(tx, ty, listIndex);
+    IntRect r = itemBoundingBoxRect(IntPoint(tx, ty), listIndex);
     r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));
 
     if (isOptionGroupElement(element)) {
@@ -426,7 +426,7 @@
     // Draw the background for this list box item
     if (!element->renderStyle() || element->renderStyle()->visibility() != HIDDEN) {
         ColorSpace colorSpace = element->renderStyle() ? element->renderStyle()->colorSpace() : style()->colorSpace();
-        IntRect itemRect = itemBoundingBoxRect(tx, ty, listIndex);
+        IntRect itemRect = itemBoundingBoxRect(IntPoint(tx, ty), listIndex);
         itemRect.intersect(controlClipRect(tx, ty));
         paintInfo.context->fillRect(itemRect, backColor, colorSpace);
     }
@@ -673,7 +673,7 @@
     tx += this->x();
     ty += this->y();
     for (int i = 0; i < size; ++i) {
-        if (itemBoundingBoxRect(tx, ty, i).contains(pointInContainer)) {
+        if (itemBoundingBoxRect(IntPoint(tx, ty), i).contains(pointInContainer)) {
             if (Element* node = listItems[i]) {
                 result.setInnerNode(node);
                 if (!result.innerNonSharedNode())

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (87351 => 87352)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2011-05-26 02:31:38 UTC (rev 87351)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2011-05-26 03:13:31 UTC (rev 87352)
@@ -46,7 +46,7 @@
     void setOptionsChanged(bool changed) { m_optionsChanged = changed; }
 
     int listIndexAtOffset(int x, int y);
-    IntRect itemBoundingBoxRect(int tx, int ty, int index);
+    IntRect itemBoundingBoxRect(const IntPoint&, int index);
 
     bool scrollToRevealElementAtListIndex(int index);
     bool listIndexIsVisible(int index);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to