PSA: Blink is now using gfx int/float geometry types

88 views
Skip to first unread message

Xianzhu Wang

unread,
Jan 15, 2022, 12:56:08 AM1/15/22
to blink-dev
Hi, blink-dev,

As the second part of crbug.com/738465, we have finished migrating blink to use gfx int/float geometry types:
  • blink::IntRect -> gfx::Rect
  • blink::IntPoint -> gfx::Point (if it's a point) or gfx::Vector2d (if it's an offset)
  • blink::IntSize -> gfx::Size (if it's a size) or gfx::Vector2d (if it's an offset)
  • blink::FloatRect -> gfx::RectF
  • blink::FloatPoint -> gfx::PointF (if it's a point) or gfx::Vector2dF (if it's an offset)
  • blink::FloatSize -> gfx::SizeF (if it's a size) or gfx::Vector2dF (if it's an offset)
  • blink::FloatBox -> gfx::BoxF
  • blink::FloatQuad -> gfx::QuadF
  • blink::FloatPoint3D -> gfx::Point3F (if it's a point) or gfx::Vector3dF (if it's an offset)
  • blink::IntRectOutsets -> gfx::Outsets or gfx::Insets
  • blink::FloatRectOusets -> gfx::OutsetsF or gfx::Outsets
Most differences between the blink types and gfx types are straightforward, but the following are notable:
  • gfx::Size, gfx::SizeF, gfx::Rect and gfx::RectF clamp negative width/height to zero.
  • All gfx integer geometry types clamp values to integer range. Some stored values are clamped to prevent overflow of calculated values. For example, gfx::Rect clamps also clamps width to prevent overflow of right (x+width).
Cheers,
Xianzhu

Kentaro Hara

unread,
Jan 16, 2022, 8:32:15 PM1/16/22
to Xianzhu Wang, Dave Tapuska, blink-dev
I know Xianzhu and @Dave Tapuska  had been working really hard to deprecate the blink-specific geometry types for a long time. I'm excited to see it's finally complete! Thanks Xianzhu and Dave for all the efforts :D



--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADBxricqKD4J%2Bvm_d8bpcD9QX6Ux-3qSctX_YHN-bPU9Fc-zxw%40mail.gmail.com.


--
Kentaro Hara, Tokyo

dan...@chromium.org

unread,
Jan 18, 2022, 9:46:41 AM1/18/22
to Kentaro Hara, Xianzhu Wang, Dave Tapuska, blink-dev
Congratulations on completing this, and really well done to push this over the finish line. It's been a long time coming and I know the conversion was tricky and required a lot of effort, with domain expertise to determine which type to use in each place. Thanks for this wonderful contribution toward the health of our codebase!

Reply all
Reply to author
Forward
0 new messages