Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 14359018: Correct overflow propagation in BTT and RTL writing-modes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@236320
Patch Set: Don't remove incorrect expected.png files. Add stuff to LayoutTests/TestExpectations instead. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 4124 matching lines...) Expand 10 before | Expand all | Expand 10 after
4135 // overflow if we are clipping our own overflow. 4135 // overflow if we are clipping our own overflow.
4136 if (child->hasSelfPaintingLayer() || hasOverflowClip()) 4136 if (child->hasSelfPaintingLayer() || hasOverflowClip())
4137 return; 4137 return;
4138 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style()); 4138 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style());
4139 childVisualOverflowRect.move(delta); 4139 childVisualOverflowRect.move(delta);
4140 addVisualOverflow(childVisualOverflowRect); 4140 addVisualOverflow(childVisualOverflowRect);
4141 } 4141 }
4142 4142
4143 void RenderBox::addLayoutOverflow(const LayoutRect& rect) 4143 void RenderBox::addLayoutOverflow(const LayoutRect& rect)
4144 { 4144 {
4145 LayoutRect clientBox = clientBoxRect(); 4145 LayoutRect clientBox = noOverflowRect();
4146 if (clientBox.contains(rect) || rect.isEmpty()) 4146 if (clientBox.contains(rect) || rect.isEmpty())
4147 return; 4147 return;
4148 4148
4149 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas. 4149 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas.
4150 LayoutRect overflowRect(rect); 4150 LayoutRect overflowRect(rect);
4151 if (hasOverflowClip() || isRenderView()) { 4151 if (hasOverflowClip() || isRenderView()) {
4152 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl 4152 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl
4153 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same 4153 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same
4154 // and vertical-lr/rl as the same. 4154 // and vertical-lr/rl as the same.
4155 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); 4155 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 m_overflow->addLayoutOverflow(overflowRect); 4190 m_overflow->addLayoutOverflow(overflowRect);
4191 } 4191 }
4192 4192
4193 void RenderBox::addVisualOverflow(const LayoutRect& rect) 4193 void RenderBox::addVisualOverflow(const LayoutRect& rect)
4194 { 4194 {
4195 LayoutRect borderBox = borderBoxRect(); 4195 LayoutRect borderBox = borderBoxRect();
4196 if (borderBox.contains(rect) || rect.isEmpty()) 4196 if (borderBox.contains(rect) || rect.isEmpty())
4197 return; 4197 return;
4198 4198
4199 if (!m_overflow) 4199 if (!m_overflow)
4200 m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBox)); 4200 m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox));
4201 4201
4202 m_overflow->addVisualOverflow(rect); 4202 m_overflow->addVisualOverflow(rect);
4203 } 4203 }
4204 4204
4205 void RenderBox::clearLayoutOverflow() 4205 void RenderBox::clearLayoutOverflow()
4206 { 4206 {
4207 if (!m_overflow) 4207 if (!m_overflow)
4208 return; 4208 return;
4209 4209
4210 if (visualOverflowRect() == borderBoxRect()) { 4210 if (visualOverflowRect() == borderBoxRect()) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
4384 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch 4384 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch
4385 // in a particular axis, then we have to flip the rect along that axis. 4385 // in a particular axis, then we have to flip the rect along that axis.
4386 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) 4386 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode)
4387 rect.setX(width() - rect.maxX()); 4387 rect.setX(width() - rect.maxX());
4388 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) 4388 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode)
4389 rect.setY(height() - rect.maxY()); 4389 rect.setY(height() - rect.maxY());
4390 4390
4391 return rect; 4391 return rect;
4392 } 4392 }
4393 4393
4394 LayoutRect RenderBox::noOverflowRect() const
4395 {
4396 // Because of the special coodinate system used for overflow rectangles (not quite logical, not
4397 // quite physical), we need to flip the block progression coordinate in vert ical-rl and
4398 // horizontal-bt writing modes. Apart from that, this method does the same a s clientBoxRect().
4399
4400 LayoutUnit left = borderLeft();
4401 LayoutUnit top = borderTop();
4402 LayoutUnit right = borderRight();
4403 LayoutUnit bottom = borderBottom();
4404 // Calculate physical padding box.
4405 LayoutRect rect(left, top, width() - left - right, height() - top - bottom);
4406 // Flip block progression axis if writing mode is vertical-rl or horizontal- bt.
4407 flipForWritingMode(rect);
4408 // Subtract space occupied by scrollbars. They are at their physical edge in this coordinate
4409 // system, so order is important here: first flip, then subtract scrollbars.
4410 rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight());
4411 return rect;
4412 }
4413
4394 LayoutRect RenderBox::overflowRectForPaintRejection() const 4414 LayoutRect RenderBox::overflowRectForPaintRejection() const
4395 { 4415 {
4396 LayoutRect overflowRect = visualOverflowRect(); 4416 LayoutRect overflowRect = visualOverflowRect();
4397 if (!m_overflow || !usesCompositedScrolling()) 4417 if (!m_overflow || !usesCompositedScrolling())
4398 return overflowRect; 4418 return overflowRect;
4399 4419
4400 overflowRect.unite(layoutOverflowRect()); 4420 overflowRect.unite(layoutOverflowRect());
4401 overflowRect.move(-scrolledContentOffset()); 4421 overflowRect.move(-scrolledContentOffset());
4402 return overflowRect; 4422 return overflowRect;
4403 } 4423 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4581 4601
4582 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) 4602 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation)
4583 { 4603 {
4584 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); 4604 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures);
4585 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); 4605 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures);
4586 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); 4606 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures);
4587 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); 4607 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures);
4588 } 4608 }
4589 4609
4590 } // namespace WebCore 4610 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698