WebKit Bugzilla
Attachment 370640 Details for
Bug 198250
: [LFC][Verification] Add areEssentiallyEqual for LayoutRect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198250-20190525185902.patch (text/plain), 3.96 KB, created by
zalan
on 2019-05-25 18:59:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-05-25 18:59:06 PDT
Size:
3.96 KB
patch
obsolete
>Subversion Revision: 245776 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2e4050f12c74535c53373175ecfb84a01845ece8..b3ff1ddbe2fb8361e0a672f85964d771c91b01bd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-05-25 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][Verification] Add areEssentiallyEqual for LayoutRect >+ https://bugs.webkit.org/show_bug.cgi?id=198250 >+ <rdar://problem/51140119> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebKit's inline layout is a mix of int/float/LayoutUnit types, while LFC mostly uses LayoutUnit. >+ When we compute the used size of a block container (based on the inline tree), the final value might go through a few conversions. >+ >+ * layout/Verification.cpp: >+ (WebCore::Layout::areEssentiallyEqual): >+ (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded): >+ > 2019-05-25 Zalan Bujtas <zalan@apple.com> > > [LFC][IFC] Introduce DisplayRun to display tree >diff --git a/Source/WebCore/layout/Verification.cpp b/Source/WebCore/layout/Verification.cpp >index d7fe6a9f1917495ae56eebdd78b5afe48f5cdc1c..95e36097019c1fb3afa363442eed6734287da9e1 100644 >--- a/Source/WebCore/layout/Verification.cpp >+++ b/Source/WebCore/layout/Verification.cpp >@@ -42,12 +42,26 @@ > namespace WebCore { > namespace Layout { > >-static bool areEssentiallyEqual(float a, LayoutUnit b) >+static bool areEssentiallyEqual(LayoutUnit a, LayoutUnit b) > { >- if (a == b.toFloat()) >+ if (a == b) > return true; >+ // 1/4th CSS pixel. >+ constexpr float epsilon = kFixedPointDenominator / 4; >+ return abs(a.rawValue() - b.rawValue()) <= epsilon; >+} > >- return fabs(a - b.toFloat()) <= 10 * LayoutUnit::epsilon(); >+static bool areEssentiallyEqual(float a, LayoutUnit b) >+{ >+ return areEssentiallyEqual(LayoutUnit { a }, b); >+} >+ >+static bool areEssentiallyEqual(LayoutRect a, LayoutRect b) >+{ >+ return areEssentiallyEqual(a.x(), b.x()) >+ && areEssentiallyEqual(a.y(), b.y()) >+ && areEssentiallyEqual(a.width(), b.width()) >+ && areEssentiallyEqual(a.height(), b.height()); > } > > static bool outputMismatchingSimpleLineInformationIfNeeded(TextStream& stream, const LayoutState& layoutState, const RenderBlockFlow& blockFlow, const Container& inlineFormattingRoot) >@@ -216,27 +230,27 @@ static bool outputMismatchingBlockBoxInformationIfNeeded(TextStream& stream, con > if (renderer.isInFlowPositioned()) > frameRect.move(renderer.offsetForInFlowPosition()); > >- if (frameRect != displayBox.rect()) { >+ if (!areEssentiallyEqual(frameRect, displayBox.rect())) { > outputRect("frameBox", renderer.frameRect(), displayBox.rect()); > return true; > } > >- if (renderer.borderBoxRect() != displayBox.borderBox()) { >+ if (!areEssentiallyEqual(renderer.borderBoxRect(), displayBox.borderBox())) { > outputRect("borderBox", renderer.borderBoxRect(), displayBox.borderBox()); > return true; > } > >- if (renderer.paddingBoxRect() != displayBox.paddingBox()) { >+ if (!areEssentiallyEqual(renderer.paddingBoxRect(), displayBox.paddingBox())) { > outputRect("paddingBox", renderer.paddingBoxRect(), displayBox.paddingBox()); > return true; > } > >- if (renderer.contentBoxRect() != displayBox.contentBox()) { >+ if (!areEssentiallyEqual(renderer.contentBoxRect(), displayBox.contentBox())) { > outputRect("contentBox", renderer.contentBoxRect(), displayBox.contentBox()); > return true; > } > >- if (renderer.marginBoxRect() != renderBoxLikeMarginBox(displayBox)) { >+ if (!areEssentiallyEqual(renderer.marginBoxRect(), renderBoxLikeMarginBox(displayBox))) { > // In certain cases, like out-of-flow boxes with margin auto, marginBoxRect() returns 0. It's clearly incorrect, > // so let's check the individual margin values instead (and at this point we know that all other boxes match). > auto marginsMatch = displayBox.marginBefore() == renderer.marginBefore()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198250
: 370640 |
370643