2011-05-10 Levi Weintraub <leviw@chromium.org>
authorleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2011 23:45:03 +0000 (23:45 +0000)
committerleviw@chromium.org <leviw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 May 2011 23:45:03 +0000 (23:45 +0000)
        Reviewed by Eric Seidel.

        Create LayerOffset class
        https://bugs.webkit.org/show_bug.cgi?id=60490

        Adding a LayerOffset class that will replace existing usage of tx/ty.
        LayerOffset is necessary since these values are commonly used as both
        a size and a point. Updating paintIntoRect to use this new class.

        No new tests since this doesn't change any behavior.

        * GNUmakefile.list.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * page/FrameView.cpp:
        (WebCore::FrameView::paintScrollCorner):
        * platform/graphics/LayerOffset.h: Added.
        (WebCore::LayerOffset::LayerOffset):
        (WebCore::LayerOffset::x):
        (WebCore::LayerOffset::y):
        (WebCore::LayerOffset::setX):
        (WebCore::LayerOffset::setY):
        (WebCore::LayerOffset::toSize):
        (WebCore::LayerOffset::toPoint):
        (WebCore::operator+=):
        (WebCore::operator-=):
        (WebCore::operator+):
        (WebCore::operator-):
        (WebCore::operator==):
        (WebCore::operator!=):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::paintScrollCorner):
        (WebCore::RenderLayer::paintResizer):
        * rendering/RenderScrollbar.cpp:
        (WebCore::RenderScrollbar::paintPart):
        * rendering/RenderScrollbarPart.cpp:
        (WebCore::RenderScrollbarPart::paintIntoRect):
        * rendering/RenderScrollbarPart.h:

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

24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/FrameView.cpp
Source/WebCore/platform/graphics/LayerOffset.h [new file with mode: 0644]
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderScrollbar.cpp
Source/WebCore/rendering/RenderScrollbarPart.cpp
Source/WebCore/rendering/RenderScrollbarPart.h
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/RootInlineBox.h

index 81fed86..188d436 100644 (file)
@@ -1,3 +1,46 @@
+2011-05-10  Levi Weintraub  <leviw@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Create LayerOffset class
+        https://bugs.webkit.org/show_bug.cgi?id=60490
+
+        Adding a LayerOffset class that will replace existing usage of tx/ty.
+        LayerOffset is necessary since these values are commonly used as both
+        a size and a point. Updating paintIntoRect to use this new class.
+
+        No new tests since this doesn't change any behavior.
+
+        * GNUmakefile.list.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintScrollCorner):
+        * platform/graphics/LayerOffset.h: Added.
+        (WebCore::LayerOffset::LayerOffset):
+        (WebCore::LayerOffset::x):
+        (WebCore::LayerOffset::y):
+        (WebCore::LayerOffset::setX):
+        (WebCore::LayerOffset::setY):
+        (WebCore::LayerOffset::toSize):
+        (WebCore::LayerOffset::toPoint):
+        (WebCore::operator+=):
+        (WebCore::operator-=):
+        (WebCore::operator+):
+        (WebCore::operator-):
+        (WebCore::operator==):
+        (WebCore::operator!=):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintScrollCorner):
+        (WebCore::RenderLayer::paintResizer):
+        * rendering/RenderScrollbar.cpp:
+        (WebCore::RenderScrollbar::paintPart):
+        * rendering/RenderScrollbarPart.cpp:
+        (WebCore::RenderScrollbarPart::paintIntoRect):
+        * rendering/RenderScrollbarPart.h:
+
 2011-05-10  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Darin Adler.
index 5de28d3..0e099b7 100644 (file)
@@ -2439,6 +2439,7 @@ webcore_sources += \
        Source/WebCore/platform/graphics/IntRect.h \
        Source/WebCore/platform/graphics/IntSize.h \
        Source/WebCore/platform/graphics/IntSizeHash.h \
+       Source/WebCore/platform/graphics/LayerOffset.h \
        Source/WebCore/platform/graphics/MediaPlayer.cpp \
        Source/WebCore/platform/graphics/MediaPlayer.h \
        Source/WebCore/platform/graphics/MediaPlayerPrivate.h \
index 5f9f19b..9cc71d1 100644 (file)
             'platform/graphics/IntRectHash.h',
             'platform/graphics/IntSize.h',
             'platform/graphics/IntSizeHash.h',
+            'platform/graphics/LayerOffset.h',
             'platform/graphics/MediaPlayer.h',
             'platform/graphics/Path.h',
             'platform/graphics/Pattern.h',
index 64069b7..4482161 100644 (file)
@@ -1951,6 +1951,7 @@ HEADERS += \
     platform/graphics/IntPoint.h \
     platform/graphics/IntPointHash.h \
     platform/graphics/IntRect.h \
+    platform/graphics/LayerOffset.h \
     platform/graphics/MediaPlayer.h \
     platform/graphics/Path.h \
     platform/graphics/PathTraversalState.h \
index edf9cc2..0550295 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\platform\graphics\LayerOffset.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\platform\graphics\MediaPlayer.cpp"
                                        >
                                </File>
index 14e4231..2c46f5b 100644 (file)
                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 */; };
+               BA5175C813789735008BFCBF /* LayerOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = BA5175C713789735008BFCBF /* LayerOffset.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 */; };
                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>"; };
+               BA5175C713789735008BFCBF /* LayerOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerOffset.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>"; };
                                E134F5AA12EE343F004EC58D /* IntRectHash.h */,
                                B27535470B053814002CE64F /* IntSize.h */,
                                B27535480B053814002CE64F /* IntSizeHash.h */,
+                               BA5175C713789735008BFCBF /* LayerOffset.h */,
                                E4B41E0C0CBF90BD00AF2ECE /* MediaPlayer.cpp */,
                                E4B41E0D0CBF90BD00AF2ECE /* MediaPlayer.h */,
                                079F5E4B0F3BEBEA005E0782 /* MediaPlayerPrivate.h */,
                                977E2E0F12F0FC9C00C13379 /* XSSFilter.h in Headers */,
                                37AFFDF71370A0B800E895C0 /* SharedBufferCRLFLineReader.h in Headers */,
                                379E371713736A6600B9E919 /* QuotedPrintable.h in Headers */,
+                               BA5175C813789735008BFCBF /* LayerOffset.h in Headers */,
                                FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
index 36f01bf..37a6a0e 100644 (file)
@@ -2261,7 +2261,7 @@ void FrameView::paintScrollCorner(GraphicsContext* context, const IntRect& corne
     }
 
     if (m_scrollCorner) {
-        m_scrollCorner->paintIntoRect(context, cornerRect.x(), cornerRect.y(), cornerRect);
+        m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
         return;
     }
 
diff --git a/Source/WebCore/platform/graphics/LayerOffset.h b/Source/WebCore/platform/graphics/LayerOffset.h
new file mode 100644 (file)
index 0000000..4cd5505
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. 
+ */
+
+#ifndef LayerOffset_h
+#define LayerOffset_h
+
+#include "IntPoint.h"
+#include "IntSize.h"
+
+namespace WebCore {
+
+// LayerOffset represents an offset, in Layer coordinates, from that Layer's origin.
+
+class LayerOffset {
+public:
+    LayerOffset() : m_x(0), m_y(0) { }
+    LayerOffset(int x, int y) : m_x(x), m_y(y) { }
+    LayerOffset(const LayerOffset& other) : m_x(other.m_x), m_y(other.m_y) { }
+    LayerOffset(const IntSize& size) : m_x(size.width()), m_y(size.height()) { }
+    LayerOffset(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
+
+    int x() const { return m_x; }
+    int y() const { return m_y; }
+
+    void setX(int x) { m_x = x; }
+    void setY(int y) { m_y = y; }
+
+    IntSize toSize() const { return IntSize(m_x, m_y); }
+    IntPoint toPoint() const { return IntPoint(m_x, m_y); }
+
+private:
+    int m_x;
+    int m_y;
+};
+
+inline LayerOffset& operator+=(LayerOffset& a, const LayerOffset& b)
+{
+    a.setX(a.x() + b.x());
+    a.setY(a.y() + b.y());
+    return a;
+}
+
+inline LayerOffset& operator+=(LayerOffset& a, const IntSize& b)
+{
+    a.setX(a.x() + b.width());
+    a.setY(a.y() + b.height());
+    return a;
+}
+
+inline LayerOffset& operator+=(LayerOffset& a, const IntPoint& b)
+{
+    a.setX(a.x() + b.x());
+    a.setY(a.y() + b.y());
+    return a;
+}
+    
+inline LayerOffset& operator-=(LayerOffset& a, const LayerOffset& b)
+{
+    a.setX(a.x() - b.x());
+    a.setY(a.y() - b.y());
+    return a;
+}
+
+inline LayerOffset& operator-=(LayerOffset& a, const IntSize& b)
+{
+    a.setX(a.x() - b.width());
+    a.setY(a.y() - b.height());
+    return a;
+}
+
+inline LayerOffset& operator-=(LayerOffset& a, const IntPoint& b)
+{
+    a.setX(a.x() - b.x());
+    a.setY(a.y() - b.y());
+    return a;
+}
+    
+inline LayerOffset operator+(const LayerOffset& a, const LayerOffset& b)
+{
+    return LayerOffset(a.x() + b.x(), a.y() + b.y());
+}
+
+inline IntSize operator+(const IntSize& a, const LayerOffset& b)
+{
+    return IntSize(a.width() + b.x(), a.height() + b.y());
+}
+
+inline IntPoint operator+(const IntPoint& a, const LayerOffset& b)
+{
+    return IntPoint(a.x() + b.x(), a.y() + b.y());
+}
+
+inline LayerOffset operator-(const LayerOffset& a, const LayerOffset& b)
+{
+    return LayerOffset(a.x() - b.x(), a.y() - b.y());
+}
+
+inline IntSize operator-(const IntSize& a, const LayerOffset& b)
+{
+    return IntSize(a.width() - b.x(), a.height() - b.y());
+}
+
+inline IntPoint operator-(const IntPoint& a, const LayerOffset& b)
+{
+    return IntPoint(a.x() - b.x(), a.y() - b.y());
+}
+    
+inline LayerOffset operator-(const LayerOffset& layerOffset)
+{
+    return LayerOffset(-layerOffset.x(), -layerOffset.y());
+}
+    
+inline bool operator==(const LayerOffset& a, const LayerOffset& b)
+{
+    return a.x() == b.x() && a.y() == b.y();
+}
+    
+inline bool operator!=(const LayerOffset& a, const LayerOffset& b)
+{
+    return a.x() != b.x() || a.y() != b.y();
+}
+
+} // namespace WebCore
+
+#endif // LayerOffset_h
index 89b9ace..defe6b4 100644 (file)
@@ -546,7 +546,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty, int /*lineTop*/,
 #if PLATFORM(MAC)
         // Custom highlighters go behind everything else.
         if (styleToUse->highlight() != nullAtom && !context->paintingDisabled())
-            paintCustomHighlight(tx, ty, styleToUse->highlight());
+            paintCustomHighlight(LayerOffset(tx, ty), styleToUse->highlight());
 #endif
 
         if (containsComposition && !useCustomUnderlines)
@@ -857,7 +857,7 @@ void InlineTextBox::paintCompositionBackground(GraphicsContext* context, const F
 
 #if PLATFORM(MAC)
 
-void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& type)
+void InlineTextBox::paintCustomHighlight(LayerOffset layerOffset, const AtomicString& type)
 {
     Frame* frame = renderer()->frame();
     if (!frame)
@@ -867,8 +867,8 @@ void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& typ
         return;
 
     RootInlineBox* r = root();
-    FloatRect rootRect(tx + r->x(), ty + selectionTop(), r->logicalWidth(), selectionHeight());
-    FloatRect textRect(tx + x(), rootRect.y(), logicalWidth(), rootRect.height());
+    FloatRect rootRect(layerOffset.x() + r->x(), layerOffset.y() + selectionTop(), r->logicalWidth(), selectionHeight());
+    FloatRect textRect(layerOffset.x() + x(), rootRect.y(), logicalWidth(), rootRect.height());
 
     page->chrome()->client()->paintCustomHighlight(renderer()->node(), type, textRect, rootRect, true, false);
 }
index 4b5b0e1..f9aa712 100644 (file)
@@ -165,7 +165,7 @@ protected:
     void paintDocumentMarkers(GraphicsContext*, const FloatPoint& boxOrigin, RenderStyle*, const Font&, bool background);
     void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&);
 #if PLATFORM(MAC)
-    void paintCustomHighlight(int tx, int ty, const AtomicString& type);
+    void paintCustomHighlight(LayerOffset, const AtomicString& type);
 #endif
 
 private:
index a0aa3c3..1932bc1 100644 (file)
@@ -1077,7 +1077,7 @@ bool RenderBox::repaintLayerRectsForImage(WrappedImagePtr image, const FillLayer
 
 #if PLATFORM(MAC)
 
-void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText)
+void RenderBox::paintCustomHighlight(LayerOffset layoutOffset, const AtomicString& type, bool behindText)
 {
     Frame* frame = this->frame();
     if (!frame)
@@ -1089,11 +1089,11 @@ void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, b
     InlineBox* boxWrap = inlineBoxWrapper();
     RootInlineBox* r = boxWrap ? boxWrap->root() : 0;
     if (r) {
-        FloatRect rootRect(tx + r->x(), ty + r->selectionTop(), r->logicalWidth(), r->selectionHeight());
-        FloatRect imageRect(tx + x(), rootRect.y(), width(), rootRect.height());
+        FloatRect rootRect(layoutOffset.x() + r->x(), layoutOffset.y() + r->selectionTop(), r->logicalWidth(), r->selectionHeight());
+        FloatRect imageRect(location() + layoutOffset, IntSize(width(), rootRect.height()));
         page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false);
     } else {
-        FloatRect imageRect(tx + x(), ty + y(), width(), height());
+        FloatRect imageRect(location() + layoutOffset, IntSize(width(), height()));
         page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, imageRect, behindText, false);
     }
 }
index 258f213..44488f7 100644 (file)
@@ -412,7 +412,7 @@ protected:
     void paintMaskImages(const PaintInfo&, int tx, int ty, int width, int height);
 
 #if PLATFORM(MAC)
-    void paintCustomHighlight(int tx, int ty, const AtomicString& type, bool behindText);
+    void paintCustomHighlight(LayerOffset, const AtomicString& type, bool behindText);
 #endif
 
     void computePositionedLogicalWidth();
index 33521ed..6145e2b 100644 (file)
@@ -302,7 +302,7 @@ void RenderImage::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
 
 #if PLATFORM(MAC)
         if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
-            paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
+            paintCustomHighlight(LayerOffset(tx - x(), ty - y()), style()->highlight(), true);
 #endif
 
         IntSize contentSize(cWidth, cHeight);
index 6c75f6c..10b3e30 100644 (file)
@@ -2310,7 +2310,7 @@ void RenderLayer::paintScrollCorner(GraphicsContext* context, int tx, int ty, co
     }
 
     if (m_scrollCorner) {
-        m_scrollCorner->paintIntoRect(context, tx, ty, absRect);
+        m_scrollCorner->paintIntoRect(context, LayerOffset(tx, ty), absRect);
         return;
     }
 
@@ -2339,7 +2339,7 @@ void RenderLayer::paintResizer(GraphicsContext* context, int tx, int ty, const I
     }
     
     if (m_resizer) {
-        m_resizer->paintIntoRect(context, tx, ty, absRect);
+        m_resizer->paintIntoRect(context, LayerOffset(tx, ty), absRect);
         return;
     }
 
index 4d3b660..2f035ea 100644 (file)
@@ -1128,7 +1128,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
     if (isImage()) {
 #if PLATFORM(MAC)
         if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
-            paintCustomHighlight(tx, ty, style()->highlight(), true);
+            paintCustomHighlight(LayerOffset(tx, ty), style()->highlight(), true);
 #endif
         context->drawImage(m_image->image(this, marker.size()).get(), style()->colorSpace(), marker);
         if (selectionState() != SelectionNone) {
@@ -1142,7 +1142,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
 #if PLATFORM(MAC)
     // FIXME: paint gap between marker and list item proper
     if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
-        paintCustomHighlight(tx, ty, style()->highlight(), true);
+        paintCustomHighlight(LayerOffset(tx, ty), style()->highlight(), true);
 #endif
 
     if (selectionState() != SelectionNone) {
index c09a995..efed581 100644 (file)
@@ -30,6 +30,7 @@
 #include "Document.h"
 #include "Element.h"
 #include "FloatQuad.h"
+#include "LayerOffset.h"
 #include "PaintPhase.h"
 #include "RenderObjectChildList.h"
 #include "RenderStyle.h"
index 962024c..a75d732 100644 (file)
@@ -275,7 +275,7 @@ void RenderScrollbar::paintPart(GraphicsContext* graphicsContext, ScrollbarPart
     RenderScrollbarPart* partRenderer = m_parts.get(partType);
     if (!partRenderer)
         return;
-    partRenderer->paintIntoRect(graphicsContext, x(), y(), rect);
+    partRenderer->paintIntoRect(graphicsContext, pos(), rect);
 }
 
 IntRect RenderScrollbar::buttonRect(ScrollbarPart partType)
index 9cf55fc..473504c 100644 (file)
@@ -159,10 +159,10 @@ void RenderScrollbarPart::imageChanged(WrappedImagePtr image, const IntRect* rec
     }
 }
 
-void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx, int ty, const IntRect& rect)
+void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, LayerOffset layerOffset, const IntRect& rect)
 {
     // Make sure our dimensions match the rect.
-    setLocation(rect.x() - tx, rect.y() - ty);
+    setLocation(rect.location() - layerOffset.toSize());
     setWidth(rect.width());
     setHeight(rect.height());
 
@@ -171,15 +171,15 @@ void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx
 
     // Now do the paint.
     PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0);
-    paint(paintInfo, tx, ty);
+    paint(paintInfo, layerOffset.x(), layerOffset.y());
     paintInfo.phase = PaintPhaseChildBlockBackgrounds;
-    paint(paintInfo, tx, ty);
+    paint(paintInfo, layerOffset.x(), layerOffset.y());
     paintInfo.phase = PaintPhaseFloat;
-    paint(paintInfo, tx, ty);
+    paint(paintInfo, layerOffset.x(), layerOffset.y());
     paintInfo.phase = PaintPhaseForeground;
-    paint(paintInfo, tx, ty);
+    paint(paintInfo, layerOffset.x(), layerOffset.y());
     paintInfo.phase = PaintPhaseOutline;
-    paint(paintInfo, tx, ty);
+    paint(paintInfo, layerOffset.x(), layerOffset.y());
 }
 
 }
index 24485d0..1153d1e 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef RenderScrollbarPart_h
 #define RenderScrollbarPart_h
 
+#include "LayerOffset.h"
 #include "RenderBlock.h"
 #include "ScrollTypes.h"
 
@@ -45,7 +46,7 @@ public:
     virtual void layout();
     virtual void computePreferredLogicalWidths();
     
-    void paintIntoRect(GraphicsContext*, int tx, int ty, const IntRect&);
+    void paintIntoRect(GraphicsContext*, LayerOffset, const IntRect&);
     
 protected:
     virtual void styleWillChange(StyleDifference diff, const RenderStyle* newStyle);
index 74ac33b..82d4a72 100644 (file)
@@ -480,7 +480,7 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty)
         paintBoxDecorations(paintInfo, tx, ty);
 
     if (paintPhase == PaintPhaseMask) {
-        paintMask(paintInfo, tx, ty);
+        paintMask(paintInfo, LayerOffset(tx, ty));
         return;
     }
 
@@ -573,12 +573,12 @@ void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
         paintBorder(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style());
 }
 
-void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)
+void RenderTable::paintMask(PaintInfo& paintInfo, LayerOffset layerOffset)
 {
     if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask)
         return;
 
-    IntRect rect(tx, ty, width(), height());
+    IntRect rect(layerOffset.toPoint(), IntSize(width(), height()));
     subtractCaptionRect(rect);
 
     paintMaskImages(paintInfo, rect.x(), rect.y(), rect.width(), rect.height());
index 01fbca7..a88afd7 100644 (file)
@@ -217,7 +217,7 @@ private:
     virtual void paint(PaintInfo&, int tx, int ty);
     virtual void paintObject(PaintInfo&, int tx, int ty);
     virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
-    virtual void paintMask(PaintInfo&, int tx, int ty);
+    virtual void paintMask(PaintInfo&, LayerOffset);
     virtual void layout();
     virtual void computePreferredLogicalWidths();
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int xPos, int yPos, int tx, int ty, HitTestAction);
index 894d689..83159b0 100644 (file)
@@ -267,7 +267,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
 
 #if PLATFORM(MAC)
     if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
-        paintCustomHighlight(tx - x(), ty - y(), style()->highlight(), true);
+        paintCustomHighlight(LayerOffset(tx - x(), ty - y()), style()->highlight(), true);
 #endif
 
     if (style()->hasBorderRadius()) {
index 32d6433..6e96dc7 100644 (file)
@@ -157,7 +157,7 @@ void RootInlineBox::addHighlightOverflow()
     setOverflowFromLogicalRects(inflatedRect, inflatedRect, lineTop(), lineBottom());
 }
 
-void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType)
+void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, LayerOffset layerOffset, const AtomicString& highlightType)
 {
     if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground)
         return;
@@ -170,7 +170,7 @@ void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, c
         return;
 
     // Get the inflated rect so that we can properly hit test.
-    FloatRect rootRect(tx + x(), ty + selectionTop(), logicalWidth(), selectionHeight());
+    FloatRect rootRect(layerOffset.x() + x(), layerOffset.y() + selectionTop(), logicalWidth(), selectionHeight());
     FloatRect inflatedRect = page->chrome()->client()->customHighlightRect(renderer()->node(), highlightType, rootRect);
     if (inflatedRect.intersects(paintInfo.rect))
         page->chrome()->client()->paintCustomHighlight(renderer()->node(), highlightType, rootRect, rootRect, false, true);
@@ -185,7 +185,7 @@ void RootInlineBox::paint(PaintInfo& paintInfo, int tx, int ty, int lineTop, int
 #if PLATFORM(MAC)
     RenderStyle* styleToUse = renderer()->style(m_firstLine);
     if (styleToUse->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
-        paintCustomHighlight(paintInfo, tx, ty, styleToUse->highlight());
+        paintCustomHighlight(paintInfo, LayerOffset(tx, ty), styleToUse->highlight());
 #endif
 }
 
index 575a10d..f9625d5 100644 (file)
@@ -92,7 +92,7 @@ public:
 
 #if PLATFORM(MAC)
     void addHighlightOverflow();
-    void paintCustomHighlight(PaintInfo&, int tx, int ty, const AtomicString& highlightType);
+    void paintCustomHighlight(PaintInfo&, LayerOffset, const AtomicString& highlightType);
 #endif
 
     virtual void paint(PaintInfo&, int tx, int ty, int lineTop, int lineBottom);