2011-06-03 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2011 20:55:44 +0000 (20:55 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jun 2011 20:55:44 +0000 (20:55 +0000)
        Reviewed by Eric Seidel.

        Switch paintItemForeground and paintItemForeground to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=62035

        Switching paintItemFore/Background to use IntPoint instead of a pair of ints.

        No new tests since this is simple refactoring.

        * rendering/RenderListBox.cpp:
        (WebCore::RenderListBox::paintObject):
        (WebCore::RenderListBox::paintItemForeground):
        (WebCore::RenderListBox::paintItemBackground):
        * rendering/RenderListBox.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h

index 6a01d42b95f55dc4eb0710eab03f7a86ce1e45f3..ca2d692f433352ffbad0093bb15504738c40dab5 100644 (file)
@@ -1,3 +1,20 @@
+2011-06-03  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Switch paintItemForeground and paintItemForeground to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62035
+
+        Switching paintItemFore/Background to use IntPoint instead of a pair of ints.
+
+        No new tests since this is simple refactoring.
+
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::paintObject):
+        (WebCore::RenderListBox::paintItemForeground):
+        (WebCore::RenderListBox::paintItemBackground):
+        * rendering/RenderListBox.h:
+
 2011-06-03  Alexis Menard  <alexis.menard@openbossa.org>
 
         Reviewed by Andreas Kling.
index e377806808aca1a9ca177c3a8f9a4ec37616513c..1a544352fc2a45d3456ae9af963ee953d51f9156 100644 (file)
@@ -266,7 +266,7 @@ void RenderListBox::paintObject(PaintInfo& paintInfo, int tx, int ty)
     if (paintInfo.phase == PaintPhaseForeground) {
         int index = m_indexOffset;
         while (index < listItemsSize && index <= m_indexOffset + numVisibleItems()) {
-            paintItemForeground(paintInfo, tx, ty, index);
+            paintItemForeground(paintInfo, IntPoint(tx, ty), index);
             index++;
         }
     }
@@ -289,7 +289,7 @@ void RenderListBox::paintObject(PaintInfo& paintInfo, int tx, int ty)
     case PaintPhaseChildBlockBackgrounds: {
         int index = m_indexOffset;
         while (index < listItemsSize && index <= m_indexOffset + numVisibleItems()) {
-            paintItemBackground(paintInfo, tx, ty, index);
+            paintItemBackground(paintInfo, IntPoint(tx, ty), index);
             index++;
         }
         break;
@@ -356,7 +356,7 @@ static IntSize itemOffsetForAlignment(TextRun textRun, RenderStyle* itemStyle, F
     return offset;
 }
 
-void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, int listIndex)
+void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const IntPoint& paintOffset, int listIndex)
 {
     SelectElement* select = toSelectElement(static_cast<Element*>(node()));
     const Vector<Element*>& listItems = select->listItems();
@@ -392,7 +392,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in
     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(IntPoint(tx, ty), listIndex);
+    IntRect r = itemBoundingBoxRect(paintOffset, listIndex);
     r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));
 
     if (isOptionGroupElement(element)) {
@@ -407,7 +407,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in
         paintInfo.context->drawBidiText(itemFont, textRun, r.location());
 }
 
-void RenderListBox::paintItemBackground(PaintInfo& paintInfo, int tx, int ty, int listIndex)
+void RenderListBox::paintItemBackground(PaintInfo& paintInfo, const IntPoint& paintOffset, int listIndex)
 {
     SelectElement* select = toSelectElement(static_cast<Element*>(node()));
     const Vector<Element*>& listItems = select->listItems();
@@ -426,8 +426,8 @@ void RenderListBox::paintItemBackground(PaintInfo& paintInfo, int tx, int ty, in
     // 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(IntPoint(tx, ty), listIndex);
-        itemRect.intersect(controlClipRect(IntPoint(tx, ty)));
+        IntRect itemRect = itemBoundingBoxRect(paintOffset, listIndex);
+        itemRect.intersect(controlClipRect(paintOffset));
         paintInfo.context->fillRect(itemRect, backColor, colorSpace);
     }
 }
index 87ae170213a2bb67f24e2b838327c8dbbca05132..48f52c1008b6cf7d03b03d59a4ed6bd529d926cc 100644 (file)
@@ -133,8 +133,8 @@ private:
     int numItems() const;
     int listHeight() const;
     void paintScrollbar(PaintInfo&, int tx, int ty);
-    void paintItemForeground(PaintInfo&, int tx, int ty, int listIndex);
-    void paintItemBackground(PaintInfo&, int tx, int ty, int listIndex);
+    void paintItemForeground(PaintInfo&, const IntPoint&, int listIndex);
+    void paintItemBackground(PaintInfo&, const IntPoint&, int listIndex);
     void scrollToRevealSelection();
 
     bool m_optionsChanged;