Title: [99016] trunk/Source/WebCore
Revision
99016
Author
e...@chromium.org
Date
2011-11-01 17:15:10 -0700 (Tue, 01 Nov 2011)

Log Message

Switch PopupMenuClient to layout abstraction
https://bugs.webkit.org/show_bug.cgi?id=71308

Reviewed by Darin Adler.

Switch PopupMenuClient and rendering classes implementing it to layout
type abstraction.

No new tests.

* platform/PopupMenuClient.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::listIndexAtOffset):
(WebCore::RenderListBox::panScroll):
(WebCore::RenderListBox::scrollToward):
(WebCore::RenderListBox::scrollSize):
(WebCore::RenderListBox::scrollPosition):
(WebCore::RenderListBox::setScrollOffset):
(WebCore::RenderListBox::verticalScrollbarWidth):
Revert scroll positions and scroll offsets to ints to align with device
pixels.

* rendering/RenderListBox.h:
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::showPopup):
(WebCore::RenderMenuList::clientPaddingLeft):
(WebCore::RenderMenuList::clientPaddingRight):
* rendering/RenderMenuList.h:
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::hitInnerTextElement):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::clientPaddingLeft):
(WebCore::RenderTextControlSingleLine::clientPaddingRight):
* rendering/RenderTextControlSingleLine.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99015 => 99016)


--- trunk/Source/WebCore/ChangeLog	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/ChangeLog	2011-11-02 00:15:10 UTC (rev 99016)
@@ -1,3 +1,40 @@
+2011-11-01  Emil A Eklund  <e...@chromium.org>
+
+        Switch PopupMenuClient to layout abstraction
+        https://bugs.webkit.org/show_bug.cgi?id=71308
+
+        Reviewed by Darin Adler.
+
+        Switch PopupMenuClient and rendering classes implementing it to layout
+        type abstraction.
+
+        No new tests.
+
+        * platform/PopupMenuClient.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::listIndexAtOffset):
+        (WebCore::RenderListBox::panScroll):
+        (WebCore::RenderListBox::scrollToward):
+        (WebCore::RenderListBox::scrollSize):
+        (WebCore::RenderListBox::scrollPosition):
+        (WebCore::RenderListBox::setScrollOffset):
+        (WebCore::RenderListBox::verticalScrollbarWidth):
+        Revert scroll positions and scroll offsets to ints to align with device
+        pixels.
+        
+        * rendering/RenderListBox.h:
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::showPopup):
+        (WebCore::RenderMenuList::clientPaddingLeft):
+        (WebCore::RenderMenuList::clientPaddingRight):
+        * rendering/RenderMenuList.h:
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::hitInnerTextElement):
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::clientPaddingLeft):
+        (WebCore::RenderTextControlSingleLine::clientPaddingRight):
+        * rendering/RenderTextControlSingleLine.h:
+
 2011-11-01  Nate Chapin  <jap...@chromium.org>
 
         [chromium] As of r98380, ThreadableLoaderClients are having their

Modified: trunk/Source/WebCore/platform/PopupMenuClient.h (99015 => 99016)


--- trunk/Source/WebCore/platform/PopupMenuClient.h	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/platform/PopupMenuClient.h	2011-11-02 00:15:10 UTC (rev 99016)
@@ -22,6 +22,7 @@
 #ifndef PopupMenuClient_h
 #define PopupMenuClient_h
 
+#include "LayoutTypes.h"
 #include "PopupMenuStyle.h"
 #include "ScrollTypes.h"
 #include <wtf/Forward.h>
@@ -51,8 +52,8 @@
     virtual PopupMenuStyle menuStyle() const = 0;
     virtual int clientInsetLeft() const = 0;
     virtual int clientInsetRight() const = 0;
-    virtual int clientPaddingLeft() const = 0;
-    virtual int clientPaddingRight() const = 0;
+    virtual LayoutUnit clientPaddingLeft() const = 0;
+    virtual LayoutUnit clientPaddingRight() const = 0;
     virtual int listSize() const = 0;
     virtual int selectedIndex() const = 0;
     virtual void popupDidHide() = 0;

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-11-02 00:15:10 UTC (rev 99016)
@@ -467,7 +467,7 @@
     if (offset.height() < borderTop() + paddingTop() || offset.height() > height() - paddingBottom() - borderBottom())
         return -1;
 
-    LayoutUnit scrollbarWidth = m_vBar ? m_vBar->width() : 0;
+    LayoutUnit scrollbarWidth = m_vBar ? m_vBar->width() : LayoutUnit(0);
     if (offset.width() < borderLeft() + paddingLeft() || offset.width() > width() - borderRight() - paddingRight() - scrollbarWidth)
         return -1;
 
@@ -492,10 +492,10 @@
     else
         previousMousePosition = currentMousePosition;
 
-    LayoutUnit yDelta = currentMousePosition.y() - panStartMousePosition.y();
+    int yDelta = currentMousePosition.y() - panStartMousePosition.y();
 
     // If the point is too far from the center we limit the speed
-    yDelta = max<LayoutUnit>(min<LayoutUnit>(yDelta, maxSpeed), -maxSpeed);
+    yDelta = max<int>(min<int>(yDelta, maxSpeed), -maxSpeed);
     
     if (abs(yDelta) < iconRadius) // at the center we let the space for the icon
         return;
@@ -509,9 +509,9 @@
     // Let's attenuate the speed
     yDelta /= speedReducer;
 
-    LayoutPoint scrollPoint(0, 0);
+    IntPoint scrollPoint(0, 0);
     scrollPoint.setY(absOffset.y() + yDelta);
-    LayoutUnit newOffset = scrollToward(scrollPoint);
+    int newOffset = scrollToward(scrollPoint);
     if (newOffset < 0) 
         return;
 
@@ -521,11 +521,11 @@
     m_inAutoscroll = false;
 }
 
-int RenderListBox::scrollToward(const LayoutPoint& destination)
+int RenderListBox::scrollToward(const IntPoint& destination)
 {
     // FIXME: This doesn't work correctly with transforms.
     FloatPoint absPos = localToAbsolute();
-    LayoutSize positionOffset = roundedLayoutSize(destination - absPos);
+    IntSize positionOffset = roundedIntSize(destination - absPos);
 
     int rows = numVisibleItems();
     int offset = m_indexOffset;
@@ -600,17 +600,17 @@
     element->dispatchFormControlChangeEvent();
 }
 
-LayoutUnit RenderListBox::scrollSize(ScrollbarOrientation orientation) const
+int RenderListBox::scrollSize(ScrollbarOrientation orientation) const
 {
     return ((orientation == VerticalScrollbar) && m_vBar) ? (m_vBar->totalSize() - m_vBar->visibleSize()) : 0;
 }
 
-LayoutUnit RenderListBox::scrollPosition(Scrollbar*) const
+int RenderListBox::scrollPosition(Scrollbar*) const
 {
     return m_indexOffset;
 }
 
-void RenderListBox::setScrollOffset(const LayoutPoint& offset)
+void RenderListBox::setScrollOffset(const IntPoint& offset)
 {
     scrollTo(offset.y());
 }
@@ -632,7 +632,7 @@
 
 LayoutUnit RenderListBox::verticalScrollbarWidth() const
 {
-    return m_vBar && !m_vBar->isOverlayScrollbar() ? m_vBar->width() : 0;
+    return m_vBar && !m_vBar->isOverlayScrollbar() ? m_vBar->width() : LayoutUnit(0);
 }
 
 // FIXME: We ignore padding in the vertical direction as far as these values are concerned, since that's

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2011-11-02 00:15:10 UTC (rev 99016)
@@ -51,7 +51,7 @@
     bool scrollToRevealElementAtListIndex(int index);
     bool listIndexIsVisible(int index);
 
-    int scrollToward(const LayoutPoint&); // Returns the new index or -1 if no scroll occurred
+    int scrollToward(const IntPoint&); // Returns the new index or -1 if no scroll occurred
 
     int size() const;
 

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2011-11-02 00:15:10 UTC (rev 99016)
@@ -305,7 +305,7 @@
     // the actual width of the element to size the popup.
     FloatPoint absTopLeft = localToAbsolute(FloatPoint(), false, true);
     LayoutRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
-    absBounds.setLocation(roundedIntPoint(absTopLeft));
+    absBounds.setLocation(roundedLayoutPoint(absTopLeft));
     HTMLSelectElement* select = toHTMLSelectElement(node());
     m_popup->show(absBounds, document()->view(), select->optionToListIndex(select->selectedIndex()));
 }
@@ -502,13 +502,13 @@
     return 0;
 }
 
-int RenderMenuList::clientPaddingLeft() const
+LayoutUnit RenderMenuList::clientPaddingLeft() const
 {
     return paddingLeft() + m_innerBlock->paddingLeft();
 }
 
 const int endOfLinePadding = 2;
-int RenderMenuList::clientPaddingRight() const
+LayoutUnit RenderMenuList::clientPaddingRight() const
 {
     if (style()->appearance() == MenulistPart || style()->appearance() == MenulistButtonPart) {
         // For these appearance values, the theme applies padding to leave room for the

Modified: trunk/Source/WebCore/rendering/RenderMenuList.h (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderMenuList.h	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderMenuList.h	2011-11-02 00:15:10 UTC (rev 99016)
@@ -24,6 +24,7 @@
 #ifndef RenderMenuList_h
 #define RenderMenuList_h
 
+#include "LayoutTypes.h"
 #include "PopupMenu.h"
 #include "PopupMenuClient.h"
 #include "RenderDeprecatedFlexibleBox.h"
@@ -91,8 +92,8 @@
     virtual PopupMenuStyle menuStyle() const;
     virtual int clientInsetLeft() const;
     virtual int clientInsetRight() const;
-    virtual int clientPaddingLeft() const;
-    virtual int clientPaddingRight() const;
+    virtual LayoutUnit clientPaddingLeft() const;
+    virtual LayoutUnit clientPaddingRight() const;
     virtual int listSize() const;
     virtual int selectedIndex() const;
     virtual void popupDidHide();

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2011-11-02 00:15:10 UTC (rev 99016)
@@ -187,7 +187,7 @@
     HTMLElement* innerText = innerTextElement();
     result.setInnerNode(innerText);
     result.setInnerNonSharedNode(innerText);
-    result.setLocalPoint(pointInContainer - toSize(adjustedLocation + innerText->renderBox()->location()));
+    result.setLocalPoint(pointInContainer - toLayoutSize(adjustedLocation + innerText->renderBox()->location()));
 }
 
 static const char* fontFamiliesWithInvalidCharWidth[] = {

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2011-11-02 00:15:10 UTC (rev 99016)
@@ -628,9 +628,9 @@
     return height() / 2;
 }
 
-int RenderTextControlSingleLine::clientPaddingLeft() const
+LayoutUnit RenderTextControlSingleLine::clientPaddingLeft() const
 {
-    int padding = paddingLeft();
+    LayoutUnit padding = paddingLeft();
 
     HTMLElement* resultsButton = resultsButtonElement();
     if (RenderBox* resultsRenderer = resultsButton ? resultsButton->renderBox() : 0)
@@ -639,9 +639,9 @@
     return padding;
 }
 
-int RenderTextControlSingleLine::clientPaddingRight() const
+LayoutUnit RenderTextControlSingleLine::clientPaddingRight() const
 {
-    int padding = paddingRight();
+    LayoutUnit padding = paddingRight();
 
     HTMLElement* cancelButton = cancelButtonElement();
     if (RenderBox* cancelRenderer = cancelButton ? cancelButton->renderBox() : 0)

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h (99015 => 99016)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h	2011-11-02 00:09:18 UTC (rev 99015)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h	2011-11-02 00:15:10 UTC (rev 99016)
@@ -102,8 +102,8 @@
     virtual PopupMenuStyle menuStyle() const;
     virtual int clientInsetLeft() const;
     virtual int clientInsetRight() const;
-    virtual int clientPaddingLeft() const;
-    virtual int clientPaddingRight() const;
+    virtual LayoutUnit clientPaddingLeft() const;
+    virtual LayoutUnit clientPaddingRight() const;
     virtual int listSize() const;
     virtual int selectedIndex() const;
     virtual void popupDidHide();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to