| Index: third_party/WebKit/Source/core/page/PrintContext.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/PrintContext.cpp b/third_party/WebKit/Source/core/page/PrintContext.cpp
|
| index 19a22e5d42611fe7357e1cc209327e56e5c183cf..e36011317288179b3f4caeccca3962470ba514d5 100644
|
| --- a/third_party/WebKit/Source/core/page/PrintContext.cpp
|
| +++ b/third_party/WebKit/Source/core/page/PrintContext.cpp
|
| @@ -20,6 +20,8 @@
|
|
|
| #include "core/page/PrintContext.h"
|
|
|
| +#include <utility>
|
| +
|
| #include "core/frame/FrameView.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/layout/LayoutView.h"
|
| @@ -129,37 +131,21 @@ void PrintContext::ComputePageRectsWithPageSizeInternal(
|
| int page_logical_height = is_horizontal ? page_height : page_width;
|
| int page_logical_width = is_horizontal ? page_width : page_height;
|
|
|
| - int inline_direction_start;
|
| - int inline_direction_end;
|
| - int block_direction_start;
|
| - int block_direction_end;
|
| - if (is_horizontal) {
|
| - if (view.Style()->IsFlippedBlocksWritingMode()) {
|
| - block_direction_start = doc_rect.MaxY();
|
| - block_direction_end = doc_rect.Y();
|
| - } else {
|
| - block_direction_start = doc_rect.Y();
|
| - block_direction_end = doc_rect.MaxY();
|
| - }
|
| - inline_direction_start =
|
| - view.Style()->IsLeftToRightDirection() ? doc_rect.X() : doc_rect.MaxX();
|
| - inline_direction_end =
|
| - view.Style()->IsLeftToRightDirection() ? doc_rect.MaxX() : doc_rect.X();
|
| - } else {
|
| - if (view.Style()->IsFlippedBlocksWritingMode()) {
|
| - block_direction_start = doc_rect.MaxX();
|
| - block_direction_end = doc_rect.X();
|
| - } else {
|
| - block_direction_start = doc_rect.X();
|
| - block_direction_end = doc_rect.MaxX();
|
| - }
|
| - inline_direction_start =
|
| - view.Style()->IsLeftToRightDirection() ? doc_rect.Y() : doc_rect.MaxY();
|
| - inline_direction_end =
|
| - view.Style()->IsLeftToRightDirection() ? doc_rect.MaxY() : doc_rect.Y();
|
| + int inline_direction_start = doc_rect.X();
|
| + int inline_direction_end = doc_rect.MaxX();
|
| + int block_direction_start = doc_rect.Y();
|
| + int block_direction_end = doc_rect.MaxY();
|
| + if (!is_horizontal) {
|
| + std::swap(block_direction_start, inline_direction_start);
|
| + std::swap(block_direction_end, inline_direction_end);
|
| }
|
| + if (!view.Style()->IsLeftToRightDirection())
|
| + std::swap(inline_direction_start, inline_direction_end);
|
| + if (view.Style()->IsFlippedBlocksWritingMode())
|
| + std::swap(block_direction_start, block_direction_end);
|
|
|
| - unsigned page_count = ceilf((float)doc_logical_height / page_logical_height);
|
| + unsigned page_count =
|
| + ceilf(static_cast<float>(doc_logical_height) / page_logical_height);
|
| for (unsigned i = 0; i < page_count; ++i) {
|
| int page_logical_top =
|
| block_direction_end > block_direction_start
|
|
|