OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/rendering/RenderBlockFlow.h" | 32 #include "core/rendering/RenderBlockFlow.h" |
33 | 33 |
34 #include "core/accessibility/AXObjectCache.h" | 34 #include "core/accessibility/AXObjectCache.h" |
35 #include "core/frame/FrameView.h" | 35 #include "core/frame/FrameView.h" |
36 #include "core/frame/LocalFrame.h" | 36 #include "core/frame/LocalFrame.h" |
37 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
| 38 #include "core/html/HTMLDialogElement.h" |
38 #include "core/rendering/HitTestLocation.h" | 39 #include "core/rendering/HitTestLocation.h" |
39 #include "core/rendering/RenderFlowThread.h" | 40 #include "core/rendering/RenderFlowThread.h" |
40 #include "core/rendering/RenderLayer.h" | 41 #include "core/rendering/RenderLayer.h" |
41 #include "core/rendering/RenderMultiColumnFlowThread.h" | 42 #include "core/rendering/RenderMultiColumnFlowThread.h" |
42 #include "core/rendering/RenderPagedFlowThread.h" | 43 #include "core/rendering/RenderPagedFlowThread.h" |
43 #include "core/rendering/RenderText.h" | 44 #include "core/rendering/RenderText.h" |
44 #include "core/rendering/RenderView.h" | 45 #include "core/rendering/RenderView.h" |
45 #include "core/rendering/TextAutosizer.h" | 46 #include "core/rendering/TextAutosizer.h" |
46 #include "core/rendering/line/LineWidth.h" | 47 #include "core/rendering/line/LineWidth.h" |
47 #include "core/rendering/svg/SVGTextRunRenderingContext.h" | 48 #include "core/rendering/svg/SVGTextRunRenderingContext.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 bool hasVisibleContent = style()->visibility() == VISIBLE; | 376 bool hasVisibleContent = style()->visibility() == VISIBLE; |
376 if (!hasVisibleContent) { | 377 if (!hasVisibleContent) { |
377 RenderLayer* layer = enclosingLayer(); | 378 RenderLayer* layer = enclosingLayer(); |
378 layer->updateDescendantDependentFlags(); | 379 layer->updateDescendantDependentFlags(); |
379 hasVisibleContent = layer->hasVisibleContent(); | 380 hasVisibleContent = layer->hasVisibleContent(); |
380 } | 381 } |
381 if (hasVisibleContent) | 382 if (hasVisibleContent) |
382 setShouldInvalidateOverflowForPaint(true); | 383 setShouldInvalidateOverflowForPaint(true); |
383 } | 384 } |
384 | 385 |
| 386 if (isHTMLDialogElement(node()) && isOutOfFlowPositioned()) |
| 387 positionDialog(); |
| 388 |
385 clearNeedsLayout(); | 389 clearNeedsLayout(); |
386 } | 390 } |
387 | 391 |
388 inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) | 392 inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, LayoutUnit &
pageLogicalHeight, SubtreeLayoutScope& layoutScope) |
389 { | 393 { |
390 LayoutUnit oldLeft = logicalLeft(); | 394 LayoutUnit oldLeft = logicalLeft(); |
391 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); | 395 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
392 relayoutChildren |= logicalWidthChanged; | 396 relayoutChildren |= logicalWidthChanged; |
393 | 397 |
394 rebuildFloatsFromIntruding(); | 398 rebuildFloatsFromIntruding(); |
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2904 | 2908 |
2905 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2909 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2906 { | 2910 { |
2907 if (m_rareData) | 2911 if (m_rareData) |
2908 return *m_rareData; | 2912 return *m_rareData; |
2909 | 2913 |
2910 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); | 2914 m_rareData = adoptPtrWillBeNoop(new RenderBlockFlowRareData(this)); |
2911 return *m_rareData; | 2915 return *m_rareData; |
2912 } | 2916 } |
2913 | 2917 |
| 2918 void RenderBlockFlow::positionDialog() |
| 2919 { |
| 2920 HTMLDialogElement* dialog = toHTMLDialogElement(node()); |
| 2921 if (dialog->centeringMode() == HTMLDialogElement::NotCentered) |
| 2922 return; |
| 2923 |
| 2924 bool canCenterDialog = (style()->position() == AbsolutePosition || style()->
position() == FixedPosition) |
| 2925 && style()->hasAutoTopAndBottom(); |
| 2926 |
| 2927 if (dialog->centeringMode() == HTMLDialogElement::Centered) { |
| 2928 if (canCenterDialog) |
| 2929 setY(dialog->centeredPosition()); |
| 2930 return; |
| 2931 } |
| 2932 |
| 2933 ASSERT(dialog->centeringMode() == HTMLDialogElement::NeedsCentering); |
| 2934 if (!canCenterDialog) { |
| 2935 dialog->setNotCentered(); |
| 2936 return; |
| 2937 } |
| 2938 |
| 2939 FrameView* frameView = document().view(); |
| 2940 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr
ollOffset().height(); |
| 2941 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
| 2942 if (height() < visibleHeight) |
| 2943 top += (visibleHeight - height()) / 2; |
| 2944 setY(top); |
| 2945 dialog->setCentered(top); |
| 2946 } |
| 2947 |
2914 } // namespace blink | 2948 } // namespace blink |
OLD | NEW |