Title: [89945] trunk/Source/WebCore
Revision
89945
Author
[email protected]
Date
2011-06-28 11:31:19 -0700 (Tue, 28 Jun 2011)

Log Message

2011-06-28  Levi Weintraub  <[email protected]>

        Reviewed by Darin Adler.

        Create intermediate classes as a path towards getting off of pixel offsets
        https://bugs.webkit.org/show_bug.cgi?id=61896

        Creating three intermediate typedefs to aid in moving layout and hit testing from integers
        to floats. We'll transition the render tree over to these intermediate types and add
        infrastructure to support the new types behind USE(FLOAT_LAYOUT_OFFSETS). This allows the ultimate
        changeover to be easier.

        Switching LayoutState over to this abstraction to verify it works correctly.

        No new tests since this is creating a new abstraction, not changing current behavior.

        * GNUmakefile.list.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * rendering/LayoutState.cpp:
        (WebCore::LayoutState::LayoutState):
        (WebCore::LayoutState::pageLogicalOffset):
        (WebCore::LayoutState::addForcedColumnBreak):
        * rendering/LayoutState.h:
        * rendering/LayoutTypes.h: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89944 => 89945)


--- trunk/Source/WebCore/ChangeLog	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/ChangeLog	2011-06-28 18:31:19 UTC (rev 89945)
@@ -1,3 +1,31 @@
+2011-06-28  Levi Weintraub  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        Create intermediate classes as a path towards getting off of pixel offsets
+        https://bugs.webkit.org/show_bug.cgi?id=61896
+
+        Creating three intermediate typedefs to aid in moving layout and hit testing from integers
+        to floats. We'll transition the render tree over to these intermediate types and add
+        infrastructure to support the new types behind USE(FLOAT_LAYOUT_OFFSETS). This allows the ultimate
+        changeover to be easier.
+
+        Switching LayoutState over to this abstraction to verify it works correctly.
+
+        No new tests since this is creating a new abstraction, not changing current behavior.
+
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/LayoutState.cpp:
+        (WebCore::LayoutState::LayoutState):
+        (WebCore::LayoutState::pageLogicalOffset):
+        (WebCore::LayoutState::addForcedColumnBreak):
+        * rendering/LayoutState.h:
+        * rendering/LayoutTypes.h: Added.
+
 2011-06-28  Jeff Miller  <[email protected]>
 
         Add fullscreen.css and fullscreenQuickTime.css to the WebCore Visual Studio project for convenience.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (89944 => 89945)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-06-28 18:31:19 UTC (rev 89945)
@@ -2907,6 +2907,7 @@
 	Source/WebCore/rendering/InlineTextBox.h \
 	Source/WebCore/rendering/LayoutState.cpp \
 	Source/WebCore/rendering/LayoutState.h \
+	Source/WebCore/rendering/LayoutTypes.h \
 	Source/WebCore/rendering/OverlapTestRequestClient.h \
 	Source/WebCore/rendering/PaintInfo.h \
 	Source/WebCore/rendering/PaintPhase.h \

Modified: trunk/Source/WebCore/WebCore.gypi (89944 => 89945)


--- trunk/Source/WebCore/WebCore.gypi	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/WebCore.gypi	2011-06-28 18:31:19 UTC (rev 89945)
@@ -966,6 +966,7 @@
             'rendering/InlineFlowBox.h',
             'rendering/InlineTextBox.h',
             'rendering/LayoutState.h',
+            'rendering/LayoutTypes.h',
             'rendering/OverlapTestRequestClient.h',
             'rendering/PaintInfo.h',
             'rendering/PaintPhase.h',

Modified: trunk/Source/WebCore/WebCore.pro (89944 => 89945)


--- trunk/Source/WebCore/WebCore.pro	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/WebCore.pro	2011-06-28 18:31:19 UTC (rev 89945)
@@ -2132,6 +2132,7 @@
     rendering/InlineFlowBox.h \
     rendering/InlineTextBox.h \
     rendering/LayoutState.h \
+    rendering/LayoutTypes.h \
     rendering/mathml/RenderMathMLBlock.h \
     rendering/mathml/RenderMathMLFenced.h \
     rendering/mathml/RenderMathMLFraction.h \

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (89944 => 89945)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-06-28 18:31:19 UTC (rev 89945)
@@ -33618,6 +33618,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\rendering\LayoutTypes.h"
+				>
+			</File>
+			<File
 				RelativePath="..\rendering\PaintInfo.h"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (89944 => 89945)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-28 18:31:19 UTC (rev 89945)
@@ -4772,6 +4772,7 @@
 		B8DBDB4C130B0F8A00F5CDB1 /* SetSelectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B8DBDB48130B0F8A00F5CDB1 /* SetSelectionCommand.h */; };
 		B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */; };
 		B8DBDB4E130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */; };
+		BACF290113B2A0D500781F90 /* LayoutTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BACF290013B2A0D500781F90 /* LayoutTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; };
 		BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; };
 		BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */; };
@@ -11375,6 +11376,7 @@
 		B8DBDB48130B0F8A00F5CDB1 /* SetSelectionCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetSelectionCommand.h; sourceTree = "<group>"; };
 		B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellingCorrectionCommand.cpp; sourceTree = "<group>"; };
 		B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpellingCorrectionCommand.h; sourceTree = "<group>"; };
+		BACF290013B2A0D500781F90 /* LayoutTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutTypes.h; sourceTree = "<group>"; };
 		BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; };
 		BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; };
 		BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileInternal.h; sourceTree = "<group>"; };
@@ -19307,6 +19309,7 @@
 				BCEA481B097D93020094C9E4 /* InlineTextBox.h */,
 				2D9066040BE141D400956998 /* LayoutState.cpp */,
 				2D9066050BE141D400956998 /* LayoutState.h */,
+				BACF290013B2A0D500781F90 /* LayoutTypes.h */,
 				3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */,
 				0885067D11DA045B00182B98 /* PaintInfo.h */,
 				0885067E11DA045B00182B98 /* PaintPhase.h */,
@@ -23077,6 +23080,7 @@
 				B1AD4E7C13A12A7200846B27 /* CueParser.h in Headers */,
 				B1AD4E7D13A12A7200846B27 /* CueParserPrivate.h in Headers */,
 				97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */,
+				BACF290113B2A0D500781F90 /* LayoutTypes.h in Headers */,
 				43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */,
 				43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */,
 				087558C613B4A57D00F49307 /* SurrogatePairAwareTextIterator.h in Headers */,

Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (89944 => 89945)


--- trunk/Source/WebCore/rendering/LayoutState.cpp	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp	2011-06-28 18:31:19 UTC (rev 89945)
@@ -34,7 +34,7 @@
 
 namespace WebCore {
 
-LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const IntSize& offset, int pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
+LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
     : m_columnInfo(columnInfo)
     , m_next(prev)
 #ifndef NDEBUG
@@ -47,7 +47,7 @@
     if (fixed) {
         // FIXME: This doesn't work correctly with transforms.
         FloatPoint fixedOffset = renderer->view()->localToAbsolute(FloatPoint(), true);
-        m_paintOffset = IntSize(fixedOffset.x(), fixedOffset.y()) + offset;
+        m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
     } else
         m_paintOffset = prev->m_paintOffset + offset;
 
@@ -69,7 +69,7 @@
 
     if (renderer->hasOverflowClip()) {
         RenderLayer* layer = renderer->layer();
-        IntRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), layer->size());
+        LayoutRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), layer->size());
         if (m_clipped)
             m_clipRect.intersect(clipRect);
         else {
@@ -84,7 +84,7 @@
     // We can compare this later on to figure out what part of the page we're actually on,
     if (pageLogicalHeight || m_columnInfo) {
         m_pageLogicalHeight = pageLogicalHeight;
-        m_pageOffset = IntSize(m_layoutOffset.width() + renderer->borderLeft() + renderer->paddingLeft(),
+        m_pageOffset = LayoutSize(m_layoutOffset.width() + renderer->borderLeft() + renderer->paddingLeft(),
                                m_layoutOffset.height() + renderer->borderTop() + renderer->paddingTop());
         m_pageLogicalHeightChanged = pageLogicalHeightChanged;
     } else {
@@ -118,12 +118,12 @@
 {
     RenderObject* container = root->container();
     FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true);
-    m_paintOffset = IntSize(absContentPoint.x(), absContentPoint.y());
+    m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
 
     if (container->hasOverflowClip()) {
         RenderLayer* layer = toRenderBoxModelObject(container)->layer();
         m_clipped = true;
-        m_clipRect = IntRect(toPoint(m_paintOffset), layer->size());
+        m_clipRect = LayoutRect(toPoint(m_paintOffset), layer->size());
         m_paintOffset -= layer->scrolledContentOffset();
     }
 }
@@ -162,12 +162,12 @@
     m_columnInfo = m_next->m_columnInfo;
 }
 
-int LayoutState::pageLogicalOffset(int childLogicalOffset) const
+LayoutUnit LayoutState::pageLogicalOffset(LayoutUnit childLogicalOffset) const
 {
     return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height();
 }
 
-void LayoutState::addForcedColumnBreak(int childLogicalOffset)
+void LayoutState::addForcedColumnBreak(LayoutUnit childLogicalOffset)
 {
     if (!m_columnInfo || m_columnInfo->columnHeight())
         return;

Modified: trunk/Source/WebCore/rendering/LayoutState.h (89944 => 89945)


--- trunk/Source/WebCore/rendering/LayoutState.h	2011-06-28 18:29:17 UTC (rev 89944)
+++ trunk/Source/WebCore/rendering/LayoutState.h	2011-06-28 18:31:19 UTC (rev 89945)
@@ -26,8 +26,7 @@
 #ifndef LayoutState_h
 #define LayoutState_h
 
-#include "IntRect.h"
-#include "IntSize.h"
+#include "LayoutTypes.h"
 #include <wtf/Noncopyable.h>
 
 namespace WebCore {
@@ -52,7 +51,7 @@
     {
     }
 
-    LayoutState(LayoutState*, RenderBox*, const IntSize& offset, int pageHeight, bool pageHeightChanged, ColumnInfo*);
+    LayoutState(LayoutState*, RenderBox*, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged, ColumnInfo*);
     LayoutState(RenderObject*);
 
     void destroy(RenderArena*);
@@ -69,9 +68,9 @@
     
     // The page logical offset is the object's offset from the top of the page in the page progression
     // direction (so an x-offset in vertical text and a y-offset for horizontal text).
-    int pageLogicalOffset(int childLogicalOffset) const;
+    LayoutUnit pageLogicalOffset(LayoutUnit childLogicalOffset) const;
 
-    void addForcedColumnBreak(int childLogicalOffset);
+    void addForcedColumnBreak(LayoutUnit childLogicalOffset);
     
     bool pageLogicalHeight() const { return m_pageLogicalHeight; }
     bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
@@ -82,17 +81,25 @@
 
 public:
     bool m_clipped;
-    IntRect m_clipRect;
-    IntSize m_paintOffset; // x/y offset from container.  Includes relative positioning and scroll offsets.
-    IntSize m_layoutOffset; // x/y offset from container.  Does not include relative positioning or scroll offsets.
-    IntSize m_layoutDelta; // Transient offset from the final position of the object
-                           // used to ensure that repaints happen in the correct place.
-                           // This is a total delta accumulated from the root.
+    LayoutRect m_clipRect;
+    
+    // x/y offset from container. Includes relative positioning and scroll offsets.
+    LayoutSize m_paintOffset;
+    // x/y offset from container. Does not include relative positioning or scroll offsets.
+    LayoutSize m_layoutOffset;
+    // Transient offset from the final position of the object
+    // used to ensure that repaints happen in the correct place.
+    // This is a total delta accumulated from the root. 
+    LayoutSize m_layoutDelta;
 
-    int m_pageLogicalHeight; // The current page height for the pagination model that encloses us.
-    bool m_pageLogicalHeightChanged; // If our page height has changed, this will force all blocks to relayout.
-    IntSize m_pageOffset; // The offset of the start of the first page in the nearest enclosing pagination model.
-    ColumnInfo* m_columnInfo; // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
+    // The current page height for the pagination model that encloses us.
+    LayoutUnit m_pageLogicalHeight;
+    // If our page height has changed, this will force all blocks to relayout.
+    bool m_pageLogicalHeightChanged;
+    // The offset of the start of the first page in the nearest enclosing pagination model.
+    LayoutSize m_pageOffset;
+    // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
+    ColumnInfo* m_columnInfo;
 
     LayoutState* m_next;
 #ifndef NDEBUG

Added: trunk/Source/WebCore/rendering/LayoutTypes.h (0 => 89945)


--- trunk/Source/WebCore/rendering/LayoutTypes.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h	2011-06-28 18:31:19 UTC (rev 89945)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// These typedefs are being used to abstract layout and hit testing off
+// of integers and eventually replace them with floats. Once this transition
+// is complete, these types will be removed. Progress can be tracked at
+// https://bugs.webkit.org/show_bug.cgi?id=60318
+
+#ifndef LayoutTypes_h
+#define LayoutTypes_h
+
+#include "IntRect.h"
+
+namespace WebCore {
+
+typedef int LayoutUnit;
+typedef IntPoint LayoutPoint;
+typedef IntSize LayoutSize;
+typedef IntRect LayoutRect;
+
+} // namespace WebCore
+
+#endif // LayoutTypes_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to