Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)

Created:
4 years, 2 months ago by eae
Modified:
4 years, 2 months ago
Reviewers:
haraken, wkorman
CC:
chromium-reviews, blink-reviews-platform-graphics_chromium.org, dshwang, eae+blinkwatch, fs, dcheng, apavlov+blink_chromium.org, kinuko+watch, kouhei+svg_chromium.org, pdr+svgwatchlist_chromium.org, krit, drott+blinkwatch_chromium.org, blink-reviews-css, szager+layoutwatch_chromium.org, Justin Novosad, dglazkov+blink, Rik, jchaffraix+rendering, blink-reviews-paint_chromium.org, blink-reviews, gyuyoung2, rwlbuis, ajuma+watch_chromium.org, blink-reviews-style_chromium.org, zoltan1, blink-reviews-layout_chromium.org, jbroman, pdr+graphicswatchlist_chromium.org, darktears, danakj+watch_chromium.org, ajuma+watch-canvas_chromium.org, pdr+renderingwatchlist_chromium.org, leviw+renderwatch, f(malita), Stephen Chennney
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove unsafe getFontMetrics methods Remove the ComputedStyle::getFontMetrics and Font::getFontMetrics helper methods as they both assume that the primaryFont method always returns a valid SimpleFontDataObject. That assumption is both incorrect and unsafe as it can return nullptr in case fallback to the last-resort-font fails. By replacing the convince calls with explicit calls and null checks that type of problems becomes more apparent and can be handled appropriately. R=wkorman@chromium.org BUG=655815 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Committed: https://crrev.com/fdcbab80bc37108f6e03d6906f27831228690350 Cr-Commit-Position: refs/heads/master@{#425437}

Patch Set 1 #

Total comments: 13

Patch Set 2 : Address wkroman suggestions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+376 lines, -155 lines) Patch
M third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp View 1 chunk +9 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/resolver/FontBuilder.cpp View 1 chunk +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBlock.cpp View 1 2 chunks +9 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp View 2 chunks +22 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp View 1 chunk +5 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBox.cpp View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutInline.cpp View 1 2 chunks +17 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutListBox.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutListMarker.cpp View 7 chunks +26 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutMenuList.cpp View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutText.cpp View 3 chunks +15 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTextControl.cpp View 1 1 chunk +8 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h View 1 chunk +1 line, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/InlineBox.cpp View 1 chunk +10 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp View 2 chunks +15 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/layout/line/RootInlineBox.cpp View 1 chunk +6 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp View 2 chunks +10 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngine.cpp View 2 chunks +8 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/SVGTextLayoutEngineBaseline.cpp View 2 chunks +13 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/SVGTextQuery.cpp View 2 chunks +15 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/svg/line/SVGInlineTextBox.cpp View 3 chunks +21 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/paint/EllipsisBoxPainter.cpp View 1 chunk +5 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/paint/EmbeddedObjectPainter.cpp View 2 chunks +7 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/paint/FileUploadControlPainter.cpp View 1 chunk +7 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp View 8 chunks +37 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp View 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp View 2 chunks +11 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/paint/TextPainter.cpp View 2 chunks +12 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.h View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/style/ComputedStyle.cpp View 2 chunks +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/core/svg/SVGLengthContext.cpp View 3 chunks +13 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.cpp View 1 chunk +7 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp View 3 chunks +9 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/DragImage.cpp View 4 chunks +16 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/platform/exported/WebFont.cpp View 1 1 chunk +17 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/platform/fonts/Font.h View 1 2 chunks +3 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/ExternalPopupMenu.cpp View 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 21 (10 generated)
eae
4 years, 2 months ago (2016-10-13 22:17:13 UTC) #1
wkorman
lgtm https://codereview.chromium.org/2416033003/diff/1/third_party/WebKit/Source/core/layout/LayoutBlock.cpp File third_party/WebKit/Source/core/layout/LayoutBlock.cpp (right): https://codereview.chromium.org/2416033003/diff/1/third_party/WebKit/Source/core/layout/LayoutBlock.cpp#newcode1696 third_party/WebKit/Source/core/layout/LayoutBlock.cpp:1696: return -1; Is -1 the correct error value? ...
4 years, 2 months ago (2016-10-13 22:54:31 UTC) #6
eae
Thanks for the review! https://codereview.chromium.org/2416033003/diff/1/third_party/WebKit/Source/core/layout/LayoutBlock.cpp File third_party/WebKit/Source/core/layout/LayoutBlock.cpp (right): https://codereview.chromium.org/2416033003/diff/1/third_party/WebKit/Source/core/layout/LayoutBlock.cpp#newcode1696 third_party/WebKit/Source/core/layout/LayoutBlock.cpp:1696: return -1; Yeah, -1 is ...
4 years, 2 months ago (2016-10-13 23:09:58 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2416033003/20001
4 years, 2 months ago (2016-10-13 23:10:31 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/280853)
4 years, 2 months ago (2016-10-13 23:16:35 UTC) #12
haraken
On 2016/10/13 23:16:35, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 2 months ago (2016-10-13 23:47:48 UTC) #13
eae
On 2016/10/13 23:47:48, haraken wrote: > On 2016/10/13 23:16:35, commit-bot: I haz the power wrote: ...
4 years, 2 months ago (2016-10-14 18:33:37 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2416033003/20001
4 years, 2 months ago (2016-10-14 18:34:12 UTC) #16
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 2 months ago (2016-10-14 19:48:22 UTC) #18
commit-bot: I haz the power
Patchset 2 (id:??) landed as https://crrev.com/fdcbab80bc37108f6e03d6906f27831228690350 Cr-Commit-Position: refs/heads/master@{#425437}
4 years, 2 months ago (2016-10-14 19:51:29 UTC) #20
drott
4 years, 2 months ago (2016-10-18 10:45:00 UTC) #21
Message was sent while issue was closed.
Nice.

Powered by Google App Engine
This is Rietveld 408576698