RESOLVED FIXED 60235
Make RenderStyle::setPageBreakInside() reject unsupported enum values.
https://bugs.webkit.org/show_bug.cgi?id=60235
Summary Make RenderStyle::setPageBreakInside() reject unsupported enum values.
Luke Macpherson
Reported 2011-05-04 18:25:36 PDT
Make RenderStyle::setPageBreakInside() reject unsupported enum values.
Attachments
Patch (2.74 KB, patch)
2011-05-04 18:29 PDT, Luke Macpherson
no flags
Patch (2.74 KB, patch)
2011-05-04 23:10 PDT, Luke Macpherson
no flags
Patch (2.71 KB, patch)
2011-05-05 17:20 PDT, Luke Macpherson
no flags
Patch (2.82 KB, patch)
2011-05-05 19:12 PDT, Luke Macpherson
no flags
Luke Macpherson
Comment 1 2011-05-04 18:29:40 PDT
Luke Macpherson
Comment 2 2011-05-04 18:31:53 PDT
Luke Macpherson
Comment 3 2011-05-04 23:10:26 PDT
Luke Macpherson
Comment 4 2011-05-04 23:10:42 PDT
Added inline keyword.
Eric Seidel (no email)
Comment 5 2011-05-05 16:13:42 PDT
Comment on attachment 92379 [details] Patch Still need to understand why PBAlways is not a valid value here. You mentioned in another bug that the enums were "too loose". Is it possible to ever call this with PBALWAYS? or should we ASSERT not? In either case we should have a comment her to explain why this check is needed/wanted. I don't think you actually need the inline. The compiler implicitly adds inline to all declaration-inline definitions was my understanding. (But I'm not a c++ expert!)
Luke Macpherson
Comment 6 2011-05-05 16:30:01 PDT
(In reply to comment #5) > (From update of attachment 92379 [details]) > Still need to understand why PBAlways is not a valid value here. You mentioned in another bug that the enums were "too loose". Is it possible to ever call this with PBALWAYS? or should we ASSERT not? In either case we should have a comment her to explain why this check is needed/wanted. If you look at the spec I linked earlier you'll see that this is not a valid value for this property. It is used for 'page-break-after' and 'page-break-before' properties, but not 'page-break-inside'. To answer the question of whether to ASSERT or not, I'll need to see what the parser does, as it is possible the parser accepts the full set of enum values. In that case a user could put page-break-inline: always to trigger the assertion. > I don't think you actually need the inline. The compiler implicitly adds inline to all declaration-inline definitions was my understanding. (But I'm not a c++ expert!) dglazkov seems pretty adamant about it on 60246, though I think more for expression of intent than because it will change the compiler behavior. I haven't been around long enough to take a stand on issues of accepted style, so I'm just trying to do what I'm told.
Luke Macpherson
Comment 7 2011-05-05 16:48:38 PDT
I checked the parser code, and indeed it looks like the parser considers these values invalid, so they can be safely changed to assertions. Expect another patch shortly :)
Eric Seidel (no email)
Comment 8 2011-05-05 16:50:47 PDT
(In reply to comment #6) > > I don't think you actually need the inline. The compiler implicitly adds inline to all declaration-inline definitions was my understanding. (But I'm not a c++ expert!) > > dglazkov seems pretty adamant about it on 60246, though I think more for expression of intent than because it will change the compiler behavior. I haven't been around long enough to take a stand on issues of accepted style, so I'm just trying to do what I'm told. Thanks! I'm certainly not trying to argue with dglazkov through you. :) Just seeking to share what I know about compiler behavior. :)
Luke Macpherson
Comment 9 2011-05-05 17:20:42 PDT
Eric Seidel (no email)
Comment 10 2011-05-05 17:49:11 PDT
Comment on attachment 92509 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=92509&action=review > Source/WebCore/rendering/style/RenderStyle.h:1016 > + void setPageBreakInside(EPageBreak b) { ASSERT(b != PBALWAYS); noninherited_flags._page_break_inside = b; } So now I ask myself: "self, how many other values for EPageBreak are there? Why are we blacklisting a single one, instead of whitelisting the supported ones?" I still think this deserves a comment. something as simple as: // EPageBreak supports more values than page-break-inside allows, make sure we're only ever setting valid values. or something like that. Thank you for leading this difficult cleanup task!
Luke Macpherson
Comment 11 2011-05-05 19:12:17 PDT
WebKit Commit Bot
Comment 12 2011-05-06 01:28:05 PDT
Comment on attachment 92529 [details] Patch Clearing flags on attachment: 92529 Committed r85936: <http://trac.webkit.org/changeset/85936>
WebKit Commit Bot
Comment 13 2011-05-06 01:28:11 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.