Changeset 93334 in webkit
- Timestamp:
- Aug 18, 2011 12:28:33 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93333 r93334 1 2011-08-18 Levi Weintraub <leviw@chromium.org> 2 3 Switch RenderTextControl* to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=66250 5 6 Reviewed by Eric Seidel. 7 8 Convertikng the RenderTextControl* classes to use the LayoutUnit abstraction. 9 10 No new tests as no change in behavior. 11 12 * rendering/LayoutTypes.h: 13 (WebCore::layoutMod): Added a function to perform the modulo operation on LayoutUnits. 14 * rendering/RenderTextControl.cpp: 15 (WebCore::RenderTextControl::hitInnerTextElement): 16 * rendering/RenderTextControl.h: 17 * rendering/RenderTextControlMultiLine.cpp: 18 (WebCore::RenderTextControlMultiLine::preferredContentWidth): 19 (WebCore::RenderTextControlMultiLine::baselinePosition): 20 * rendering/RenderTextControlMultiLine.h: 21 * rendering/RenderTextControlSingleLine.cpp: 22 (WebCore::RenderTextControlSingleLine::layout): 23 (WebCore::RenderTextControlSingleLine::controlClipRect): 24 (WebCore::RenderTextControlSingleLine::preferredContentWidth): 25 (WebCore::RenderTextControlSingleLine::scrollWidth): 26 (WebCore::RenderTextControlSingleLine::scrollHeight): 27 (WebCore::RenderTextControlSingleLine::scrollLeft): 28 (WebCore::RenderTextControlSingleLine::scrollTop): 29 (WebCore::RenderTextControlSingleLine::setScrollLeft): 30 (WebCore::RenderTextControlSingleLine::setScrollTop): 31 * rendering/RenderTextControlSingleLine.h: 32 1 33 2011-08-18 Levi Weintraub <leviw@chromium.org> 2 34 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r92998 r93334 92 92 } 93 93 94 inline LayoutUnit layoutMod(const LayoutUnit& numerator, const LayoutUnit& denominator) 95 { 96 return numerator % denominator; 97 } 98 94 99 } // namespace WebCore 95 100 -
trunk/Source/WebCore/rendering/RenderTextControl.cpp
r91879 r93334 300 300 void RenderTextControl::hitInnerTextElement(HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset) 301 301 { 302 IntPoint adjustedLocation = accumulatedOffset + location();302 LayoutPoint adjustedLocation = accumulatedOffset + location(); 303 303 HTMLElement* innerText = innerTextElement(); 304 304 result.setInnerNode(innerText); -
trunk/Source/WebCore/rendering/RenderTextControl.h
r91014 r93334 64 64 static bool hasValidAvgCharWidth(AtomicString family); 65 65 virtual float getAvgCharWidth(AtomicString family); 66 virtual int preferredContentWidth(float charWidth) const = 0;66 virtual LayoutUnit preferredContentWidth(float charWidth) const = 0; 67 67 virtual void adjustControlHeightBasedOnLineHeight(LayoutUnit lineHeight) = 0; 68 68 virtual RenderStyle* textBaseStyle() const = 0; -
trunk/Source/WebCore/rendering/RenderTextControlMultiLine.cpp
r91014 r93334 65 65 } 66 66 67 int RenderTextControlMultiLine::preferredContentWidth(float charWidth) const67 LayoutUnit RenderTextControlMultiLine::preferredContentWidth(float charWidth) const 68 68 { 69 69 int factor = static_cast<HTMLTextAreaElement*>(node())->cols(); 70 return static_cast< int>(ceilf(charWidth * factor)) + scrollbarThickness();70 return static_cast<LayoutUnit>(ceilf(charWidth * factor)) + scrollbarThickness(); 71 71 } 72 72 … … 76 76 } 77 77 78 int RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const78 LayoutUnit RenderTextControlMultiLine::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const 79 79 { 80 80 return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); -
trunk/Source/WebCore/rendering/RenderTextControlMultiLine.h
r91014 r93334 38 38 39 39 virtual float getAvgCharWidth(AtomicString family); 40 virtual int preferredContentWidth(float charWidth) const;41 virtual void adjustControlHeightBasedOnLineHeight( int lineHeight);42 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;40 virtual LayoutUnit preferredContentWidth(float charWidth) const; 41 virtual void adjustControlHeightBasedOnLineHeight(LayoutUnit lineHeight); 42 virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; 43 43 44 44 virtual void updateFromElement(); -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r92589 r93334 266 266 if (!container && currentHeight != contentHeight()) { 267 267 LayoutUnit heightDiff = currentHeight - contentHeight(); 268 innerTextRenderer->setY(innerTextRenderer->y() - (heightDiff / 2 + heightDiff % 2));268 innerTextRenderer->setY(innerTextRenderer->y() - (heightDiff / 2 + layoutMod(heightDiff, 2))); 269 269 } else if (inputElement()->isSearchField() && containerRenderer && containerRenderer->height() > contentHeight()) { 270 270 // A quirk for find-in-page box on Safari Windows. 271 271 // http://webkit.org/b/63157 272 272 LayoutUnit heightDiff = containerRenderer->height() - contentHeight(); 273 containerRenderer->setY(containerRenderer->y() - (heightDiff / 2 + heightDiff % 2));273 containerRenderer->setY(containerRenderer->y() - (heightDiff / 2 + layoutMod(heightDiff, 2))); 274 274 } 275 275 … … 371 371 } 372 372 373 IntRect RenderTextControlSingleLine::controlClipRect(const IntPoint& additionalOffset) const373 LayoutRect RenderTextControlSingleLine::controlClipRect(const LayoutPoint& additionalOffset) const 374 374 { 375 375 ASSERT(hasControlClip()); 376 IntRect clipRect = IntRect(containerElement()->renderBox()->frameRect());376 LayoutRect clipRect = LayoutRect(containerElement()->renderBox()->frameRect()); 377 377 clipRect.moveBy(additionalOffset); 378 378 return clipRect; … … 391 391 } 392 392 393 int RenderTextControlSingleLine::preferredContentWidth(float charWidth) const393 LayoutUnit RenderTextControlSingleLine::preferredContentWidth(float charWidth) const 394 394 { 395 395 int factor; … … 398 398 factor = 20; 399 399 400 int result = static_cast<int>(ceilf(charWidth * factor));400 LayoutUnit result = static_cast<LayoutUnit>(ceiledLayoutUnit(charWidth * factor)); 401 401 402 402 float maxCharWidth = 0.f; … … 720 720 } 721 721 722 int RenderTextControlSingleLine::scrollWidth() const722 LayoutUnit RenderTextControlSingleLine::scrollWidth() const 723 723 { 724 724 if (innerTextElement()) … … 727 727 } 728 728 729 int RenderTextControlSingleLine::scrollHeight() const729 LayoutUnit RenderTextControlSingleLine::scrollHeight() const 730 730 { 731 731 if (innerTextElement()) … … 734 734 } 735 735 736 int RenderTextControlSingleLine::scrollLeft() const736 LayoutUnit RenderTextControlSingleLine::scrollLeft() const 737 737 { 738 738 if (innerTextElement()) … … 741 741 } 742 742 743 int RenderTextControlSingleLine::scrollTop() const743 LayoutUnit RenderTextControlSingleLine::scrollTop() const 744 744 { 745 745 if (innerTextElement()) … … 748 748 } 749 749 750 void RenderTextControlSingleLine::setScrollLeft( int newLeft)750 void RenderTextControlSingleLine::setScrollLeft(LayoutUnit newLeft) 751 751 { 752 752 if (innerTextElement()) … … 754 754 } 755 755 756 void RenderTextControlSingleLine::setScrollTop( int newTop)756 void RenderTextControlSingleLine::setScrollTop(LayoutUnit newTop) 757 757 { 758 758 if (innerTextElement()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r91014 r93334 52 52 private: 53 53 virtual bool hasControlClip() const; 54 virtual IntRect controlClipRect(const IntPoint&) const;54 virtual LayoutRect controlClipRect(const LayoutPoint&) const; 55 55 virtual bool isTextField() const { return true; } 56 56 … … 63 63 64 64 // Subclassed to forward to our inner div. 65 virtual int scrollLeft() const;66 virtual int scrollTop() const;67 virtual int scrollWidth() const;68 virtual int scrollHeight() const;69 virtual void setScrollLeft( int);70 virtual void setScrollTop( int);65 virtual LayoutUnit scrollLeft() const; 66 virtual LayoutUnit scrollTop() const; 67 virtual LayoutUnit scrollWidth() const; 68 virtual LayoutUnit scrollHeight() const; 69 virtual void setScrollLeft(LayoutUnit); 70 virtual void setScrollTop(LayoutUnit); 71 71 virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); 72 72 virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Node** stopNode = 0); … … 74 74 int textBlockWidth() const; 75 75 virtual float getAvgCharWidth(AtomicString family); 76 virtual int preferredContentWidth(float charWidth) const;76 virtual LayoutUnit preferredContentWidth(float charWidth) const; 77 77 virtual void adjustControlHeightBasedOnLineHeight(LayoutUnit lineHeight); 78 78
Note: See TracChangeset
for help on using the changeset viewer.