Changeset 245779 in webkit
- Timestamp:
- May 26, 2019 7:04:13 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r245778 r245779 1 2019-05-26 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][Verification] Add areEssentiallyEqual for LayoutRect 4 https://bugs.webkit.org/show_bug.cgi?id=198250 5 <rdar://problem/51140119> 6 7 Reviewed by Antti Koivisto. 8 9 WebKit's inline layout is a mix of int/float/LayoutUnit types, while LFC mostly uses LayoutUnit. 10 When we compute the used size of a block container (based on the inline tree), the final value might go through a few conversions. 11 12 * layout/Verification.cpp: 13 (WebCore::Layout::areEssentiallyEqual): 14 (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): 15 1 16 2019-05-26 Wenson Hsieh <wenson_hsieh@apple.com> 2 17 -
trunk/Source/WebCore/layout/Verification.cpp
r245776 r245779 43 43 namespace Layout { 44 44 45 static bool areEssentiallyEqual(LayoutUnit a, LayoutUnit b) 46 { 47 if (a == b) 48 return true; 49 // 1/4th CSS pixel. 50 constexpr float epsilon = kFixedPointDenominator / 4; 51 return abs(a.rawValue() - b.rawValue()) <= epsilon; 52 } 53 45 54 static bool areEssentiallyEqual(float a, LayoutUnit b) 46 55 { 47 if (a == b.toFloat()) 48 return true; 49 50 return fabs(a - b.toFloat()) <= 10 * LayoutUnit::epsilon(); 56 return areEssentiallyEqual(LayoutUnit { a }, b); 57 } 58 59 static bool areEssentiallyEqual(LayoutRect a, LayoutRect b) 60 { 61 return areEssentiallyEqual(a.x(), b.x()) 62 && areEssentiallyEqual(a.y(), b.y()) 63 && areEssentiallyEqual(a.width(), b.width()) 64 && areEssentiallyEqual(a.height(), b.height()); 51 65 } 52 66 … … 217 231 frameRect.move(renderer.offsetForInFlowPosition()); 218 232 219 if ( frameRect != displayBox.rect()) {233 if (!areEssentiallyEqual(frameRect, displayBox.rect())) { 220 234 outputRect("frameBox", renderer.frameRect(), displayBox.rect()); 221 235 return true; 222 236 } 223 237 224 if ( renderer.borderBoxRect() != displayBox.borderBox()) {238 if (!areEssentiallyEqual(renderer.borderBoxRect(), displayBox.borderBox())) { 225 239 outputRect("borderBox", renderer.borderBoxRect(), displayBox.borderBox()); 226 240 return true; 227 241 } 228 242 229 if ( renderer.paddingBoxRect() != displayBox.paddingBox()) {243 if (!areEssentiallyEqual(renderer.paddingBoxRect(), displayBox.paddingBox())) { 230 244 outputRect("paddingBox", renderer.paddingBoxRect(), displayBox.paddingBox()); 231 245 return true; 232 246 } 233 247 234 if ( renderer.contentBoxRect() != displayBox.contentBox()) {248 if (!areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) { 235 249 outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox()); 236 250 return true; 237 251 } 238 252 239 if ( renderer.marginBoxRect() != renderBoxLikeMarginBox(displayBox)) {253 if (!areEssentiallyEqual(renderer.marginBoxRect(), renderBoxLikeMarginBox(displayBox))) { 240 254 // In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect, 241 255 // so let's check the individual margin values instead (and at this point we know that all other boxes match).
Note: See TracChangeset
for help on using the changeset viewer.