 Chromium Code Reviews
 Chromium Code Reviews Issue 14373010:
  Make abspos <dialog>'s containing block be the ICB.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 14373010:
  Make abspos <dialog>'s containing block be the ICB.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions | 
| 6 * are met: | 6 * are met: | 
| 7 * | 7 * | 
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 document()->updateLayoutIgnorePendingStylesheets(); | 85 document()->updateLayoutIgnorePendingStylesheets(); | 
| 86 | 86 | 
| 87 RenderBox* box = renderBox(); | 87 RenderBox* box = renderBox(); | 
| 88 if (!box || !needsCenteredPositioning(box->style())) | 88 if (!box || !needsCenteredPositioning(box->style())) | 
| 89 return; | 89 return; | 
| 90 | 90 | 
| 91 // Set up dialog's position to be safe-centered in the viewport. | 91 // Set up dialog's position to be safe-centered in the viewport. | 
| 92 // FIXME: Figure out what to do in vertical writing mode. | 92 // FIXME: Figure out what to do in vertical writing mode. | 
| 93 FrameView* frameView = document()->view(); | 93 FrameView* frameView = document()->view(); | 
| 94 int scrollTop = frameView->scrollOffset().height(); | 94 int scrollTop = frameView->scrollOffset().height(); | 
| 95 FloatPoint absolutePoint(0, scrollTop); | |
| 96 int visibleHeight = frameView->visibleContentRect(ScrollableArea::IncludeScr ollbars).height(); | 95 int visibleHeight = frameView->visibleContentRect(ScrollableArea::IncludeScr ollbars).height(); | 
| 96 m_top = scrollTop; | |
| 97 if (box->height() < visibleHeight) | 97 if (box->height() < visibleHeight) | 
| 98 absolutePoint.move(0, (visibleHeight - box->height()) / 2); | 98 m_top += (visibleHeight - box->height()) / 2; | 
| 99 FloatPoint localPoint = box->containingBlock()->absoluteToLocal(absolutePoin t); | |
| 100 | |
| 101 m_top = localPoint.y(); | |
| 102 m_topIsValid = true; | 99 m_topIsValid = true; | 
| 103 | 100 | 
| 104 // FIXME: It's inefficient to reattach here. We could do better by mutating style directly and forcing another layout. | 101 // FIXME: It's inefficient to reattach here. We could do better by mutating style directly and forcing another layout. | 
| 105 reattach(); | 102 reattach(); | 
| 106 } | 103 } | 
| 107 | 104 | 
| 108 void HTMLDialogElement::show() | 105 void HTMLDialogElement::show() | 
| 109 { | 106 { | 
| 110 if (fastHasAttribute(openAttr)) | 107 if (fastHasAttribute(openAttr)) | 
| 111 return; | 108 return; | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 127 bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const | 124 bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const | 
| 128 { | 125 { | 
| 129 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: mo difying an attribute for which there is an attribute selector | 126 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: mo difying an attribute for which there is an attribute selector | 
| 130 // in html.css sometimes does not trigger a style recalc. | 127 // in html.css sometimes does not trigger a style recalc. | 
| 131 if (name == openAttr) | 128 if (name == openAttr) | 
| 132 return true; | 129 return true; | 
| 133 | 130 | 
| 134 return HTMLElement::isPresentationAttribute(name); | 131 return HTMLElement::isPresentationAttribute(name); | 
| 135 } | 132 } | 
| 136 | 133 | 
| 134 bool HTMLDialogElement::shouldBeReparentedUnderRenderView(const RenderStyle* sty le) const | |
| 135 { | |
| 136 if (style && style->position() == AbsolutePosition) | |
| 
Julien - ping for review
2013/05/10 21:04:56
This should probably be needsCenteredPositioning t
 
falken
2013/05/13 03:04:56
needsCenteredPositioning only returns true for aut
 | |
| 137 return true; | |
| 138 return Element::shouldBeReparentedUnderRenderView(style); | |
| 139 } | |
| 140 | |
| 137 } // namespace WebCore | 141 } // namespace WebCore | 
| OLD | NEW |