Diff
Modified: trunk/Source/WebCore/ChangeLog (88049 => 88050)
--- trunk/Source/WebCore/ChangeLog 2011-06-03 20:55:44 UTC (rev 88049)
+++ trunk/Source/WebCore/ChangeLog 2011-06-03 20:57:43 UTC (rev 88050)
@@ -2,6 +2,30 @@
Reviewed by Eric Seidel.
+ Switch paintCaret and paintDragCaret to use IntPoint
+ https://bugs.webkit.org/show_bug.cgi?id=62037
+
+ Switching paintCaret and paintDragCaret to use an IntPoint representing
+ the paint offset instead of a pair of ints.
+
+ No new tests since this is simple refactoring.
+
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::paintCaret):
+ (WebCore::CaretBase::paintCaret):
+ (WebCore::DragCaretController::paintDragCaret):
+ * editing/FrameSelection.h:
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintCaret):
+ (WebCore::RenderBlock::paintObject):
+ (WebCore::RenderBlock::positionForPoint):
+ (WebCore::RenderBlock::offsetForContents):
+ * rendering/RenderBlock.h:
+
+2011-06-03 Levi Weintraub <[email protected]>
+
+ Reviewed by Eric Seidel.
+
Switch paintItemForeground and paintItemForeground to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62035
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (88049 => 88050)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2011-06-03 20:55:44 UTC (rev 88049)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2011-06-03 20:57:43 UTC (rev 88050)
@@ -1259,13 +1259,13 @@
}
}
-void FrameSelection::paintCaret(GraphicsContext* context, int tx, int ty, const IntRect& clipRect)
+void FrameSelection::paintCaret(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& clipRect)
{
if (m_selection.isCaret() && m_caretPaint)
- CaretBase::paintCaret(m_selection.start().deprecatedNode(), context, tx, ty, clipRect);
+ CaretBase::paintCaret(m_selection.start().deprecatedNode(), context, paintOffset, clipRect);
}
-void CaretBase::paintCaret(Node* node, GraphicsContext* context, int tx, int ty, const IntRect& clipRect) const
+void CaretBase::paintCaret(Node* node, GraphicsContext* context, const IntPoint& paintOffset, const IntRect& clipRect) const
{
#if ENABLE(TEXT_CARET)
if (m_caretVisibility == Hidden)
@@ -1275,7 +1275,7 @@
RenderObject* renderer = caretRenderer(node);
if (renderer && renderer->isBox())
toRenderBox(renderer)->flipForWritingMode(drawingRect);
- drawingRect.move(tx, ty);
+ drawingRect.moveBy(paintOffset);
IntRect caret = intersection(drawingRect, clipRect);
if (caret.isEmpty())
return;
@@ -1292,8 +1292,7 @@
#else
UNUSED_PARAM(node);
UNUSED_PARAM(context);
- UNUSED_PARAM(tx);
- UNUSED_PARAM(ty);
+ UNUSED_PARAM(paintOffset);
UNUSED_PARAM(clipRect);
#endif
}
@@ -1768,16 +1767,15 @@
m_frame->page()->focusController()->setFocusedNode(0, m_frame);
}
-void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, int tx, int ty, const IntRect& clipRect) const
+void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const IntPoint& paintOffset, const IntRect& clipRect) const
{
#if ENABLE(TEXT_CARET)
if (m_position.deepEquivalent().deprecatedNode()->document()->frame() == frame)
- paintCaret(m_position.deepEquivalent().deprecatedNode(), p, tx, ty, clipRect);
+ paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset, clipRect);
#else
UNUSED_PARAM(frame);
UNUSED_PARAM(p);
- UNUSED_PARAM(tx);
- UNUSED_PARAM(ty);
+ UNUSED_PARAM(paintOffset);
UNUSED_PARAM(clipRect);
#endif
}
Modified: trunk/Source/WebCore/editing/FrameSelection.h (88049 => 88050)
--- trunk/Source/WebCore/editing/FrameSelection.h 2011-06-03 20:55:44 UTC (rev 88049)
+++ trunk/Source/WebCore/editing/FrameSelection.h 2011-06-03 20:57:43 UTC (rev 88050)
@@ -61,7 +61,7 @@
IntRect absoluteBoundsForLocalRect(Node*, const IntRect&) const;
IntRect caretRepaintRect(Node*) const;
bool shouldRepaintCaret(const RenderView*, bool isContentEditable) const;
- void paintCaret(Node*, GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
+ void paintCaret(Node*, GraphicsContext*, const IntPoint&, const IntRect& clipRect) const;
RenderObject* caretRenderer(Node*) const;
const IntRect& localCaretRectWithoutUpdate() const { return m_caretLocalRect; }
@@ -86,7 +86,7 @@
DragCaretController();
RenderObject* caretRenderer() const;
- void paintDragCaret(Frame*, GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
+ void paintDragCaret(Frame*, GraphicsContext*, const IntPoint&, const IntRect& clipRect) const;
bool isContentEditable() const { return m_position.rootEditableElement(); }
bool isContentRichlyEditable() const;
@@ -193,7 +193,7 @@
void clearCaretRectIfNeeded();
bool recomputeCaretRect();
void invalidateCaretRect();
- void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect);
+ void paintCaret(GraphicsContext*, const IntPoint&, const IntRect& clipRect);
// Used to suspend caret blinking while the mouse is down.
void setCaretBlinkingSuspended(bool suspended) { m_isCaretBlinkingSuspended = suspended; }
@@ -220,7 +220,7 @@
void setFocusedNodeIfNeeded();
void notifyRendererOfSelectionChange(bool userTriggered);
- void paintDragCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
+ void paintDragCaret(GraphicsContext*, const IntPoint&, const IntRect& clipRect) const;
EditingStyle* typingStyle() const;
PassRefPtr<CSSMutableStyleDeclaration> copyTypingStyle() const;
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (88049 => 88050)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-06-03 20:55:44 UTC (rev 88049)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-06-03 20:57:43 UTC (rev 88050)
@@ -2431,7 +2431,7 @@
}
}
-void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType type)
+void RenderBlock::paintCaret(PaintInfo& paintInfo, const IntPoint& paintOffset, CaretType type)
{
// Paint the caret if the FrameSelection says so or if caret browsing is enabled
bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled();
@@ -2448,12 +2448,13 @@
if (caretPainter == this && (isContentEditable || caretBrowsing)) {
// Convert the painting offset into the local coordinate system of this renderer,
// to match the localCaretRect computed by the FrameSelection
- offsetForContents(tx, ty);
+ IntPoint adjustedPaintOffset = paintOffset;
+ offsetForContents(adjustedPaintOffset);
if (type == CursorCaret)
- frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect);
+ frame()->selection()->paintCaret(paintInfo.context, adjustedPaintOffset, paintInfo.rect);
else
- frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, tx, ty, paintInfo.rect);
+ frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, adjustedPaintOffset, paintInfo.rect);
}
}
@@ -2541,8 +2542,8 @@
// If the caret's node's render object's containing block is this block, and the paint action is PaintPhaseForeground,
// then paint the caret.
if (paintPhase == PaintPhaseForeground) {
- paintCaret(paintInfo, scrolledX, scrolledY, CursorCaret);
- paintCaret(paintInfo, scrolledX, scrolledY, DragCaret);
+ paintCaret(paintInfo, IntPoint(scrolledX, scrolledY), CursorCaret);
+ paintCaret(paintInfo, IntPoint(scrolledX, scrolledY), DragCaret);
}
}
@@ -4188,10 +4189,8 @@
return createVisiblePosition(caretMaxOffset(), DOWNSTREAM);
}
- int contentsX = point.x();
- int contentsY = point.y();
- offsetForContents(contentsX, contentsY);
- IntPoint pointInContents(contentsX, contentsY);
+ IntPoint pointInContents = point;
+ offsetForContents(pointInContents);
IntPoint pointInLogicalContents(pointInContents);
if (!isHorizontalWritingMode())
pointInLogicalContents = pointInLogicalContents.transposedPoint();
@@ -4216,18 +4215,13 @@
return RenderBox::positionForPoint(point);
}
-void RenderBlock::offsetForContents(int& tx, int& ty) const
+void RenderBlock::offsetForContents(IntPoint& offset) const
{
- IntPoint contentsPoint(tx, ty);
-
if (hasOverflowClip())
- contentsPoint += layer()->scrolledContentOffset();
+ offset += layer()->scrolledContentOffset();
if (hasColumns())
- adjustPointToColumnContents(contentsPoint);
-
- tx = contentsPoint.x();
- ty = contentsPoint.y();
+ adjustPointToColumnContents(offset);
}
int RenderBlock::availableLogicalWidth() const
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (88049 => 88050)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2011-06-03 20:55:44 UTC (rev 88049)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2011-06-03 20:57:43 UTC (rev 88050)
@@ -566,7 +566,7 @@
void paintChildren(PaintInfo&, int tx, int ty);
void paintEllipsisBoxes(PaintInfo&, int tx, int ty);
void paintSelection(PaintInfo&, int tx, int ty);
- void paintCaret(PaintInfo&, int tx, int ty, CaretType);
+ void paintCaret(PaintInfo&, const IntPoint&, CaretType);
FloatingObject* insertFloatingObject(RenderBox*);
void removeFloatingObject(RenderBox*);
@@ -646,8 +646,8 @@
Position positionForBox(InlineBox*, bool start = true) const;
VisiblePosition positionForPointWithInlineChildren(const IntPoint&);
- // Adjust tx and ty from painting offsets to the local coords of this renderer
- void offsetForContents(int& tx, int& ty) const;
+ // Adjust from painting offsets to the local coords of this renderer
+ void offsetForContents(IntPoint&) const;
void calcColumnWidth();
bool layoutColumns(bool hasSpecifiedPageLogicalHeight, int pageLogicalHeight, LayoutStateMaintainer&);