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

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: Rebase (merge conflict resolved) 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 (!documentBeingDestroyed() && isOrthogonalWritingModeRoot())
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()) {
esprehn 2016/01/31 00:44:56 The only times you go through here without a paren
kojii 2016/01/31 01:12:20 This "if" avoids: * Mark/unmark twice for when fir
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 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 3953
3928 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e) 3954 void LayoutBox::markForPaginationRelayoutIfNeeded(SubtreeLayoutScope& layoutScop e)
3929 { 3955 {
3930 ASSERT(!needsLayout()); 3956 ASSERT(!needsLayout());
3931 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it 3957 // If fragmentation height has changed, we need to lay out. No need to enter the layoutObject if it
3932 // is childless, though. 3958 // is childless, though.
3933 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 3959 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
3934 layoutScope.setChildNeedsLayout(this); 3960 layoutScope.setChildNeedsLayout(this);
3935 } 3961 }
3936 3962
3963 void LayoutBox::markOrthogonalWritingModeRoot()
3964 {
3965 ASSERT(frameView());
3966 frameView()->addOrthogonalWritingModeRoot(*this);
3967 }
3968
3969 void LayoutBox::unmarkOrthogonalWritingModeRoot()
3970 {
3971 ASSERT(frameView());
3972 frameView()->removeOrthogonalWritingModeRoot(*this);
3973 }
3974
3937 void LayoutBox::addVisualEffectOverflow() 3975 void LayoutBox::addVisualEffectOverflow()
3938 { 3976 {
3939 if (!style()->hasVisualOverflowingEffect()) 3977 if (!style()->hasVisualOverflowingEffect())
3940 return; 3978 return;
3941 3979
3942 // Add in the final overflow with shadows, outsets and outline combined. 3980 // Add in the final overflow with shadows, outsets and outline combined.
3943 LayoutRect visualEffectOverflow = borderBoxRect(); 3981 LayoutRect visualEffectOverflow = borderBoxRect();
3944 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets()); 3982 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets());
3945 addVisualOverflow(visualEffectOverflow); 3983 addVisualOverflow(visualEffectOverflow);
3946 } 3984 }
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4640 4678
4641 void LayoutBox::clearPercentHeightDescendants() 4679 void LayoutBox::clearPercentHeightDescendants()
4642 { 4680 {
4643 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4681 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4644 if (curr->isBox()) 4682 if (curr->isBox())
4645 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4683 toLayoutBox(curr)->removeFromPercentHeightContainer();
4646 } 4684 }
4647 } 4685 }
4648 4686
4649 } // namespace blink 4687 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698