Changeset 93279 in webkit
- Timestamp:
- Aug 17, 2011 8:38:05 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93278 r93279 1 2011-08-17 Emil A Eklund <eae@chromium.org> 2 3 Switch html/* to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=66347 5 6 Reviewed by Eric Seidel. 7 8 Convert HTML* and shadow element to new layout abstraction as a part of 9 the ongoing conversion work. 10 11 No new tests, no new functionality. 12 13 * html/HTMLAreaElement.cpp: 14 (WebCore::HTMLAreaElement::invalidateCachedRegion): 15 (WebCore::HTMLAreaElement::mapMouseEvent): 16 (WebCore::HTMLAreaElement::computePath): 17 (WebCore::HTMLAreaElement::computeRect): 18 (WebCore::HTMLAreaElement::getRegion): 19 * html/HTMLAreaElement.h: 20 * html/HTMLCanvasElement.cpp: 21 (WebCore::HTMLCanvasElement::paint): 22 * html/HTMLCanvasElement.h: 23 * html/HTMLMapElement.cpp: 24 (WebCore::HTMLMapElement::mapMouseEvent): 25 * html/HTMLMapElement.h: 26 * html/ImageDocument.cpp: 27 (WebCore::ImageDocumentParser::finish): 28 (WebCore::ImageDocument::scale): 29 (WebCore::ImageDocument::resizeImageToFit): 30 (WebCore::ImageDocument::imageFitsInWindow): 31 * html/ValidationMessage.cpp: 32 (WebCore::adjustBubblePosition): 33 * html/canvas/CanvasRenderingContext2D.cpp: 34 (WebCore::size): 35 (WebCore::CanvasRenderingContext2D::drawImage): 36 * html/shadow/MediaControlElements.cpp: 37 (WebCore::MediaControlPanelElement::startDrag): 38 (WebCore::MediaControlPanelElement::continueDrag): 39 (WebCore::MediaControlPanelElement::setPosition): 40 (WebCore::MediaControlPanelElement::defaultEventHandler): 41 * html/shadow/MediaControlElements.h: 42 * html/shadow/SliderThumbElement.cpp: 43 (WebCore::SliderThumbElement::dragFrom): 44 (WebCore::SliderThumbElement::setPositionFromPoint): 45 * html/shadow/SliderThumbElement.h: 46 * rendering/RenderImage.cpp: 47 (WebCore::RenderImage::nodeAtPoint): 48 1 49 2011-08-17 David Grogan <dgrogan@chromium.org> 2 50 -
trunk/Source/WebCore/html/HTMLAreaElement.cpp
r91404 r93279 76 76 void HTMLAreaElement::invalidateCachedRegion() 77 77 { 78 m_lastSize = IntSize(-1, -1);79 } 80 81 bool HTMLAreaElement::mapMouseEvent( int x, int y, const IntSize& size, HitTestResult& result)78 m_lastSize = LayoutSize(-1, -1); 79 } 80 81 bool HTMLAreaElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result) 82 82 { 83 83 if (m_lastSize != size) { … … 86 86 } 87 87 88 if (!m_region->contains( IntPoint(x, y)))88 if (!m_region->contains(location)) 89 89 return false; 90 90 … … 103 103 104 104 // Default should default to the size of the containing object. 105 IntSize size = m_lastSize;105 LayoutSize size = m_lastSize; 106 106 if (m_shape == Default) 107 107 size = obj->absoluteOutlineBounds().size(); … … 119 119 } 120 120 121 IntRect HTMLAreaElement::computeRect(RenderObject* obj) const122 { 123 return enclosing IntRect(computePath(obj).boundingRect());124 } 125 126 Path HTMLAreaElement::getRegion(const IntSize& size) const121 LayoutRect HTMLAreaElement::computeRect(RenderObject* obj) const 122 { 123 return enclosingLayoutRect(computePath(obj).boundingRect()); 124 } 125 126 Path HTMLAreaElement::getRegion(const LayoutSize& size) const 127 127 { 128 128 if (!m_coords && m_shape != Default) 129 129 return Path(); 130 130 131 int width = size.width();132 int height = size.height();131 LayoutUnit width = size.width(); 132 LayoutUnit height = size.height(); 133 133 134 134 // If element omits the shape attribute, select shape based on number of coordinates. -
trunk/Source/WebCore/html/HTMLAreaElement.h
r91404 r93279 25 25 26 26 #include "HTMLAnchorElement.h" 27 #include " IntSize.h"27 #include "LayoutTypes.h" 28 28 #include <wtf/OwnArrayPtr.h> 29 29 … … 40 40 bool isDefault() const { return m_shape == Default; } 41 41 42 bool mapMouseEvent( int x, int y, const IntSize&, HitTestResult&);42 bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&); 43 43 44 IntRect computeRect(RenderObject*) const;44 LayoutRect computeRect(RenderObject*) const; 45 45 Path computePath(RenderObject*) const; 46 46 … … 61 61 62 62 enum Shape { Default, Poly, Rect, Circle, Unknown }; 63 Path getRegion(const IntSize&) const;63 Path getRegion(const LayoutSize&) const; 64 64 void invalidateCachedRegion(); 65 65 … … 67 67 OwnArrayPtr<Length> m_coords; 68 68 int m_coordsLen; 69 IntSize m_lastSize;69 LayoutSize m_lastSize; 70 70 Shape m_shape; 71 71 }; -
trunk/Source/WebCore/html/HTMLCanvasElement.cpp
r93157 r93279 265 265 } 266 266 267 void HTMLCanvasElement::paint(GraphicsContext* context, const IntRect& r, bool useLowQualityScale)267 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r, bool useLowQualityScale) 268 268 { 269 269 // Clear the dirty rect -
trunk/Source/WebCore/html/HTMLCanvasElement.h
r93275 r93279 98 98 void didDraw(const FloatRect&); 99 99 100 void paint(GraphicsContext*, const IntRect&, bool useLowQualityScale = false);100 void paint(GraphicsContext*, const LayoutRect&, bool useLowQualityScale = false); 101 101 102 102 GraphicsContext* drawingContext() const; -
trunk/Source/WebCore/html/HTMLMapElement.cpp
r91404 r93279 59 59 } 60 60 61 bool HTMLMapElement::mapMouseEvent( int x, int y, const IntSize& size, HitTestResult& result)61 bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result) 62 62 { 63 63 HTMLAreaElement* defaultArea = 0; … … 69 69 if (!defaultArea) 70 70 defaultArea = areaElt; 71 } else if (areaElt->mapMouseEvent( x, y, size, result))71 } else if (areaElt->mapMouseEvent(location, size, result)) 72 72 return true; 73 73 } -
trunk/Source/WebCore/html/HTMLMapElement.h
r91404 r93279 28 28 namespace WebCore { 29 29 30 class IntSize;31 30 class HitTestResult; 32 31 class HTMLImageElement; … … 40 39 const AtomicString& getName() const { return m_name; } 41 40 42 bool mapMouseEvent( int x, int y, const IntSize&, HitTestResult&);41 bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&); 43 42 44 43 HTMLImageElement* imageElement(); -
trunk/Source/WebCore/html/ImageDocument.cpp
r88623 r93279 156 156 // Report the natural image size in the page title, regardless of zoom 157 157 // level. 158 IntSize size = cachedImage->imageSize(1.0f);158 LayoutSize size = cachedImage->imageSize(1.0f); 159 159 if (size.width()) { 160 160 // Compute the title, we use the decoded filename of the resource, falling … … 236 236 return 1; 237 237 238 IntSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this));239 IntSize windowSize = IntSize(view->width(), view->height());238 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this)); 239 LayoutSize windowSize = IntSize(view->width(), view->height()); 240 240 241 241 float widthScale = (float)windowSize.width() / imageSize.width(); … … 250 250 return; 251 251 252 IntSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this));252 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this)); 253 253 254 254 float scale = this->scale(); … … 327 327 return true; 328 328 329 IntSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this));330 IntSize windowSize = IntSize(view->width(), view->height());329 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(pageZoomFactor(this)); 330 LayoutSize windowSize = LayoutSize(view->width(), view->height()); 331 331 332 332 return imageSize.width() <= windowSize.width() && imageSize.height() <= windowSize.height(); -
trunk/Source/WebCore/html/ValidationMessage.cpp
r92585 r93279 107 107 } 108 108 109 static void adjustBubblePosition(const IntRect& hostRect, HTMLElement* bubble)109 static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble) 110 110 { 111 111 ASSERT(bubble); -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r93275 r93279 1186 1186 } 1187 1187 1188 static IntSize size(HTMLImageElement* image)1188 static LayoutSize size(HTMLImageElement* image) 1189 1189 { 1190 1190 if (CachedImage* cachedImage = image->cachedImage()) … … 1216 1216 return; 1217 1217 } 1218 IntSize s = size(image);1218 LayoutSize s = size(image); 1219 1219 drawImage(image, x, y, s.width(), s.height(), ec); 1220 1220 } … … 1227 1227 return; 1228 1228 } 1229 IntSize s = size(image);1229 LayoutSize s = size(image); 1230 1230 drawImage(image, FloatRect(0, 0, s.width(), s.height()), FloatRect(x, y, width, height), ec); 1231 1231 } -
trunk/Source/WebCore/html/shadow/MediaControlElements.cpp
r92347 r93279 123 123 } 124 124 125 void MediaControlPanelElement::startDrag(const IntPoint& eventLocation)125 void MediaControlPanelElement::startDrag(const LayoutPoint& eventLocation) 126 126 { 127 127 if (!m_canBeDragged) … … 147 147 } 148 148 149 void MediaControlPanelElement::continueDrag(const IntPoint& eventLocation)149 void MediaControlPanelElement::continueDrag(const LayoutPoint& eventLocation) 150 150 { 151 151 if (!m_isBeingDragged) 152 152 return; 153 153 154 IntSize distanceDragged = eventLocation - m_dragStartEventLocation;154 LayoutSize distanceDragged = eventLocation - m_dragStartEventLocation; 155 155 setPosition(m_dragStartPosition + distanceDragged); 156 156 } … … 170 170 } 171 171 172 void MediaControlPanelElement::setPosition(const IntPoint& position)172 void MediaControlPanelElement::setPosition(const LayoutPoint& position) 173 173 { 174 174 CSSMutableStyleDeclaration* style = getInlineStyleDecl(); … … 200 200 201 201 if (event->isMouseEvent()) { 202 IntPoint location = static_cast<MouseEvent*>(event)->absoluteLocation();202 LayoutPoint location = static_cast<MouseEvent*>(event)->absoluteLocation(); 203 203 if (event->type() == eventNames().mousedownEvent) { 204 204 startDrag(location); -
trunk/Source/WebCore/html/shadow/MediaControlElements.h
r88546 r93279 109 109 virtual void defaultEventHandler(Event*); 110 110 111 void startDrag(const IntPoint& eventLocation);112 void continueDrag(const IntPoint& eventLocation);111 void startDrag(const LayoutPoint& eventLocation); 112 void continueDrag(const LayoutPoint& eventLocation); 113 113 void endDrag(); 114 114 115 void setPosition(const IntPoint&);115 void setPosition(const LayoutPoint&); 116 116 117 117 bool m_canBeDragged; 118 118 bool m_isBeingDragged; 119 IntPoint m_dragStartPosition;120 IntPoint m_dragStartEventLocation;119 LayoutPoint m_dragStartPosition; 120 LayoutPoint m_dragStartEventLocation; 121 121 }; 122 122 -
trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp
r91827 r93279 196 196 } 197 197 198 void SliderThumbElement::dragFrom(const IntPoint& point)198 void SliderThumbElement::dragFrom(const LayoutPoint& point) 199 199 { 200 200 setPositionFromPoint(point); … … 202 202 } 203 203 204 void SliderThumbElement::setPositionFromPoint(const IntPoint& point)204 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) 205 205 { 206 206 HTMLInputElement* input = hostInput(); … … 209 209 return; 210 210 211 IntPoint offset = roundedIntPoint(input->renderer()->absoluteToLocal(point, false, true));211 LayoutPoint offset = roundedLayoutPoint(input->renderer()->absoluteToLocal(point, false, true)); 212 212 bool isVertical = hasVerticalAppearance(input); 213 int trackSize;214 int position;215 int currentPosition;213 LayoutUnit trackSize; 214 LayoutUnit position; 215 LayoutUnit currentPosition; 216 216 // We need to calculate currentPosition from absolute points becaue the 217 217 // renderer for this node is usually on a layer and renderBox()->x() and 218 218 // y() are unusable. 219 IntPoint absoluteThumbOrigin = renderBox()->absoluteBoundingBoxRect().location();220 IntPoint absoluteSliderContentOrigin = roundedIntPoint(input->renderer()->localToAbsolute());219 LayoutPoint absoluteThumbOrigin = renderBox()->absoluteBoundingBoxRect().location(); 220 LayoutPoint absoluteSliderContentOrigin = roundedLayoutPoint(input->renderer()->localToAbsolute()); 221 221 if (isVertical) { 222 222 trackSize = input->renderBox()->contentHeight() - renderBox()->height(); … … 228 228 currentPosition = absoluteThumbOrigin.x() - absoluteSliderContentOrigin.x(); 229 229 } 230 position = max (0, min(position, trackSize));230 position = max<LayoutUnit>(0, min(position, trackSize)); 231 231 if (position == currentPosition) 232 232 return; -
trunk/Source/WebCore/html/shadow/SliderThumbElement.h
r91574 r93279 53 53 void setPositionFromValue(); 54 54 55 void dragFrom(const IntPoint&);55 void dragFrom(const LayoutPoint&); 56 56 virtual void defaultEventHandler(Event*); 57 57 virtual void detach(); … … 68 68 void startDragging(); 69 69 void stopDragging(); 70 void setPositionFromPoint(const IntPoint&);70 void setPositionFromPoint(const LayoutPoint&); 71 71 72 72 bool m_inDragMode; -
trunk/Source/WebCore/rendering/RenderImage.cpp
r91628 r93279 438 438 if (HTMLMapElement* map = imageMap()) { 439 439 IntRect contentBox = contentBoxRect(); 440 float zoom = style()->effectiveZoom(); 441 LayoutUnit mapX = roundedLayoutUnit((pointInContainer.x() - accumulatedOffset.x() - this->x() - contentBox.x()) / zoom); 442 LayoutUnit mapY = roundedLayoutUnit((pointInContainer.y() - accumulatedOffset.y() - this->y() - contentBox.y()) / zoom); 443 if (map->mapMouseEvent(mapX, mapY, contentBox.size(), tempResult)) 440 float scaleFactor = 1 / style()->effectiveZoom(); 441 LayoutPoint mapLocation(pointInContainer.x() - accumulatedOffset.x() - this->x() - contentBox.x(), pointInContainer.y() - accumulatedOffset.y() - this->y() - contentBox.y()); 442 mapLocation.scale(scaleFactor, scaleFactor); 443 444 if (map->mapMouseEvent(mapLocation, contentBox.size(), tempResult)) 444 445 tempResult.setInnerNonSharedNode(node()); 445 446 }
Note: See TracChangeset
for help on using the changeset viewer.