RESOLVED FIXED 37538
Implement page format data programming interface
https://bugs.webkit.org/show_bug.cgi?id=37538
Summary Implement page format data programming interface
Yuzo Fujishima
Reported 2010-04-13 17:17:38 PDT
CSS Paged Media Module Level 3 (http://dev.w3.org/csswg/css3-page/) enables the document author to specify the size and orientation of the page box. Combined with Media Queries (http://www.w3.org/TR/2009/CR-css3-mediaqueries-20090423/), it also enables the document author to specify page format depending on the page size. This means WebCore needs to provide a programming interface for page size negotiation.
Attachments
Add skeletal methods. (3.36 KB, patch)
2010-04-13 18:27 PDT, Yuzo Fujishima
no flags
Implement page format data programming interface. (41.09 KB, patch)
2010-06-17 04:20 PDT, Yuzo Fujishima
no flags
Addressed review comments. (48.13 KB, patch)
2010-06-20 22:27 PDT, Yuzo Fujishima
no flags
display property doesn't apply to @page, addressed comments (47.49 KB, patch)
2010-06-22 23:15 PDT, Yuzo Fujishima
hamaji: review+
Yuzo Fujishima
Comment 1 2010-04-13 18:27:23 PDT
Created attachment 53306 [details] Add skeletal methods.
Dimitri Glazkov (Google)
Comment 2 2010-04-15 14:09:24 PDT
This seems very detached and hard to understand without the context in which it's used. I'd say this is a rare case where the patch is too small :)
Eric Seidel (no email)
Comment 3 2010-05-09 14:01:59 PDT
Comment on attachment 53306 [details] Add skeletal methods. We don't generally add unused/untested code to the repository.
Yuzo Fujishima
Comment 4 2010-06-17 04:20:08 PDT
Created attachment 58977 [details] Implement page format data programming interface.
Shinichiro Hamaji
Comment 5 2010-06-17 23:32:11 PDT
Comment on attachment 58977 [details] Implement page format data programming interface. WebCore/dom/Document.cpp:1517 + int x = style->marginLeft().calcValue(maxValue) + style->borderLeft().width() + style->paddingLeft().calcValue(maxValue); I'm not 100% sure, but maybe we want to make margin=0px when display is none. WebCore/css/CSSStyleSelector.cpp:5516 + case 2: We usually don't put a newline after case's colon? WebCore/css/CSSStyleSelector.cpp:5534 + if (!pageSizeFromName(primitiveValue0, primitiveValue1, width, height)) Is this OK even for "size: a4 a4" ? LayoutTests/printing/page-format-data-expected.txt:22 + PASS layoutTestController.preferredPageSizeInPixels(0) is "(816,1056)" Cannot we make the results more readable? For example, inch(30) or something like this? LayoutTests/printing/page-format-data.html:120 + We might want to test more invalid cases such as size: 100px 100px 100px, size: -100px, etc.
Yuzo Fujishima
Comment 6 2010-06-20 22:27:54 PDT
Created attachment 59227 [details] Addressed review comments.
Yuzo Fujishima
Comment 7 2010-06-20 22:29:41 PDT
Thank you for the review. (In reply to comment #5) > (From update of attachment 58977 [details]) > WebCore/dom/Document.cpp:1517 > + int x = style->marginLeft().calcValue(maxValue) + style->borderLeft().width() + style->paddingLeft().calcValue(maxValue); > I'm not 100% sure, but maybe we want to make margin=0px when display is none. Changed as suggested. > > WebCore/css/CSSStyleSelector.cpp:5516 > + case 2: > We usually don't put a newline after case's colon? Done. > > WebCore/css/CSSStyleSelector.cpp:5534 > + if (!pageSizeFromName(primitiveValue0, primitiveValue1, width, height)) > Is this OK even for "size: a4 a4" ? Added a test. > > LayoutTests/printing/page-format-data-expected.txt:22 > + PASS layoutTestController.preferredPageSizeInPixels(0) is "(816,1056)" > Cannot we make the results more readable? For example, inch(30) or something like this? Changed to use mmSize() and inchSize(). > > LayoutTests/printing/page-format-data.html:120 > + > We might want to test more invalid cases such as size: 100px 100px 100px, size: -100px, etc. Added tests. I also changed test expectations for non-mac platforms.
Shinichiro Hamaji
Comment 8 2010-06-22 05:17:43 PDT
Comment on attachment 59227 [details] Addressed review comments. WebCore/css/CSSStyleSelector.cpp:5613 + Length& h = portrait ? height : width; This is OK, but I slightly prefer to swap them after the switch sentence if portrait is true. WebCore/css/CSSStyleSelector.h:266 + Length inchLength(double inch); I think they (or at least the latter three functions) should be placed in private section of this class?
Yuzo Fujishima
Comment 9 2010-06-22 23:15:41 PDT
Created attachment 59479 [details] display property doesn't apply to @page, addressed comments
Yuzo Fujishima
Comment 10 2010-06-22 23:19:15 PDT
Thank you for the review. It turned out that display property doesn't apply to @page. I've changed the code accordingly. (In reply to comment #8) > (From update of attachment 59227 [details]) > WebCore/css/CSSStyleSelector.cpp:5613 > + Length& h = portrait ? height : width; > This is OK, but I slightly prefer to swap them after the switch sentence if portrait is true. Done. > > WebCore/css/CSSStyleSelector.h:266 > + Length inchLength(double inch); > I think they (or at least the latter three functions) should be placed in private section of this class? They are already private, although "Review Patch" shows them as if they were public.
Shinichiro Hamaji
Comment 11 2010-06-22 23:21:44 PDT
Comment on attachment 59479 [details] display property doesn't apply to @page, addressed comments > They are already private, although "Review Patch" shows them as if they were public. Oops. It seems our code pretty printer didn't work well here... Sorry for the confusion.
Yuzo Fujishima
Comment 12 2010-06-23 00:30:24 PDT
Note You need to log in before you can comment on or make changes to this bug.