WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
123310
Underline bounds cannot be queried before underline itself is drawn
https://bugs.webkit.org/show_bug.cgi?id=123310
Summary
Underline bounds cannot be queried before underline itself is drawn
Myles C. Maxfield
Reported
2013-10-24 18:37:22 PDT
Underline bounds cannot be queried before underline itself is drawn
Attachments
Patch
(15.91 KB, patch)
2013-10-24 18:49 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(15.70 KB, patch)
2013-10-25 10:44 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(15.54 KB, patch)
2013-10-25 13:18 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(15.51 KB, patch)
2013-10-25 13:31 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(15.57 KB, patch)
2013-10-25 15:46 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(15.58 KB, patch)
2013-10-29 15:01 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(16.26 KB, patch)
2013-10-29 17:56 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(10.88 KB, patch)
2013-10-30 13:58 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Patch
(10.84 KB, patch)
2013-10-31 13:15 PDT
,
Myles C. Maxfield
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Myles C. Maxfield
Comment 1
2013-10-24 18:49:19 PDT
Created
attachment 215134
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2013-10-24 18:50:13 PDT
<
rdar://problem/15316301
>
EFL EWS Bot
Comment 3
2013-10-24 18:56:21 PDT
Comment on
attachment 215134
[details]
Patch
Attachment 215134
[details]
did not pass efl-ews (efl): Output:
http://webkit-queues.appspot.com/results/10348238
kov's GTK+ EWS bot
Comment 4
2013-10-24 19:34:00 PDT
Comment on
attachment 215134
[details]
Patch
Attachment 215134
[details]
did not pass gtk-ews (gtk): Output:
http://webkit-queues.appspot.com/results/10348245
Build Bot
Comment 5
2013-10-24 19:49:16 PDT
Comment on
attachment 215134
[details]
Patch
Attachment 215134
[details]
did not pass win-ews (win): Output:
http://webkit-queues.appspot.com/results/10288251
Sam Weinig
Comment 6
2013-10-24 20:57:21 PDT
Comment on
attachment 215134
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215134&action=review
> Source/WebCore/rendering/InlineTextBox.cpp:69 > +static FloatRect computeBoundsForUnderline(GraphicsContext &context, const FloatPoint& point, float width, bool printing, bool &shouldAntialias)
The & in "GraphicsContext &context" and "bool &shouldAntialias" are on the wrong sides.
> Source/WebCore/rendering/InlineTextBox.cpp:71 > + // This function should be side-effect free
This comment doesn't really add anything.
> Source/WebCore/rendering/InlineTextBox.cpp:78 > + float thickness = max(context.strokeThickness(), 0.5f);
We have started using an explicit std::max.
> Source/WebCore/rendering/InlineTextBox.cpp:84 > + float adjustedThickness = max(thickness, 1.0f);
Again, std::max please.
> Source/WebCore/rendering/InlineTextBox.cpp:103 > +static void drawLineForText(GraphicsContext &context, const FloatPoint& point, float width, bool printing)
The & in "GraphicsContext &context" is on the wrong sides.
> Source/WebCore/rendering/InlineTextBox.cpp:105 > + bool shouldAntialias;
This can move down to after the if-statement.
EFL EWS Bot
Comment 7
2013-10-25 02:08:27 PDT
Comment on
attachment 215134
[details]
Patch
Attachment 215134
[details]
did not pass efl-wk2-ews (efl-wk2): Output:
http://webkit-queues.appspot.com/results/11918060
Myles C. Maxfield
Comment 8
2013-10-25 10:08:09 PDT
Comment on
attachment 215134
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215134&action=review
>> Source/WebCore/rendering/InlineTextBox.cpp:69 >> +static FloatRect computeBoundsForUnderline(GraphicsContext &context, const FloatPoint& point, float width, bool printing, bool &shouldAntialias) > > The & in "GraphicsContext &context" and "bool &shouldAntialias" are on the wrong sides.
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:71 >> + // This function should be side-effect free > > This comment doesn't really add anything.
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:78 >> + float thickness = max(context.strokeThickness(), 0.5f); > > We have started using an explicit std::max.
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:84 >> + float adjustedThickness = max(thickness, 1.0f); > > Again, std::max please.
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:103 >> +static void drawLineForText(GraphicsContext &context, const FloatPoint& point, float width, bool printing) > > The & in "GraphicsContext &context" is on the wrong sides.
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:105 >> + bool shouldAntialias; > > This can move down to after the if-statement.
Done.
Myles C. Maxfield
Comment 9
2013-10-25 10:44:20 PDT
Created
attachment 215189
[details]
Patch
Simon Fraser (smfr)
Comment 10
2013-10-25 10:50:59 PDT
Comment on
attachment 215189
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215189&action=review
> Source/WebCore/rendering/InlineTextBox.cpp:69 > +static FloatRect computeBoundsForUnderline(GraphicsContext& context, const FloatPoint& point, float width, bool printing, bool& shouldAntialias)
I think "point" should be called "start" or "origin". "width" should be "length". Is it up or down from the origin?
> Source/WebCore/rendering/InlineTextBox.cpp:73 > + float thickness = std::max(context.strokeThickness(), 0.5f);
But that bug added a 0.5 thickness only when printing. I think the comment has bitrotted.
> Source/WebCore/rendering/InlineTextBox.cpp:79 > + if (!printing && !context.paintingDisabled() && context.getCTM(GraphicsContext::DefinitelyIncludeDeviceScale).preservesAxisAlignment()) {
It would be better to early return here.
EFL EWS Bot
Comment 11
2013-10-25 11:12:06 PDT
Comment on
attachment 215189
[details]
Patch
Attachment 215189
[details]
did not pass efl-wk2-ews (efl-wk2): Output:
http://webkit-queues.appspot.com/results/10828022
Myles C. Maxfield
Comment 12
2013-10-25 11:38:24 PDT
Comment on
attachment 215189
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215189&action=review
>> Source/WebCore/rendering/InlineTextBox.cpp:69 >> +static FloatRect computeBoundsForUnderline(GraphicsContext& context, const FloatPoint& point, float width, bool printing, bool& shouldAntialias) > > I think "point" should be called "start" or "origin". "width" should be "length". Is it up or down from the origin?
Done.
>> Source/WebCore/rendering/InlineTextBox.cpp:73 >> + float thickness = std::max(context.strokeThickness(), 0.5f); > > But that bug added a 0.5 thickness only when printing. I think the comment has bitrotted.
I've traced this back to
r14112
(from 2006), entitled "Move WebTextRenderer into WebCore" but can't seem to figure out where WebTextRenderer came from. My guess is that, when printing, the 0.5 comes from that bug, and when not printing, setting the minimum to 0.5 makes sure that when we round to pixel boundaries, the underline disappear (assuming an identity CTM). I think the best thing to do is to just delete the comment. Thoughts?
>> Source/WebCore/rendering/InlineTextBox.cpp:79 >> + if (!printing && !context.paintingDisabled() && context.getCTM(GraphicsContext::DefinitelyIncludeDeviceScale).preservesAxisAlignment()) { > > It would be better to early return here.
Done.
Myles C. Maxfield
Comment 13
2013-10-25 11:38:59 PDT
**the underline doesn't disappear (In reply to
comment #12
)
> (From update of
attachment 215189
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=215189&action=review
> > >> Source/WebCore/rendering/InlineTextBox.cpp:69 > >> +static FloatRect computeBoundsForUnderline(GraphicsContext& context, const FloatPoint& point, float width, bool printing, bool& shouldAntialias) > > > > I think "point" should be called "start" or "origin". "width" should be "length". Is it up or down from the origin? > > Done. > > >> Source/WebCore/rendering/InlineTextBox.cpp:73 > >> + float thickness = std::max(context.strokeThickness(), 0.5f); > > > > But that bug added a 0.5 thickness only when printing. I think the comment has bitrotted. > > I've traced this back to
r14112
(from 2006), entitled "Move WebTextRenderer into WebCore" but can't seem to figure out where WebTextRenderer came from. My guess is that, when printing, the 0.5 comes from that bug, and when not printing, setting the minimum to 0.5 makes sure that when we round to pixel boundaries, the underline disappear (assuming an identity CTM). I think the best thing to do is to just delete the comment. Thoughts? > > >> Source/WebCore/rendering/InlineTextBox.cpp:79 > >> + if (!printing && !context.paintingDisabled() && context.getCTM(GraphicsContext::DefinitelyIncludeDeviceScale).preservesAxisAlignment()) { > > > > It would be better to early return here. > > Done.
Myles C. Maxfield
Comment 14
2013-10-25 13:18:25 PDT
Created
attachment 215203
[details]
Patch
Myles C. Maxfield
Comment 15
2013-10-25 13:31:58 PDT
Created
attachment 215205
[details]
Patch
Myles C. Maxfield
Comment 16
2013-10-25 15:46:53 PDT
Created
attachment 215223
[details]
Patch
Build Bot
Comment 17
2013-10-25 16:29:22 PDT
Comment on
attachment 215223
[details]
Patch
Attachment 215223
[details]
did not pass win-ews (win): Output:
http://webkit-queues.appspot.com/results/11948047
Myles C. Maxfield
Comment 18
2013-10-25 16:31:43 PDT
The win port is failing to build the Netscape plugin, which is completely irrelevant to this patch. Is there something I can do about this?
Myles C. Maxfield
Comment 19
2013-10-29 15:01:25 PDT
Created
attachment 215433
[details]
Patch
Build Bot
Comment 20
2013-10-29 16:02:12 PDT
Comment on
attachment 215433
[details]
Patch
Attachment 215433
[details]
did not pass win-ews (win): Output:
http://webkit-queues.appspot.com/results/17068179
Myles C. Maxfield
Comment 21
2013-10-29 16:17:10 PDT
Nevermind; I misread it. The Windows build calls drawLineForText in a place I didn't expect.
Myles C. Maxfield
Comment 22
2013-10-29 17:56:22 PDT
Created
attachment 215457
[details]
Patch
WebKit Commit Bot
Comment 23
2013-10-29 18:49:31 PDT
Comment on
attachment 215457
[details]
Patch Clearing flags on attachment: 215457 Committed
r158243
: <
http://trac.webkit.org/changeset/158243
>
WebKit Commit Bot
Comment 24
2013-10-29 18:49:34 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 25
2013-10-30 09:04:15 PDT
This patch moved code that was specific to CG into cross-platform code. Do we know that all the other platforms want this code?
WebKit Commit Bot
Comment 26
2013-10-30 11:44:54 PDT
Re-opened since this is blocked by
bug 123520
Myles C. Maxfield
Comment 27
2013-10-30 13:58:22 PDT
Created
attachment 215561
[details]
Patch
Tim Horton
Comment 28
2013-10-30 17:17:55 PDT
Comment on
attachment 215561
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215561&action=review
> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1261 > + if (lineRect.height() < initialBounds.height() * 2.0) {
We tend not to use f or .0
Myles C. Maxfield
Comment 29
2013-10-31 13:15:30 PDT
Created
attachment 215668
[details]
Patch
Dean Jackson
Comment 30
2013-10-31 13:48:33 PDT
Comment on
attachment 215668
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=215668&action=review
> Source/WebCore/ChangeLog:32 > + * platform/graphics/GraphicsContext.h: Signature of new computeLineBoundsForText > + function > + * platform/graphics/blackberry/PathBlackBerry.cpp: > + (WebCore::GraphicsContext::computeLineBoundsForText): Implement new function > + * platform/graphics/cairo/GraphicsContextCairo.cpp: > + (WebCore::GraphicsContext::computeLineBoundsForText): Ditto > + (WebCore::GraphicsContext::drawLineForText): Use computeLineBoundsForText > + * platform/graphics/cg/GraphicsContextCG.cpp: > + (WebCore::computeLineBoundsAndAntialiasingModeForText): Static function that > + performs the actual bounds computation > + (WebCore::GraphicsContext::computeLineBoundsForText): Calls > + computeLineBoundsAndAntialiasingModeForText > + (WebCore::GraphicsContext::drawLineForText): Use new function > + * platform/graphics/wince/GraphicsContextWinCE.cpp: > + (WebCore::GraphicsContext::computeLineBoundsForText): Implement new function
Super nit: end comments with periods.
WebKit Commit Bot
Comment 31
2013-10-31 14:12:38 PDT
Comment on
attachment 215668
[details]
Patch Clearing flags on attachment: 215668 Committed
r158392
: <
http://trac.webkit.org/changeset/158392
>
WebKit Commit Bot
Comment 32
2013-10-31 14:12:42 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug