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

Side by Side Diff: sky/engine/core/rendering/RenderBox.h

Issue 878303002: Remove more scrolling code from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | 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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_ 23 #ifndef SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_
24 #define SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_ 24 #define SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_
25 25
26 #include "sky/engine/core/rendering/RenderBoxModelObject.h" 26 #include "sky/engine/core/rendering/RenderBoxModelObject.h"
27 #include "sky/engine/core/rendering/RenderOverflow.h" 27 #include "sky/engine/core/rendering/RenderOverflow.h"
28 #include "sky/engine/platform/scroll/ScrollTypes.h"
29 28
30 namespace blink { 29 namespace blink {
31 30
32 struct PaintInfo; 31 struct PaintInfo;
33 class RenderBlockFlow; 32 class RenderBlockFlow;
34 33
35 enum SizeType { MainOrPreferredSize, MinSize, MaxSize }; 34 enum SizeType { MainOrPreferredSize, MinSize, MaxSize };
36 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde rPadding }; 35 enum AvailableLogicalHeightType { ExcludeMarginBorderPadding, IncludeMarginBorde rPadding };
37 enum MarginDirection { BlockDirection, InlineDirection }; 36 enum MarginDirection { BlockDirection, InlineDirection };
38 37
39 enum ShouldComputePreferred { ComputeActual, ComputePreferred }; 38 enum ShouldComputePreferred { ComputeActual, ComputePreferred };
40 39
41 enum ContentsClipBehavior { ForceContentsClip, SkipContentsClipIfPossible }; 40 enum ContentsClipBehavior { ForceContentsClip, SkipContentsClipIfPossible };
42 41
43 enum ScrollOffsetClamping {
44 ScrollOffsetUnclamped,
45 ScrollOffsetClamped
46 };
47
48 struct RenderBoxRareData { 42 struct RenderBoxRareData {
49 WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED; 43 WTF_MAKE_NONCOPYABLE(RenderBoxRareData); WTF_MAKE_FAST_ALLOCATED;
50 public: 44 public:
51 RenderBoxRareData() 45 RenderBoxRareData()
52 : m_inlineBoxWrapper(0) 46 : m_inlineBoxWrapper(0)
53 , m_overrideLogicalContentHeight(-1) 47 , m_overrideLogicalContentHeight(-1)
54 , m_overrideLogicalContentWidth(-1) 48 , m_overrideLogicalContentWidth(-1)
55 { 49 {
56 } 50 }
57 51
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 LayoutUnit clientWidth() const; 221 LayoutUnit clientWidth() const;
228 LayoutUnit clientHeight() const; 222 LayoutUnit clientHeight() const;
229 LayoutUnit clientLogicalWidth() const { return clientWidth(); } 223 LayoutUnit clientLogicalWidth() const { return clientWidth(); }
230 LayoutUnit clientLogicalHeight() const { return clientHeight(); } 224 LayoutUnit clientLogicalHeight() const { return clientHeight(); }
231 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); } 225 LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogic alHeight(); }
232 LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop (), clientWidth(), clientHeight()); } 226 LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop (), clientWidth(), clientHeight()); }
233 227
234 int pixelSnappedClientWidth() const; 228 int pixelSnappedClientWidth() const;
235 int pixelSnappedClientHeight() const; 229 int pixelSnappedClientHeight() const;
236 230
237 // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unl ess the
238 // object has overflow:hidden/scroll/auto specified and also has overflow.
239 // scrollLeft/Top return the current scroll position. These methods are vir tual so that objects like
240 // textareas can scroll shadow content (but pretend that they are the object s that are
241 // scrolling).
242 virtual LayoutUnit scrollLeft() const;
243 virtual LayoutUnit scrollTop() const;
244 virtual LayoutUnit scrollWidth() const;
245 virtual LayoutUnit scrollHeight() const;
246 int pixelSnappedScrollWidth() const;
247 int pixelSnappedScrollHeight() const;
248 virtual void setScrollLeft(LayoutUnit);
249 virtual void setScrollTop(LayoutUnit);
250
251 void scrollToOffset(const IntSize&);
252 void scrollByRecursively(const IntSize& delta, ScrollOffsetClamping = Scroll OffsetUnclamped);
253 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, c onst ScrollAlignment& alignY);
254
255 virtual LayoutUnit marginTop() const override { return m_marginBox.top(); } 231 virtual LayoutUnit marginTop() const override { return m_marginBox.top(); }
256 virtual LayoutUnit marginBottom() const override { return m_marginBox.bottom (); } 232 virtual LayoutUnit marginBottom() const override { return m_marginBox.bottom (); }
257 virtual LayoutUnit marginLeft() const override { return m_marginBox.left(); } 233 virtual LayoutUnit marginLeft() const override { return m_marginBox.left(); }
258 virtual LayoutUnit marginRight() const override { return m_marginBox.right() ; } 234 virtual LayoutUnit marginRight() const override { return m_marginBox.right() ; }
259 void setMarginTop(LayoutUnit margin) { m_marginBox.setTop(margin); } 235 void setMarginTop(LayoutUnit margin) { m_marginBox.setTop(margin); }
260 void setMarginBottom(LayoutUnit margin) { m_marginBox.setBottom(margin); } 236 void setMarginBottom(LayoutUnit margin) { m_marginBox.setBottom(margin); }
261 void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); } 237 void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); }
262 void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); } 238 void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); }
263 239
264 LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(); } 240 LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(); }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // Block flows subclass availableWidth/Height to handle multi column layout (shrinking the width/height available to children when laying out.) 365 // Block flows subclass availableWidth/Height to handle multi column layout (shrinking the width/height available to children when laying out.)
390 virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidt h(); } 366 virtual LayoutUnit availableLogicalWidth() const { return contentLogicalWidt h(); }
391 virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const; 367 virtual LayoutUnit availableLogicalHeight(AvailableLogicalHeightType) const;
392 LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeight Type) const; 368 LayoutUnit availableLogicalHeightUsing(const Length&, AvailableLogicalHeight Type) const;
393 369
394 // There are a few cases where we need to refer specifically to the availabl e physical width and available physical height. 370 // There are a few cases where we need to refer specifically to the availabl e physical width and available physical height.
395 // Relative positioning is one of those cases, since left/top offsets are ph ysical. 371 // Relative positioning is one of those cases, since left/top offsets are ph ysical.
396 LayoutUnit availableWidth() const { return availableLogicalWidth(); } 372 LayoutUnit availableWidth() const { return availableLogicalWidth(); }
397 LayoutUnit availableHeight() const { return availableLogicalHeight(IncludeMa rginBorderPadding); } 373 LayoutUnit availableHeight() const { return availableLogicalHeight(IncludeMa rginBorderPadding); }
398 374
399 virtual bool scroll(ScrollDirection, ScrollGranularity, float delta = 1);
400 virtual bool canBeProgramaticallyScrolled() const;
401 virtual void autoscroll(const IntPoint&);
402 bool autoscrollInProgress() const;
403 bool canAutoscroll() const;
404 IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const;
405 static RenderBox* findAutoscrollable(RenderObject*);
406 virtual void stopAutoscroll() { }
407
408 bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style() ->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
409 bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style ()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
410 bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY (); }
411
412 bool hasScrollableOverflowX() const { return scrollsOverflowX() && pixelSnap pedScrollWidth() != pixelSnappedClientWidth(); }
413 bool hasScrollableOverflowY() const { return scrollsOverflowY() && pixelSnap pedScrollHeight() != pixelSnappedClientHeight(); }
414 virtual bool scrollsOverflowX() const { return hasOverflowClip() && (style() ->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
415 virtual bool scrollsOverflowY() const { return hasOverflowClip() && (style() ->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
416
417 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e xtraWidthToEndOfLine = 0) override; 375 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* e xtraWidthToEndOfLine = 0) override;
418 376
419 virtual LayoutRect overflowClipRect(const LayoutPoint& location); 377 virtual LayoutRect overflowClipRect(const LayoutPoint& location);
420 LayoutRect clipRect(const LayoutPoint& location); 378 LayoutRect clipRect(const LayoutPoint& location);
421 bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset, Cont entsClipBehavior); 379 bool pushContentsClip(PaintInfo&, const LayoutPoint& accumulatedOffset, Cont entsClipBehavior);
422 void popContentsClip(PaintInfo&, PaintPhase originalPhase, const LayoutPoint & accumulatedOffset); 380 void popContentsClip(PaintInfo&, PaintPhase originalPhase, const LayoutPoint & accumulatedOffset);
423 381
424 virtual void paintObject(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHE D(); } 382 virtual void paintObject(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHE D(); }
425 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&); 383 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&);
426 virtual void paintMask(PaintInfo&, const LayoutPoint&); 384 virtual void paintMask(PaintInfo&, const LayoutPoint&);
(...skipping 29 matching lines...) Expand all
456 virtual LayoutUnit offsetTop() const override; 414 virtual LayoutUnit offsetTop() const override;
457 415
458 LayoutRect layoutOverflowRectForPropagation() const; 416 LayoutRect layoutOverflowRectForPropagation() const;
459 417
460 bool hasRenderOverflow() const { return m_overflow; } 418 bool hasRenderOverflow() const { return m_overflow; }
461 bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().conta ins(m_overflow->visualOverflowRect()); } 419 bool hasVisualOverflow() const { return m_overflow && !borderBoxRect().conta ins(m_overflow->visualOverflowRect()); }
462 420
463 virtual bool needsPreferredWidthsRecalculation() const; 421 virtual bool needsPreferredWidthsRecalculation() const;
464 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */ , double& /* intrinsicRatio */) const { } 422 virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */ , double& /* intrinsicRatio */) const { }
465 423
466 IntSize scrolledContentOffset() const;
467
468 virtual bool hasRelativeLogicalHeight() const; 424 virtual bool hasRelativeLogicalHeight() const;
469 425
470 bool hasSameDirectionAs(const RenderBox* object) const { return style()->dir ection() == object->style()->direction(); } 426 bool hasSameDirectionAs(const RenderBox* object) const { return style()->dir ection() == object->style()->direction(); }
471 427
472 protected: 428 protected:
473 virtual void willBeDestroyed() override; 429 virtual void willBeDestroyed() override;
474 430
475 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o verride; 431 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) o verride;
476 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride; 432 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride;
477 virtual void updateFromStyle() override; 433 virtual void updateFromStyle() override;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 if (UNLIKELY(inlineBoxWrapper() != 0)) 571 if (UNLIKELY(inlineBoxWrapper() != 0))
616 deleteLineBoxWrapper(); 572 deleteLineBoxWrapper();
617 } 573 }
618 574
619 ensureRareData().m_inlineBoxWrapper = boxWrapper; 575 ensureRareData().m_inlineBoxWrapper = boxWrapper;
620 } 576 }
621 577
622 } // namespace blink 578 } // namespace blink
623 579
624 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_ 580 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBOX_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698