Changeset 86195 in webkit
- Timestamp:
- May 10, 2011 4:45:03 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86193 r86195 1 2011-05-10 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Create LayerOffset class 6 https://bugs.webkit.org/show_bug.cgi?id=60490 7 8 Adding a LayerOffset class that will replace existing usage of tx/ty. 9 LayerOffset is necessary since these values are commonly used as both 10 a size and a point. Updating paintIntoRect to use this new class. 11 12 No new tests since this doesn't change any behavior. 13 14 * GNUmakefile.list.am: 15 * WebCore.gypi: 16 * WebCore.pro: 17 * WebCore.vcproj/WebCore.vcproj: 18 * WebCore.xcodeproj/project.pbxproj: 19 * page/FrameView.cpp: 20 (WebCore::FrameView::paintScrollCorner): 21 * platform/graphics/LayerOffset.h: Added. 22 (WebCore::LayerOffset::LayerOffset): 23 (WebCore::LayerOffset::x): 24 (WebCore::LayerOffset::y): 25 (WebCore::LayerOffset::setX): 26 (WebCore::LayerOffset::setY): 27 (WebCore::LayerOffset::toSize): 28 (WebCore::LayerOffset::toPoint): 29 (WebCore::operator+=): 30 (WebCore::operator-=): 31 (WebCore::operator+): 32 (WebCore::operator-): 33 (WebCore::operator==): 34 (WebCore::operator!=): 35 * rendering/RenderLayer.cpp: 36 (WebCore::RenderLayer::paintScrollCorner): 37 (WebCore::RenderLayer::paintResizer): 38 * rendering/RenderScrollbar.cpp: 39 (WebCore::RenderScrollbar::paintPart): 40 * rendering/RenderScrollbarPart.cpp: 41 (WebCore::RenderScrollbarPart::paintIntoRect): 42 * rendering/RenderScrollbarPart.h: 43 1 44 2011-05-10 Ryosuke Niwa <rniwa@webkit.org> 2 45 -
trunk/Source/WebCore/GNUmakefile.list.am
r86177 r86195 2440 2440 Source/WebCore/platform/graphics/IntSize.h \ 2441 2441 Source/WebCore/platform/graphics/IntSizeHash.h \ 2442 Source/WebCore/platform/graphics/LayerOffset.h \ 2442 2443 Source/WebCore/platform/graphics/MediaPlayer.cpp \ 2443 2444 Source/WebCore/platform/graphics/MediaPlayer.h \ -
trunk/Source/WebCore/WebCore.gypi
r86128 r86195 849 849 'platform/graphics/IntSize.h', 850 850 'platform/graphics/IntSizeHash.h', 851 'platform/graphics/LayerOffset.h', 851 852 'platform/graphics/MediaPlayer.h', 852 853 'platform/graphics/Path.h', -
trunk/Source/WebCore/WebCore.pro
r86152 r86195 1952 1952 platform/graphics/IntPointHash.h \ 1953 1953 platform/graphics/IntRect.h \ 1954 platform/graphics/LayerOffset.h \ 1954 1955 platform/graphics/MediaPlayer.h \ 1955 1956 platform/graphics/Path.h \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r86128 r86195 26918 26918 </File> 26919 26919 <File 26920 RelativePath="..\platform\graphics\LayerOffset.h" 26921 > 26922 </File> 26923 <File 26920 26924 RelativePath="..\platform\graphics\MediaPlayer.cpp" 26921 26925 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r86128 r86195 4799 4799 B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */; }; 4800 4800 B8DBDB4E130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */; }; 4801 BA5175C813789735008BFCBF /* LayerOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = BA5175C713789735008BFCBF /* LayerOffset.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4801 4802 BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; }; 4802 4803 BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; }; … … 11208 11209 B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellingCorrectionCommand.cpp; sourceTree = "<group>"; }; 11209 11210 B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpellingCorrectionCommand.h; sourceTree = "<group>"; }; 11211 BA5175C713789735008BFCBF /* LayerOffset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerOffset.h; sourceTree = "<group>"; }; 11210 11212 BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; }; 11211 11213 BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; }; … … 17683 17685 B27535470B053814002CE64F /* IntSize.h */, 17684 17686 B27535480B053814002CE64F /* IntSizeHash.h */, 17687 BA5175C713789735008BFCBF /* LayerOffset.h */, 17685 17688 E4B41E0C0CBF90BD00AF2ECE /* MediaPlayer.cpp */, 17686 17689 E4B41E0D0CBF90BD00AF2ECE /* MediaPlayer.h */, … … 22749 22752 37AFFDF71370A0B800E895C0 /* SharedBufferCRLFLineReader.h in Headers */, 22750 22753 379E371713736A6600B9E919 /* QuotedPrintable.h in Headers */, 22754 BA5175C813789735008BFCBF /* LayerOffset.h in Headers */, 22751 22755 FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */, 22752 22756 ); -
trunk/Source/WebCore/page/FrameView.cpp
r86184 r86195 2262 2262 2263 2263 if (m_scrollCorner) { 2264 m_scrollCorner->paintIntoRect(context, cornerRect. x(), cornerRect.y(), cornerRect);2264 m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect); 2265 2265 return; 2266 2266 } -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r85512 r86195 547 547 // Custom highlighters go behind everything else. 548 548 if (styleToUse->highlight() != nullAtom && !context->paintingDisabled()) 549 paintCustomHighlight( tx, ty, styleToUse->highlight());549 paintCustomHighlight(LayerOffset(tx, ty), styleToUse->highlight()); 550 550 #endif 551 551 … … 858 858 #if PLATFORM(MAC) 859 859 860 void InlineTextBox::paintCustomHighlight( int tx, int ty, const AtomicString& type)860 void InlineTextBox::paintCustomHighlight(LayerOffset layerOffset, const AtomicString& type) 861 861 { 862 862 Frame* frame = renderer()->frame(); … … 868 868 869 869 RootInlineBox* r = root(); 870 FloatRect rootRect( tx + r->x(), ty+ selectionTop(), r->logicalWidth(), selectionHeight());871 FloatRect textRect( tx+ x(), rootRect.y(), logicalWidth(), rootRect.height());870 FloatRect rootRect(layerOffset.x() + r->x(), layerOffset.y() + selectionTop(), r->logicalWidth(), selectionHeight()); 871 FloatRect textRect(layerOffset.x() + x(), rootRect.y(), logicalWidth(), rootRect.height()); 872 872 873 873 page->chrome()->client()->paintCustomHighlight(renderer()->node(), type, textRect, rootRect, true, false); -
trunk/Source/WebCore/rendering/InlineTextBox.h
r86028 r86195 166 166 void paintCompositionUnderline(GraphicsContext*, const FloatPoint& boxOrigin, const CompositionUnderline&); 167 167 #if PLATFORM(MAC) 168 void paintCustomHighlight( int tx, int ty, const AtomicString& type);168 void paintCustomHighlight(LayerOffset, const AtomicString& type); 169 169 #endif 170 170 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r86188 r86195 1078 1078 #if PLATFORM(MAC) 1079 1079 1080 void RenderBox::paintCustomHighlight( int tx, int ty, const AtomicString& type, bool behindText)1080 void RenderBox::paintCustomHighlight(LayerOffset layoutOffset, const AtomicString& type, bool behindText) 1081 1081 { 1082 1082 Frame* frame = this->frame(); … … 1090 1090 RootInlineBox* r = boxWrap ? boxWrap->root() : 0; 1091 1091 if (r) { 1092 FloatRect rootRect( tx + r->x(), ty+ r->selectionTop(), r->logicalWidth(), r->selectionHeight());1093 FloatRect imageRect( tx + x(), rootRect.y(), width(), rootRect.height());1092 FloatRect rootRect(layoutOffset.x() + r->x(), layoutOffset.y() + r->selectionTop(), r->logicalWidth(), r->selectionHeight()); 1093 FloatRect imageRect(location() + layoutOffset, IntSize(width(), rootRect.height())); 1094 1094 page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, rootRect, behindText, false); 1095 1095 } else { 1096 FloatRect imageRect( tx + x(), ty + y(), width(), height());1096 FloatRect imageRect(location() + layoutOffset, IntSize(width(), height())); 1097 1097 page->chrome()->client()->paintCustomHighlight(node(), type, imageRect, imageRect, behindText, false); 1098 1098 } -
trunk/Source/WebCore/rendering/RenderBox.h
r84341 r86195 413 413 414 414 #if PLATFORM(MAC) 415 void paintCustomHighlight( int tx, int ty, const AtomicString& type, bool behindText);415 void paintCustomHighlight(LayerOffset, const AtomicString& type, bool behindText); 416 416 #endif 417 417 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r85864 r86195 303 303 #if PLATFORM(MAC) 304 304 if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 305 paintCustomHighlight( tx - x(), ty - y(), style()->highlight(), true);305 paintCustomHighlight(LayerOffset(tx - x(), ty - y()), style()->highlight(), true); 306 306 #endif 307 307 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r85990 r86195 2311 2311 2312 2312 if (m_scrollCorner) { 2313 m_scrollCorner->paintIntoRect(context, tx, ty, absRect);2313 m_scrollCorner->paintIntoRect(context, LayerOffset(tx, ty), absRect); 2314 2314 return; 2315 2315 } … … 2340 2340 2341 2341 if (m_resizer) { 2342 m_resizer->paintIntoRect(context, tx, ty, absRect);2342 m_resizer->paintIntoRect(context, LayerOffset(tx, ty), absRect); 2343 2343 return; 2344 2344 } -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r84504 r86195 1129 1129 #if PLATFORM(MAC) 1130 1130 if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 1131 paintCustomHighlight( tx, ty, style()->highlight(), true);1131 paintCustomHighlight(LayerOffset(tx, ty), style()->highlight(), true); 1132 1132 #endif 1133 1133 context->drawImage(m_image->image(this, marker.size()).get(), style()->colorSpace(), marker); … … 1143 1143 // FIXME: paint gap between marker and list item proper 1144 1144 if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 1145 paintCustomHighlight( tx, ty, style()->highlight(), true);1145 paintCustomHighlight(LayerOffset(tx, ty), style()->highlight(), true); 1146 1146 #endif 1147 1147 -
trunk/Source/WebCore/rendering/RenderObject.h
r86128 r86195 31 31 #include "Element.h" 32 32 #include "FloatQuad.h" 33 #include "LayerOffset.h" 33 34 #include "PaintPhase.h" 34 35 #include "RenderObjectChildList.h" -
trunk/Source/WebCore/rendering/RenderScrollbar.cpp
r84538 r86195 276 276 if (!partRenderer) 277 277 return; 278 partRenderer->paintIntoRect(graphicsContext, x(), y(), rect);278 partRenderer->paintIntoRect(graphicsContext, pos(), rect); 279 279 } 280 280 -
trunk/Source/WebCore/rendering/RenderScrollbarPart.cpp
r75837 r86195 160 160 } 161 161 162 void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx, int ty, const IntRect& rect)162 void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, LayerOffset layerOffset, const IntRect& rect) 163 163 { 164 164 // Make sure our dimensions match the rect. 165 setLocation(rect. x() - tx, rect.y() - ty);165 setLocation(rect.location() - layerOffset.toSize()); 166 166 setWidth(rect.width()); 167 167 setHeight(rect.height()); … … 172 172 // Now do the paint. 173 173 PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0); 174 paint(paintInfo, tx, ty);174 paint(paintInfo, layerOffset.x(), layerOffset.y()); 175 175 paintInfo.phase = PaintPhaseChildBlockBackgrounds; 176 paint(paintInfo, tx, ty);176 paint(paintInfo, layerOffset.x(), layerOffset.y()); 177 177 paintInfo.phase = PaintPhaseFloat; 178 paint(paintInfo, tx, ty);178 paint(paintInfo, layerOffset.x(), layerOffset.y()); 179 179 paintInfo.phase = PaintPhaseForeground; 180 paint(paintInfo, tx, ty);180 paint(paintInfo, layerOffset.x(), layerOffset.y()); 181 181 paintInfo.phase = PaintPhaseOutline; 182 paint(paintInfo, tx, ty);182 paint(paintInfo, layerOffset.x(), layerOffset.y()); 183 183 } 184 184 -
trunk/Source/WebCore/rendering/RenderScrollbarPart.h
r68276 r86195 27 27 #define RenderScrollbarPart_h 28 28 29 #include "LayerOffset.h" 29 30 #include "RenderBlock.h" 30 31 #include "ScrollTypes.h" … … 46 47 virtual void computePreferredLogicalWidths(); 47 48 48 void paintIntoRect(GraphicsContext*, int tx, int ty, const IntRect&);49 void paintIntoRect(GraphicsContext*, LayerOffset, const IntRect&); 49 50 50 51 protected: -
trunk/Source/WebCore/rendering/RenderTable.cpp
r85355 r86195 481 481 482 482 if (paintPhase == PaintPhaseMask) { 483 paintMask(paintInfo, tx, ty);483 paintMask(paintInfo, LayerOffset(tx, ty)); 484 484 return; 485 485 } … … 574 574 } 575 575 576 void RenderTable::paintMask(PaintInfo& paintInfo, int tx, int ty)576 void RenderTable::paintMask(PaintInfo& paintInfo, LayerOffset layerOffset) 577 577 { 578 578 if (style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseMask) 579 579 return; 580 580 581 IntRect rect( tx, ty, width(), height());581 IntRect rect(layerOffset.toPoint(), IntSize(width(), height())); 582 582 subtractCaptionRect(rect); 583 583 -
trunk/Source/WebCore/rendering/RenderTable.h
r85355 r86195 218 218 virtual void paintObject(PaintInfo&, int tx, int ty); 219 219 virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); 220 virtual void paintMask(PaintInfo&, int tx, int ty);220 virtual void paintMask(PaintInfo&, LayerOffset); 221 221 virtual void layout(); 222 222 virtual void computePreferredLogicalWidths(); -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r84143 r86195 268 268 #if PLATFORM(MAC) 269 269 if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 270 paintCustomHighlight( tx - x(), ty - y(), style()->highlight(), true);270 paintCustomHighlight(LayerOffset(tx - x(), ty - y()), style()->highlight(), true); 271 271 #endif 272 272 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r85512 r86195 158 158 } 159 159 160 void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, int tx, int ty, const AtomicString& highlightType)160 void RootInlineBox::paintCustomHighlight(PaintInfo& paintInfo, LayerOffset layerOffset, const AtomicString& highlightType) 161 161 { 162 162 if (!paintInfo.shouldPaintWithinRoot(renderer()) || renderer()->style()->visibility() != VISIBLE || paintInfo.phase != PaintPhaseForeground) … … 171 171 172 172 // Get the inflated rect so that we can properly hit test. 173 FloatRect rootRect( tx + x(), ty+ selectionTop(), logicalWidth(), selectionHeight());173 FloatRect rootRect(layerOffset.x() + x(), layerOffset.y() + selectionTop(), logicalWidth(), selectionHeight()); 174 174 FloatRect inflatedRect = page->chrome()->client()->customHighlightRect(renderer()->node(), highlightType, rootRect); 175 175 if (inflatedRect.intersects(paintInfo.rect)) … … 186 186 RenderStyle* styleToUse = renderer()->style(m_firstLine); 187 187 if (styleToUse->highlight() != nullAtom && !paintInfo.context->paintingDisabled()) 188 paintCustomHighlight(paintInfo, tx, ty, styleToUse->highlight());188 paintCustomHighlight(paintInfo, LayerOffset(tx, ty), styleToUse->highlight()); 189 189 #endif 190 190 } -
trunk/Source/WebCore/rendering/RootInlineBox.h
r85512 r86195 93 93 #if PLATFORM(MAC) 94 94 void addHighlightOverflow(); 95 void paintCustomHighlight(PaintInfo&, int tx, int ty, const AtomicString& highlightType);95 void paintCustomHighlight(PaintInfo&, LayerOffset, const AtomicString& highlightType); 96 96 #endif 97 97
Note: See TracChangeset
for help on using the changeset viewer.