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

Side by Side Diff: Source/core/layout/LayoutScrollbar.cpp

Issue 1296033002: Fix re-layout logic in LayoutScrollbar::updateScrollbarParts. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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/layout/LayoutScrollbar.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) 2008, 2009 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "core/layout/LayoutScrollbar.h" 27 #include "core/layout/LayoutScrollbar.h"
28 28
29 #include "core/css/PseudoStyleRequest.h" 29 #include "core/css/PseudoStyleRequest.h"
30 #include "core/frame/FrameView.h" 30 #include "core/frame/FrameView.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 #include "core/layout/LayoutPart.h" 32 #include "core/layout/LayoutPart.h"
33 #include "core/layout/LayoutScrollbarPart.h" 33 #include "core/layout/LayoutScrollbarPart.h"
34 #include "core/layout/LayoutScrollbarTheme.h" 34 #include "core/layout/LayoutScrollbarTheme.h"
35 #include "core/layout/LayoutView.h"
35 #include "platform/graphics/GraphicsContext.h" 36 #include "platform/graphics/GraphicsContext.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 PassRefPtrWillBeRawPtr<Scrollbar> LayoutScrollbar::createCustomScrollbar(Scrolla bleArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, Loca lFrame* owningFrame) 40 PassRefPtrWillBeRawPtr<Scrollbar> LayoutScrollbar::createCustomScrollbar(Scrolla bleArea* scrollableArea, ScrollbarOrientation orientation, Node* ownerNode, Loca lFrame* owningFrame)
40 { 41 {
41 return adoptRefWillBeNoop(new LayoutScrollbar(scrollableArea, orientation, o wnerNode, owningFrame)); 42 return adoptRefWillBeNoop(new LayoutScrollbar(scrollableArea, orientation, o wnerNode, owningFrame));
42 } 43 }
43 44
44 LayoutScrollbar::LayoutScrollbar(ScrollableArea* scrollableArea, ScrollbarOrient ation orientation, Node* ownerNode, LocalFrame* owningFrame) 45 LayoutScrollbar::LayoutScrollbar(ScrollableArea* scrollableArea, ScrollbarOrient ation orientation, Node* ownerNode, LocalFrame* owningFrame)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Scrollbar::trace(visitor); 90 Scrollbar::trace(visitor);
90 } 91 }
91 92
92 LayoutBox* LayoutScrollbar::owningLayoutObject() const 93 LayoutBox* LayoutScrollbar::owningLayoutObject() const
93 { 94 {
94 if (m_owningFrame) 95 if (m_owningFrame)
95 return m_owningFrame->ownerLayoutObject(); 96 return m_owningFrame->ownerLayoutObject();
96 return m_owner && m_owner->layoutObject() ? m_owner->layoutObject()->enclosi ngBox() : 0; 97 return m_owner && m_owner->layoutObject() ? m_owner->layoutObject()->enclosi ngBox() : 0;
97 } 98 }
98 99
100 LayoutBox* LayoutScrollbar::owningLayoutObjectWithinFrame() const
101 {
102 if (m_owningFrame)
103 return m_owningFrame->contentLayoutObject();
104 return owningLayoutObject();
105 }
106
99 void LayoutScrollbar::setParent(Widget* parent) 107 void LayoutScrollbar::setParent(Widget* parent)
100 { 108 {
101 Scrollbar::setParent(parent); 109 Scrollbar::setParent(parent);
102 if (!parent) { 110 if (!parent) {
103 // Destroy all of the scrollbar's LayoutBoxes. 111 // Destroy all of the scrollbar's LayoutBoxes.
104 updateScrollbarParts(true); 112 updateScrollbarParts(true);
105 } 113 }
106 } 114 }
107 115
108 void LayoutScrollbar::setEnabled(bool e) 116 void LayoutScrollbar::setEnabled(bool e)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 int oldThickness = isHorizontal ? height() : width(); 189 int oldThickness = isHorizontal ? height() : width();
182 int newThickness = 0; 190 int newThickness = 0;
183 LayoutScrollbarPart* part = m_parts.get(ScrollbarBGPart); 191 LayoutScrollbarPart* part = m_parts.get(ScrollbarBGPart);
184 if (part) { 192 if (part) {
185 part->layout(); 193 part->layout();
186 newThickness = isHorizontal ? part->size().height() : part->size().width (); 194 newThickness = isHorizontal ? part->size().height() : part->size().width ();
187 } 195 }
188 196
189 if (newThickness != oldThickness) { 197 if (newThickness != oldThickness) {
190 setFrameRect(IntRect(location(), IntSize(isHorizontal ? width() : newThi ckness, isHorizontal ? newThickness : height()))); 198 setFrameRect(IntRect(location(), IntSize(isHorizontal ? width() : newThi ckness, isHorizontal ? newThickness : height())));
191 if (LayoutBox* box = owningLayoutObject()) { 199 if (LayoutBox* box = owningLayoutObjectWithinFrame()) {
192 if (box->isLayoutBlock()) 200 if (box->isLayoutBlock())
193 toLayoutBlock(box)->notifyScrollbarThicknessChanged(); 201 toLayoutBlock(box)->notifyScrollbarThicknessChanged();
194 box->setChildNeedsLayout(); 202 box->setChildNeedsLayout();
195 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && m_scrollableAr ea) 203 if (RuntimeEnabledFeatures::slimmingPaintEnabled() && m_scrollableAr ea)
196 m_scrollableArea->invalidateScrollCorner(m_scrollableArea->scrol lCornerRect()); 204 m_scrollableArea->invalidateScrollCorner(m_scrollableArea->scrol lCornerRect());
197 } 205 }
198 } 206 }
199 } 207 }
200 208
201 static PseudoId pseudoForScrollbarPart(ScrollbarPart part) 209 static PseudoId pseudoForScrollbarPart(ScrollbarPart part)
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 return; 370 return;
363 371
364 // FIXME: invalidate only the changed part. 372 // FIXME: invalidate only the changed part.
365 if (LayoutBox* owningLayoutObject = this->owningLayoutObject()) { 373 if (LayoutBox* owningLayoutObject = this->owningLayoutObject()) {
366 for (auto& part : m_parts) 374 for (auto& part : m_parts)
367 owningLayoutObject->invalidateDisplayItemClientForNonCompositingDesc endantsOf(*part.value); 375 owningLayoutObject->invalidateDisplayItemClientForNonCompositingDesc endantsOf(*part.value);
368 } 376 }
369 } 377 }
370 378
371 } 379 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutScrollbar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698