Changeset 172317 in webkit
- Timestamp:
- Aug 7, 2014, 5:35:33 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172316 r172317 1 2014-08-07 Simon Fraser <simon.fraser@apple.com> 2 3 HTML <sub> and <sup> elements do not work in some 64-bit builds 4 https://bugs.webkit.org/show_bug.cgi?id=135736 5 6 Reviewed by Tim Horton. 7 8 RootInlineBox::verticalPositionForBox() had some implicit conversions between 9 LayoutUnit and int that caused overflow, and resulted in different comparison 10 behavior with an int constant in different architectures, since overflow behavior 11 is undefined. 12 13 Specifically, VerticalPositionCache was written in terms of ints with a special 14 0x80000000 "not found" value. However, 0x80000000 was being assigned to 15 a LayoutUnit, which multiplies by 64 causing overflow. The result was then 16 compared again with 0x80000000 which could pass or fail depending on overflow 17 behavior. 18 19 Fix by converting VerticalPositionCache to use LayoutUnits, and to have a bool 20 return value with a result out param, instead of a special return value. 21 22 Not easily testable, since the difference does not show in DRT output, 23 and a ref test would be flakey. 24 25 * rendering/RootInlineBox.cpp: 26 (WebCore::RootInlineBox::ascentAndDescentForBox): 27 * rendering/VerticalPositionCache.h: 28 (WebCore::VerticalPositionCache::get): 29 (WebCore::VerticalPositionCache::set): 30 1 31 2014-08-07 Benjamin Poulain <bpoulain@apple.com> 2 32 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r170774 r172317 935 935 bool isRenderInline = renderer->isRenderInline(); 936 936 if (isRenderInline && !firstLine) { 937 LayoutUnit verticalPosition = verticalPositionCache.get(renderer, baselineType());938 if (verticalPosition != PositionUndefined)939 return verticalPosition;937 LayoutUnit cachedPosition; 938 if (verticalPositionCache.get(renderer, baselineType(), cachedPosition)) 939 return cachedPosition; 940 940 } 941 941 -
trunk/Source/WebCore/rendering/VerticalPositionCache.h
r130612 r172317 34 34 class RenderObject; 35 35 36 // Values for vertical alignment.37 const int PositionUndefined = 0x80000000;38 39 36 class VerticalPositionCache { 40 37 WTF_MAKE_NONCOPYABLE(VerticalPositionCache); … … 43 40 { } 44 41 45 int get(RenderObject* renderer, FontBaseline baselineType) const42 bool get(RenderObject* renderer, FontBaseline baselineType, LayoutUnit& result) const 46 43 { 47 const HashMap<RenderObject*, int>& mapToCheck = baselineType == AlphabeticBaseline ? m_alphabeticPositions : m_ideographicPositions;48 const HashMap<RenderObject*, int>::const_iterator it = mapToCheck.find(renderer);44 const HashMap<RenderObject*, LayoutUnit>& mapToCheck = baselineType == AlphabeticBaseline ? m_alphabeticPositions : m_ideographicPositions; 45 const HashMap<RenderObject*, LayoutUnit>::const_iterator it = mapToCheck.find(renderer); 49 46 if (it == mapToCheck.end()) 50 return PositionUndefined; 51 return it->value; 47 return false; 48 49 result = it->value; 50 return true; 52 51 } 53 52 54 void set(RenderObject* renderer, FontBaseline baselineType, int position)53 void set(RenderObject* renderer, FontBaseline baselineType, LayoutUnit position) 55 54 { 56 55 if (baselineType == AlphabeticBaseline) … … 61 60 62 61 private: 63 HashMap<RenderObject*, int> m_alphabeticPositions;64 HashMap<RenderObject*, int> m_ideographicPositions;62 HashMap<RenderObject*, LayoutUnit> m_alphabeticPositions; 63 HashMap<RenderObject*, LayoutUnit> m_ideographicPositions; 65 64 }; 66 65
Note:
See TracChangeset
for help on using the changeset viewer.