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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leviw review Created 4 years, 10 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
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 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 void LayoutBox::willBeDestroyed() 127 void LayoutBox::willBeDestroyed()
128 { 128 {
129 clearOverrideSize(); 129 clearOverrideSize();
130 clearContainingBlockOverrideSize(); 130 clearContainingBlockOverrideSize();
131 clearExtraInlineAndBlockOffests(); 131 clearExtraInlineAndBlockOffests();
132 132
133 if (isOutOfFlowPositioned()) 133 if (isOutOfFlowPositioned())
134 LayoutBlock::removePositionedObject(this); 134 LayoutBlock::removePositionedObject(this);
135 removeFromPercentHeightContainer(); 135 removeFromPercentHeightContainer();
136 if (isOrthogonalWritingModeRoot() && !documentBeingDestroyed())
137 unmarkOrthogonalWritingModeRoot();
136 138
137 ShapeOutsideInfo::removeInfo(*this); 139 ShapeOutsideInfo::removeInfo(*this);
138 140
139 LayoutBoxModelObject::willBeDestroyed(); 141 LayoutBoxModelObject::willBeDestroyed();
140 } 142 }
141 143
144 void LayoutBox::insertedIntoTree()
145 {
146 LayoutBoxModelObject::insertedIntoTree();
147
148 if (isOrthogonalWritingModeRoot())
149 markOrthogonalWritingModeRoot();
150 }
151
152 void LayoutBox::willBeRemovedFromTree()
153 {
154 if (!documentBeingDestroyed() && isOrthogonalWritingModeRoot())
155 unmarkOrthogonalWritingModeRoot();
156
157 LayoutBoxModelObject::willBeRemovedFromTree();
158 }
159
142 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists() 160 void LayoutBox::removeFloatingOrPositionedChildFromBlockLists()
143 { 161 {
144 ASSERT(isFloatingOrOutOfFlowPositioned()); 162 ASSERT(isFloatingOrOutOfFlowPositioned());
145 163
146 if (documentBeingDestroyed()) 164 if (documentBeingDestroyed())
147 return; 165 return;
148 166
149 if (isFloating()) { 167 if (isFloating()) {
150 LayoutBlockFlow* parentBlockFlow = nullptr; 168 LayoutBlockFlow* parentBlockFlow = nullptr;
151 for (LayoutObject* curr = parent(); curr && !curr->isLayoutView(); curr = curr->parent()) { 169 for (LayoutObject* curr = parent(); curr && !curr->isLayoutView(); curr = curr->parent()) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal 234 // (as part of the LayoutBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
217 // writing mode value before style change here. 235 // writing mode value before style change here.
218 bool oldHorizontalWritingMode = isHorizontalWritingMode(); 236 bool oldHorizontalWritingMode = isHorizontalWritingMode();
219 237
220 LayoutBoxModelObject::styleDidChange(diff, oldStyle); 238 LayoutBoxModelObject::styleDidChange(diff, oldStyle);
221 239
222 const ComputedStyle& newStyle = styleRef(); 240 const ComputedStyle& newStyle = styleRef();
223 if (needsLayout() && oldStyle) 241 if (needsLayout() && oldStyle)
224 removeFromPercentHeightContainer(); 242 removeFromPercentHeightContainer();
225 243
226 if (oldHorizontalWritingMode != isHorizontalWritingMode()) 244 if (oldHorizontalWritingMode != isHorizontalWritingMode()) {
245 if (parent()) {
246 if (isOrthogonalWritingModeRoot())
247 markOrthogonalWritingModeRoot();
248 else
249 unmarkOrthogonalWritingModeRoot();
250 }
251
227 clearPercentHeightDescendants(); 252 clearPercentHeightDescendants();
253 }
228 254
229 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the 255 // If our zoom factor changes and we have a defined scrollLeft/Top, we need to adjust that value into the
230 // new zoomed coordinate space. 256 // new zoomed coordinate space.
231 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) { 257 if (hasOverflowClip() && oldStyle && oldStyle->effectiveZoom() != newStyle.e ffectiveZoom() && layer()) {
232 if (int left = layer()->scrollableArea()->scrollXOffset()) { 258 if (int left = layer()->scrollableArea()->scrollXOffset()) {
233 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ; 259 left = (left / oldStyle->effectiveZoom()) * newStyle.effectiveZoom() ;
234 layer()->scrollableArea()->scrollToXOffset(left); 260 layer()->scrollableArea()->scrollToXOffset(left);
235 } 261 }
236 if (int top = layer()->scrollableArea()->scrollYOffset()) { 262 if (int top = layer()->scrollableArea()->scrollYOffset()) {
237 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom(); 263 top = (top / oldStyle->effectiveZoom()) * newStyle.effectiveZoom();
(...skipping 3692 matching lines...) Expand 10 before | Expand all | Expand 10 after
3930 3956
3931 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 3957 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
3932 { 3958 {
3933 ASSERT(!needsLayout()); 3959 ASSERT(!needsLayout());
3934 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it 3960 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it
3935 // is childless, though. 3961 // is childless, though.
3936 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 3962 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
3937 layoutScope.setChildNeedsLayout(this); 3963 layoutScope.setChildNeedsLayout(this);
3938 } 3964 }
3939 3965
3966 void LayoutBox::markOrthogonalWritingModeRoot()
3967 {
3968 ASSERT(frameView());
3969 frameView()->addOrthogonalWritingModeRoot(*this);
3970 }
3971
3972 void LayoutBox::unmarkOrthogonalWritingModeRoot()
3973 {
3974 ASSERT(frameView());
3975 frameView()->removeOrthogonalWritingModeRoot(*this);
3976 }
3977
3940 void LayoutBox::addVisualEffectOverflow() 3978 void LayoutBox::addVisualEffectOverflow()
3941 { 3979 {
3942 if (!style()->hasVisualOverflowingEffect()) 3980 if (!style()->hasVisualOverflowingEffect())
3943 return; 3981 return;
3944 3982
3945 // Add in the final overflow with shadows, outsets and outline combined. 3983 // Add in the final overflow with shadows, outsets and outline combined.
3946 LayoutRect visualEffectOverflow = borderBoxRect(); 3984 LayoutRect visualEffectOverflow = borderBoxRect();
3947 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets()); 3985 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets());
3948 addVisualOverflow(visualEffectOverflow); 3986 addVisualOverflow(visualEffectOverflow);
3949 } 3987 }
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4643 4681
4644 void LayoutBox::clearPercentHeightDescendants() 4682 void LayoutBox::clearPercentHeightDescendants()
4645 { 4683 {
4646 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4684 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4647 if (curr->isBox()) 4685 if (curr->isBox())
4648 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4686 toLayoutBox(curr)->removeFromPercentHeightContainer();
4649 } 4687 }
4650 } 4688 }
4651 4689
4652 } // namespace blink 4690 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698