Title: [116788] trunk/Source/WebCore
Revision
116788
Author
[email protected]
Date
2012-05-11 11:21:39 -0700 (Fri, 11 May 2012)

Log Message

Simplify FloatingObject by removing unnecessary convenience methods.
https://bugs.webkit.org/show_bug.cgi?id=86163

Reviewed by Eric Seidel.

Simplify the pixel snapping in FloatingObject by getting rid of a bunch
of convenience methods.

No new tests, no change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addOverhangingFloats):
(WebCore::RenderBlock::addIntrudingFloats):
(WebCore::RenderBlock::FloatingObjects::intervalForFloatingObject):
(WebCore::::string):
* rendering/RenderBlock.h:
(FloatingObject):
(WebCore::RenderBlock::pixelSnappedLogicalTopForFloat):
(WebCore::RenderBlock::pixelSnappedLogicalBottomForFloat):
(WebCore::RenderBlock::pixelSnappedLogicalLeftForFloat):
(WebCore::RenderBlock::pixelSnappedLogicalRightForFloat):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116787 => 116788)


--- trunk/Source/WebCore/ChangeLog	2012-05-11 18:10:34 UTC (rev 116787)
+++ trunk/Source/WebCore/ChangeLog	2012-05-11 18:21:39 UTC (rev 116788)
@@ -1,3 +1,27 @@
+2012-05-11  Emil A Eklund  <[email protected]>
+
+        Simplify FloatingObject by removing unnecessary convenience methods.
+        https://bugs.webkit.org/show_bug.cgi?id=86163
+
+        Reviewed by Eric Seidel.
+
+        Simplify the pixel snapping in FloatingObject by getting rid of a bunch
+        of convenience methods.
+
+        No new tests, no change in functionality.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addOverhangingFloats):
+        (WebCore::RenderBlock::addIntrudingFloats):
+        (WebCore::RenderBlock::FloatingObjects::intervalForFloatingObject):
+        (WebCore::::string):
+        * rendering/RenderBlock.h:
+        (FloatingObject):
+        (WebCore::RenderBlock::pixelSnappedLogicalTopForFloat):
+        (WebCore::RenderBlock::pixelSnappedLogicalBottomForFloat):
+        (WebCore::RenderBlock::pixelSnappedLogicalLeftForFloat):
+        (WebCore::RenderBlock::pixelSnappedLogicalRightForFloat):
+
 2012-05-11  Ian Vollick  <[email protected]>
 
         [chromium] Ensure that animations continue to run when transform-style is changed

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (116787 => 116788)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-05-11 18:10:34 UTC (rev 116787)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-05-11 18:21:39 UTC (rev 116788)
@@ -4168,9 +4168,8 @@
         if (logicalBottom > logicalHeight()) {
             // If the object is not in the list, we add it now.
             if (!containsFloat(r->m_renderer)) {
-                LayoutUnit leftOffset = isHorizontalWritingMode() ? -childLogicalLeft : -childLogicalTop;
-                LayoutUnit topOffset = isHorizontalWritingMode() ? -childLogicalTop : -childLogicalLeft;
-                FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->x() - leftOffset, r->y() - topOffset, r->width(), r->height()));
+                LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-childLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft);
+                FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size()));
                 floatingObj->m_renderer = r->m_renderer;
 
                 // The nearest enclosing layer always paints the float (so that zindex and stacking
@@ -4237,10 +4236,8 @@
         FloatingObject* r = *prevIt;
         if (logicalBottomForFloat(r) > logicalTopOffset) {
             if (!m_floatingObjects || !m_floatingObjects->set().contains(r)) {
-                LayoutUnit leftOffset = isHorizontalWritingMode() ? logicalLeftOffset : logicalTopOffset;
-                LayoutUnit topOffset = isHorizontalWritingMode() ? logicalTopOffset : logicalLeftOffset;
-                
-                FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->x() - leftOffset, r->y() - topOffset, r->width(), r->height()));
+                LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, logicalTopOffset) : LayoutSize(logicalTopOffset, logicalLeftOffset);
+                FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size()));
 
                 // Applying the child's margin makes no sense in the case where the child was passed in.
                 // since this margin was added already through the modification of the |logicalLeftOffset| variable
@@ -7197,8 +7194,8 @@
 inline RenderBlock::FloatingObjectInterval RenderBlock::FloatingObjects::intervalForFloatingObject(FloatingObject* floatingObject)
 {
     if (m_horizontalWritingMode)
-        return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxY(), floatingObject);
-    return RenderBlock::FloatingObjectInterval(floatingObject->pixelSnappedX(), floatingObject->pixelSnappedMaxX(), floatingObject);
+        return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().pixelSnappedY(), floatingObject->frameRect().pixelSnappedMaxY(), floatingObject);
+    return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedMaxX(), floatingObject);
 }
 
 void RenderBlock::FloatingObjects::addPlacedObject(FloatingObject* floatingObject)
@@ -7342,7 +7339,7 @@
 
 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::FloatingObject* floatingObject)
 {
-    return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->pixelSnappedX(), floatingObject->pixelSnappedY(), floatingObject->pixelSnappedMaxX(), floatingObject->pixelSnappedMaxY());
+    return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->frameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floatingObject->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnappedMaxY());
 }
 
 #endif

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (116787 => 116788)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2012-05-11 18:10:34 UTC (rev 116787)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2012-05-11 18:21:39 UTC (rev 116788)
@@ -574,13 +574,6 @@
         inline LayoutUnit width() const { return m_frameRect.width(); }
         inline LayoutUnit height() const { return m_frameRect.height(); }
 
-        inline int pixelSnappedX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedX(); }
-        inline int pixelSnappedMaxX() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxX(); }
-        inline int pixelSnappedY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedY(); }
-        inline int pixelSnappedMaxY() const { ASSERT(isPlaced()); return m_frameRect.pixelSnappedMaxY(); }
-        inline int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
-        inline int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
-
         void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); }
         void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); }
         void setWidth(LayoutUnit width) { ASSERT(!isInPlacedTree()); m_frameRect.setWidth(width); }
@@ -622,11 +615,10 @@
     LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); }
     LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); }
 
-    int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->pixelSnappedY() : child->pixelSnappedX(); }
-    int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->pixelSnappedMaxY() : child->pixelSnappedMaxX(); }
-    int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->pixelSnappedX() : child->pixelSnappedY(); }
-    int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->pixelSnappedMaxX() : child->pixelSnappedMaxY(); }
-    int pixelSnappedLogicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->pixelSnappedWidth() : child->pixelSnappedHeight(); }
+    int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedY() : child->frameRect().pixelSnappedX(); }
+    int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxY() : child->frameRect().pixelSnappedMaxX(); }
+    int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedX() : child->frameRect().pixelSnappedY(); }
+    int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxX() : child->frameRect().pixelSnappedMaxY(); }
 
     void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop)
     {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to