Changeset 90250 in webkit
- Timestamp:
- Jul 1, 2011 11:33:25 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90249 r90250 1 2011-07-01 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch positionForPoint to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63774 7 8 Switching positionForPoint functions to new layout unit abstraction. 9 10 No new tests, no functionality changes. 11 12 * rendering/RenderBR.cpp: 13 (WebCore::RenderBR::positionForPoint): 14 * rendering/RenderBR.h: 15 * rendering/RenderBlock.cpp: 16 (WebCore::RenderBlock::positionForPoint): 17 * rendering/RenderBlock.h: 18 * rendering/RenderBox.cpp: 19 (WebCore::RenderBox::positionForPoint): 20 * rendering/RenderBox.h: 21 * rendering/RenderFileUploadControl.cpp: 22 (WebCore::RenderFileUploadControl::positionForPoint): 23 * rendering/RenderFileUploadControl.h: 24 * rendering/RenderInline.cpp: 25 (WebCore::RenderInline::positionForPoint): 26 * rendering/RenderInline.h: 27 * rendering/RenderObject.cpp: 28 (WebCore::RenderObject::positionForPoint): 29 * rendering/RenderReplaced.cpp: 30 (WebCore::RenderReplaced::positionForPoint): 31 * rendering/RenderReplaced.h: 32 * rendering/RenderText.cpp: 33 (WebCore::RenderText::positionForPoint): 34 * rendering/RenderText.h: 35 * rendering/RenderTextControlSingleLine.cpp: 36 (WebCore::RenderTextControlInnerBlock::positionForPoint): 37 * rendering/RenderTextControlSingleLine.h: 38 * rendering/svg/RenderSVGInlineText.cpp: 39 (WebCore::RenderSVGInlineText::positionForPoint): 40 * rendering/svg/RenderSVGInlineText.h: 41 * rendering/svg/RenderSVGText.cpp: 42 (WebCore::RenderSVGText::positionForPoint): 43 * rendering/svg/RenderSVGText.h: 44 1 45 2011-07-01 Andrew Scherkus <scherkus@chromium.org> 2 46 -
trunk/Source/WebCore/rendering/RenderBR.cpp
r70072 r90250 74 74 } 75 75 76 VisiblePosition RenderBR::positionForPoint(const IntPoint&)76 VisiblePosition RenderBR::positionForPoint(const LayoutPoint&) 77 77 { 78 78 return createVisiblePosition(0, DOWNSTREAM); -
trunk/Source/WebCore/rendering/RenderBR.h
r78846 r90250 53 53 virtual unsigned caretMaxRenderedOffset() const; 54 54 55 virtual VisiblePosition positionForPoint(const IntPoint&);55 virtual VisiblePosition positionForPoint(const LayoutPoint&); 56 56 57 57 protected: -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90144 r90250 4203 4203 } 4204 4204 4205 VisiblePosition RenderBlock::positionForPoint(const IntPoint& point)4205 VisiblePosition RenderBlock::positionForPoint(const LayoutPoint& point) 4206 4206 { 4207 4207 if (isTable()) … … 4210 4210 if (isReplaced()) { 4211 4211 // FIXME: This seems wrong when the object's writing-mode doesn't match the line's writing-mode. 4212 int pointLogicalLeft = isHorizontalWritingMode() ? point.x() : point.y();4213 int pointLogicalTop = isHorizontalWritingMode() ? point.y() : point.x();4212 LayoutUnit pointLogicalLeft = isHorizontalWritingMode() ? point.x() : point.y(); 4213 LayoutUnit pointLogicalTop = isHorizontalWritingMode() ? point.y() : point.x(); 4214 4214 4215 4215 if (pointLogicalTop < 0 || (pointLogicalTop < logicalHeight() && pointLogicalLeft < 0)) … … 4219 4219 } 4220 4220 4221 IntPoint pointInContents = point;4221 LayoutPoint pointInContents = point; 4222 4222 offsetForContents(pointInContents); 4223 IntPoint pointInLogicalContents(pointInContents);4223 LayoutPoint pointInLogicalContents(pointInContents); 4224 4224 if (!isHorizontalWritingMode()) 4225 4225 pointInLogicalContents = pointInLogicalContents.transposedPoint(); -
trunk/Source/WebCore/rendering/RenderBlock.h
r90144 r90250 121 121 LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalRightOffsetForLine(position, firstLine); } 122 122 123 virtual VisiblePosition positionForPoint(const IntPoint&);123 virtual VisiblePosition positionForPoint(const LayoutPoint&); 124 124 125 125 // Block flows subclass availableWidth to handle multi column layout (shrinking the width available to children when laying out.) -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90186 r90250 3096 3096 } 3097 3097 3098 VisiblePosition RenderBox::positionForPoint(const IntPoint& point)3098 VisiblePosition RenderBox::positionForPoint(const LayoutPoint& point) 3099 3099 { 3100 3100 // no children...return this render object's element, if there is one, and offset 0 … … 3102 3102 return createVisiblePosition(node() ? firstPositionInOrBeforeNode(node()) : Position()); 3103 3103 3104 int xPos = point.x();3105 int yPos = point.y();3106 3107 3104 if (isTable() && node()) { 3108 int right = contentWidth() + borderAndPaddingWidth();3109 int bottom = contentHeight() + borderAndPaddingHeight();3105 LayoutUnit right = contentWidth() + borderAndPaddingWidth(); 3106 LayoutUnit bottom = contentHeight() + borderAndPaddingHeight(); 3110 3107 3111 3108 if (point.x() < 0 || point.x() > right || point.y() < 0 || point.y() > bottom) { … … 3117 3114 3118 3115 // Pass off to the closest child. 3119 int minDist = INT_MAX;3116 LayoutUnit minDist = numeric_limits<LayoutUnit>::max(); 3120 3117 RenderBox* closestRenderer = 0; 3121 IntPoint adjustedPoint = point;3118 LayoutPoint adjustedPoint = point; 3122 3119 if (isTableRow()) 3123 3120 adjustedPoint.move(location()); … … 3133 3130 RenderBox* renderer = toRenderBox(renderObject); 3134 3131 3135 int top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? 0 : renderer->y());3136 int bottom = top + renderer->contentHeight();3137 int left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? 0 : renderer->x());3138 int right = left + renderer->contentWidth();3132 LayoutUnit top = renderer->borderTop() + renderer->paddingTop() + (isTableRow() ? 0 : renderer->y()); 3133 LayoutUnit bottom = top + renderer->contentHeight(); 3134 LayoutUnit left = renderer->borderLeft() + renderer->paddingLeft() + (isTableRow() ? 0 : renderer->x()); 3135 LayoutUnit right = left + renderer->contentWidth(); 3139 3136 3140 3137 if (point.x() <= right && point.x() >= left && point.y() <= top && point.y() >= bottom) { … … 3146 3143 // Find the distance from (x, y) to the box. Split the space around the box into 8 pieces 3147 3144 // and use a different compare depending on which piece (x, y) is in. 3148 IntPoint cmp;3149 if ( xPos> right) {3150 if ( yPos< top)3151 cmp = IntPoint(right, top);3152 else if ( yPos> bottom)3153 cmp = IntPoint(right, bottom);3145 LayoutPoint cmp; 3146 if (point.x() > right) { 3147 if (point.y() < top) 3148 cmp = LayoutPoint(right, top); 3149 else if (point.y() > bottom) 3150 cmp = LayoutPoint(right, bottom); 3154 3151 else 3155 cmp = IntPoint(right, yPos);3156 } else if ( xPos< left) {3157 if ( yPos< top)3158 cmp = IntPoint(left, top);3159 else if ( yPos> bottom)3160 cmp = IntPoint(left, bottom);3152 cmp = LayoutPoint(right, point.y()); 3153 } else if (point.x() < left) { 3154 if (point.y() < top) 3155 cmp = LayoutPoint(left, top); 3156 else if (point.y() > bottom) 3157 cmp = LayoutPoint(left, bottom); 3161 3158 else 3162 cmp = IntPoint(left, yPos);3159 cmp = LayoutPoint(left, point.y()); 3163 3160 } else { 3164 if ( yPos< top)3165 cmp = IntPoint(xPos, top);3161 if (point.y() < top) 3162 cmp = LayoutPoint(point.x(), top); 3166 3163 else 3167 cmp = IntPoint(xPos, bottom);3168 } 3169 3170 IntSize difference = cmp - point;3171 3172 int dist = difference.width() * difference.width() + difference.height() * difference.height();3164 cmp = LayoutPoint(point.x(), bottom); 3165 } 3166 3167 LayoutSize difference = cmp - point; 3168 3169 LayoutUnit dist = difference.width() * difference.width() + difference.height() * difference.height(); 3173 3170 if (dist < minDist) { 3174 3171 closestRenderer = renderer; -
trunk/Source/WebCore/rendering/RenderBox.h
r90169 r90250 373 373 IntRect maskClipRect(); 374 374 375 virtual VisiblePosition positionForPoint(const IntPoint&);375 virtual VisiblePosition positionForPoint(const LayoutPoint&); 376 376 377 377 void removeFloatingOrPositionedChildFromBlockLists(); -
trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp
r89983 r90250 185 185 } 186 186 187 VisiblePosition RenderFileUploadControl::positionForPoint(const IntPoint&)187 VisiblePosition RenderFileUploadControl::positionForPoint(const LayoutPoint&) 188 188 { 189 189 return VisiblePosition(); -
trunk/Source/WebCore/rendering/RenderFileUploadControl.h
r89983 r90250 53 53 int maxFilenameWidth() const; 54 54 55 virtual VisiblePosition positionForPoint(const IntPoint&);55 virtual VisiblePosition positionForPoint(const LayoutPoint&); 56 56 57 57 HTMLInputElement* uploadButton() const; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r90186 r90250 716 716 } 717 717 718 VisiblePosition RenderInline::positionForPoint(const IntPoint& point)718 VisiblePosition RenderInline::positionForPoint(const LayoutPoint& point) 719 719 { 720 720 // FIXME: Does not deal with relative positioned inlines (should it?) … … 727 727 728 728 // Translate the coords from the pre-anonymous block to the post-anonymous block. 729 IntPoint parentBlockPoint = cb->location() + point;729 LayoutPoint parentBlockPoint = cb->location() + point; 730 730 RenderBoxModelObject* c = continuation(); 731 731 while (c) { -
trunk/Source/WebCore/rendering/RenderInline.h
r90049 r90250 134 134 virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; 135 135 136 virtual VisiblePosition positionForPoint(const IntPoint&);136 virtual VisiblePosition positionForPoint(const LayoutPoint&); 137 137 138 138 virtual LayoutRect borderBoundingBox() const -
trunk/Source/WebCore/rendering/RenderObject.cpp
r90200 r90250 2131 2131 } 2132 2132 2133 VisiblePosition RenderObject::positionForPoint(const IntPoint&)2133 VisiblePosition RenderObject::positionForPoint(const LayoutPoint&) 2134 2134 { 2135 2135 return createVisiblePosition(caretMinOffset(), DOWNSTREAM); -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r90069 r90250 401 401 } 402 402 403 VisiblePosition RenderReplaced::positionForPoint(const IntPoint& point)403 VisiblePosition RenderReplaced::positionForPoint(const LayoutPoint& point) 404 404 { 405 405 InlineBox* box = inlineBoxWrapper(); … … 411 411 RootInlineBox* root = box->root(); 412 412 413 int top = root->selectionTop();414 int bottom = root->selectionBottom();415 416 int blockDirectionPosition = box->isHorizontal() ? point.y() + y() : point.x() + x();417 int lineDirectionPosition = box->isHorizontal() ? point.x() + x() : point.y() + y();413 LayoutUnit top = root->selectionTop(); 414 LayoutUnit bottom = root->selectionBottom(); 415 416 LayoutUnit blockDirectionPosition = box->isHorizontal() ? point.y() + y() : point.x() + x(); 417 LayoutUnit lineDirectionPosition = box->isHorizontal() ? point.x() + x() : point.y() + y(); 418 418 419 419 if (blockDirectionPosition < top) -
trunk/Source/WebCore/rendering/RenderReplaced.h
r90069 r90250 78 78 79 79 virtual unsigned caretMaxRenderedOffset() const; 80 virtual VisiblePosition positionForPoint(const IntPoint&);80 virtual VisiblePosition positionForPoint(const LayoutPoint&); 81 81 82 82 virtual bool canBeSelectionLeaf() const { return true; } -
trunk/Source/WebCore/rendering/RenderText.cpp
r89704 r90250 469 469 } 470 470 471 VisiblePosition RenderText::positionForPoint(const IntPoint& point)471 VisiblePosition RenderText::positionForPoint(const LayoutPoint& point) 472 472 { 473 473 if (!firstTextBox() || textLength() == 0) … … 477 477 int offset; 478 478 479 int pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y();480 int pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x();479 LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y(); 480 LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x(); 481 481 482 482 // FIXME: We should be able to roll these special cases into the general cases in the loop below. … … 498 498 RootInlineBox* rootBox = box->root(); 499 499 if (pointBlockDirection >= rootBox->selectionTop() || pointBlockDirection >= rootBox->lineTop()) { 500 int bottom = rootBox->selectionBottom();500 LayoutUnit bottom = rootBox->selectionBottom(); 501 501 if (rootBox->nextRootBox()) 502 502 bottom = min(bottom, rootBox->nextRootBox()->lineTop()); -
trunk/Source/WebCore/rendering/RenderText.h
r90049 r90250 66 66 void absoluteQuads(Vector<FloatQuad>&, ClippingOption option = NoClipping); 67 67 68 virtual VisiblePosition positionForPoint(const IntPoint&);68 virtual VisiblePosition positionForPoint(const LayoutPoint&); 69 69 70 70 const UChar* characters() const { return m_text.characters(); } -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r90089 r90250 53 53 using namespace HTMLNames; 54 54 55 VisiblePosition RenderTextControlInnerBlock::positionForPoint(const IntPoint& point)56 { 57 IntPoint contentsPoint(point);55 VisiblePosition RenderTextControlInnerBlock::positionForPoint(const LayoutPoint& point) 56 { 57 LayoutPoint contentsPoint(point); 58 58 59 59 // Multiline text controls have the scroll on shadowAncestorNode, so we need to take that -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r90089 r90250 167 167 private: 168 168 virtual bool hasLineIfEmpty() const { return true; } 169 virtual VisiblePosition positionForPoint(const IntPoint&);169 virtual VisiblePosition positionForPoint(const LayoutPoint&); 170 170 171 171 bool m_multiLine; -
trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
r89705 r90250 170 170 } 171 171 172 VisiblePosition RenderSVGInlineText::positionForPoint(const IntPoint& point)172 VisiblePosition RenderSVGInlineText::positionForPoint(const LayoutPoint& point) 173 173 { 174 174 if (!firstTextBox() || !textLength()) … … 182 182 // Map local point to absolute point, as the character origins stored in the text fragments use absolute coordinates. 183 183 FloatPoint absolutePoint(point); 184 absolutePoint.move (containingBlock->x(), containingBlock->y());184 absolutePoint.moveBy(containingBlock->location()); 185 185 186 186 float closestDistance = std::numeric_limits<float>::max(); -
trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.h
r85335 r90250 59 59 virtual bool isSVGInlineText() const { return true; } 60 60 61 virtual VisiblePosition positionForPoint(const IntPoint&);61 virtual VisiblePosition positionForPoint(const LayoutPoint&); 62 62 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); 63 63 virtual IntRect linesBoundingBox() const; -
trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp
r89754 r90250 208 208 } 209 209 210 VisiblePosition RenderSVGText::positionForPoint(const IntPoint& pointInContents)210 VisiblePosition RenderSVGText::positionForPoint(const LayoutPoint& pointInContents) 211 211 { 212 212 RootInlineBox* rootBox = firstRootBox(); … … 222 222 return createVisiblePosition(0, DOWNSTREAM); 223 223 224 return closestBox->renderer()->positionForPoint( IntPoint(pointInContents.x(), closestBox->y()));224 return closestBox->renderer()->positionForPoint(LayoutPoint(pointInContents.x(), closestBox->y())); 225 225 } 226 226 -
trunk/Source/WebCore/rendering/svg/RenderSVGText.h
r90048 r90250 56 56 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const IntPoint& pointInContainer, const IntPoint& accumulatedOffset, HitTestAction); 57 57 virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); 58 virtual VisiblePosition positionForPoint(const IntPoint&);58 virtual VisiblePosition positionForPoint(const LayoutPoint&); 59 59 60 60 virtual bool requiresLayer() const { return false; }
Note: See TracChangeset
for help on using the changeset viewer.