[webkit-dev] Implementing CSS3 Paged Media Margin Boxes

Eric Seidel eric at webkit.org
Fri Apr 27 11:47:58 PDT 2012


Ref-tests did not exist in WebKit when I last looked at this.  I added
pdf printing tests, only to realize that pdfs include user/machine
information and thus are useless for x-machine testing.

If our ref-test mechanism works for large pages that could work well.
:)  With printing tests you'll want to be able to test taht page 27
has the right number and that it was laid out on the 4th printed page,
etc. :)

On Fri, Apr 27, 2012 at 10:29 AM, Milian Wolff <milian.wolff at kdab.com> wrote:
> On Friday 27 April 2012 10:08:13 Eric Seidel wrote:
>> When I last looked at the page media stuff (long ago).  The problem
>> was mostly going to be testing.  We don't have a good way to do
>> printing tests right now in WebKit.
>
> Someone in the webkit community introduced me to the idea of reftests, which
> seem to be a viable option for proper printing tests. I think of something
> like the following that should work since we know the pixel dimensions of a
> printed page in our unit tests to be 800x600:
>
> // @page margin test
> <html>
> <head>
> <style>
> * { margin:0; padding:0; }
> @page { margin: 10px; }
> div {  width: 800px; height: 600px; background: green; }
> </style>
> </head>
> <body>
> <div>should have a 10px margin</div>
> </body>
> </head>
> </html>
>
> // alternative
> <html>
> <head>
> <style>
> * { margin:0; padding:0; }
> div { width: 780px; height: 580px; margin: 10px; }
> </style>
> </head>
> <body>
> <div>should have a 10px margin</div>
> </body>
> </head>
> </html>
>
> Now both versions can be "printed" to PNG similar to what the existing
> LayoutTestController.setPrinting() does. The resulting two platform specific
> images can be compared and should match - if not, something went wrong.
>
> Am I missing something, is the above impractical?
>
> Cheers
>
>> On Fri, Apr 27, 2012 at 7:22 AM, Milian Wolff <milian.wolff at kdab.com> wrote:
>> > Hey all,
>> >
>> > I would like to work on the CSS3 Paged Media support, esp. the margin
>> > boxes. I'm studying the code for some time now and would welcome it if
>> > someone could assist me in figuring out what needs to be done...
>> >
>> > First up, I think I should tackle the missing support in the parser, i.e.
>> > solving the FIXME in CSSParser::createMarginAtRule. I found that
>> > CSSFontFaceRule looks similar and could write some code based on that. A
>> > few questions arise now:
>> >
>> > a) For the unit tests (probably not only there) I need to have a special
>> > margin-at CSSRule for cssText(). I'll probably be able to copy most of the
>> > stuff again, but where in the build system do I have to add these new
>> > files?
>> >
>> > b) What CSSRule::Type should the above have? WEBKIT_MARGINAT_RULE at the
>> > end (hence value 11)?. I could not find an official IDL proposal that
>> > includes the margin at rules.
>> >
>> > c) These margin-at rules can only occur inside a page rule, and I need to
>> > access them from somewhere - what is the suggested path to take here?
>> > create StyleRulePage::setMarginRules or similar? Or reuse stuff from
>> > StyleRuleBlock?
>> >
>> > d) When I have some partial patch ready, where could I get input? Should I
>> > attach it to a bug report (I've opened
>> > https://bugs.webkit.org/show_bug.cgi?id=85062 for that purpose)
>> >
>> > f) I see that there are files like JSCSSFontFaceRuleCustom.cpp - what do I
>> > need to do there to get the new MediaAtRule accessible from JavaScript?
>> >
>> > Bye
>> > --
>> > Milian Wolff | milian.wolff at kdab.com | Software Engineer
>> > KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
>> > Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
>> > KDAB - Qt Experts - Platform-independent software solutions
>> >
>> > _______________________________________________
>> > webkit-dev mailing list
>> > webkit-dev at lists.webkit.org
>> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
> --
> Milian Wolff | milian.wolff at kdab.com | Software Engineer
> KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
> Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
> KDAB - Qt Experts - Platform-independent software solutions
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>


More information about the webkit-dev mailing list