Summary: | Implement page format data programming interface | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Yuzo Fujishima <yuzo> | ||||||||||
Component: | CSS | Assignee: | Yuzo Fujishima <yuzo> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | dglazkov, hamaji, hayato, hyatt, mitz, peter.linss | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | All | ||||||||||||
OS: | OS X 10.5 | ||||||||||||
Bug Depends on: | 35961 | ||||||||||||
Bug Blocks: | 15548 | ||||||||||||
Attachments: |
|
Description
Yuzo Fujishima
2010-04-13 17:17:38 PDT
Created attachment 53306 [details]
Add skeletal methods.
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 :) Comment on attachment 53306 [details]
Add skeletal methods.
We don't generally add unused/untested code to the repository.
Created attachment 58977 [details]
Implement page format data programming interface.
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.
Created attachment 59227 [details]
Addressed review comments.
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. 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?
Created attachment 59479 [details]
display property doesn't apply to @page, addressed comments
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. 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. Committed r61670: <http://trac.webkit.org/changeset/61670> |