Changeset 127681 in webkit
- Timestamp:
- Sep 5, 2012 7:24:08 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r127679 r127681 1 2012-09-05 Matt Falkenhagen <falken@chromium.org> 2 3 Vertically center non-anchored <dialog> elements 4 https://bugs.webkit.org/show_bug.cgi?id=90670 5 6 Reviewed by Ojan Vafai. 7 8 * fast/dom/HTMLDialogElement/non-anchored-dialog-positioning-expected.txt: Added. 9 * fast/dom/HTMLDialogElement/non-anchored-dialog-positioning.html: Added. 10 1 11 2012-09-05 Kenichi Ishibashi <bashi@chromium.org> 2 12 -
trunk/Source/WebCore/CMakeLists.txt
r127679 r127681 2036 2036 rendering/RenderDeprecatedFlexibleBox.cpp 2037 2037 rendering/RenderDetailsMarker.cpp 2038 rendering/RenderDialog.cpp 2038 2039 rendering/RenderEmbeddedObject.cpp 2039 2040 rendering/RenderFieldset.cpp -
trunk/Source/WebCore/ChangeLog
r127679 r127681 1 2012-09-05 Matt Falkenhagen <falken@chromium.org> 2 3 Vertically center non-anchored <dialog> elements 4 https://bugs.webkit.org/show_bug.cgi?id=90670 5 6 Reviewed by Ojan Vafai. 7 8 This adjusts the static default position of non-anchored 9 dialog elements so they are vertically centered in or at the top of 10 the viewport, as per the spec. 11 12 The approach is to add a RenderDialog class whose layout() 13 function adjusts the position after normal RenderBlock::layout runs. 14 15 Test: fast/dom/HTMLDialogElement/non-anchored-dialog-positioning.html 16 17 * CMakeLists.txt: 18 * GNUmakefile.list.am: 19 * Target.pri: 20 * WebCore.gypi: 21 * WebCore.xcodeproj/project.pbxproj: 22 * html/HTMLDialogElement.cpp: 23 (WebCore::HTMLDialogElement::createRenderer): 24 (WebCore): 25 * html/HTMLDialogElement.h: 26 (HTMLDialogElement): 27 * rendering/RenderBox.cpp: 28 (WebCore::RenderBox::mapAbsoluteToLocalPoint): Remove assertion since now absoluteToLocal is called during layout. 29 * rendering/RenderBoxModelObject.cpp: 30 (WebCore::RenderBoxModelObject::mapAbsoluteToLocalPoint): Ditto. 31 * rendering/RenderDialog.cpp: Added. 32 (WebCore): 33 (WebCore::RenderDialog::layout): Compute the desired top position in the absolute coordinate system, and then set top to the 34 corresponding local coordinate. 35 * rendering/RenderDialog.h: Added. 36 (WebCore): 37 (RenderDialog): 38 (WebCore::RenderDialog::RenderDialog): 39 (WebCore::RenderDialog::~RenderDialog): 40 (WebCore::RenderDialog::renderName): 41 * rendering/RenderObject.h: 42 (RenderObject): 43 (WebCore::RenderObject::isDialog): 44 * rendering/RenderingAllInOne.cpp: 45 1 46 2012-09-05 Kenichi Ishibashi <bashi@chromium.org> 2 47 -
trunk/Source/WebCore/GNUmakefile.list.am
r127679 r127681 4911 4911 Source/WebCore/rendering/RenderDetailsMarker.cpp \ 4912 4912 Source/WebCore/rendering/RenderDetailsMarker.h \ 4913 Source/WebCore/rendering/RenderDialog.h \ 4913 4914 Source/WebCore/rendering/RenderEmbeddedObject.cpp \ 4914 4915 Source/WebCore/rendering/RenderEmbeddedObject.h \ -
trunk/Source/WebCore/Target.pri
r127579 r127681 1117 1117 rendering/RenderDeprecatedFlexibleBox.cpp \ 1118 1118 rendering/RenderDetailsMarker.cpp \ 1119 rendering/RenderDialog.cpp \ 1119 1120 rendering/RenderEmbeddedObject.cpp \ 1120 1121 rendering/RenderFieldset.cpp \ -
trunk/Source/WebCore/WebCore.gypi
r127679 r127681 566 566 'rendering/RenderBox.h', 567 567 'rendering/RenderBoxModelObject.h', 568 'rendering/RenderDialog.h', 568 569 'rendering/RenderEmbeddedObject.h', 569 570 'rendering/RenderFlowThread.h', … … 4735 4736 'rendering/RenderDetailsMarker.cpp', 4736 4737 'rendering/RenderDetailsMarker.h', 4738 'rendering/RenderDialog.cpp', 4737 4739 'rendering/RenderEmbeddedObject.cpp', 4738 4740 'rendering/RenderFieldset.cpp', -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r127535 r127681 1911 1911 76CDD2F61103DA6600680521 /* AccessibilityMenuListOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */; }; 1912 1912 76CDD2F71103DA6600680521 /* AccessibilityMenuListOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */; }; 1913 76F2E2EB15F74CEF005FF664 /* RenderDialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76F2E2E915F74CEF005FF664 /* RenderDialog.cpp */; }; 1914 76F2E2EC15F74CEF005FF664 /* RenderDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = 76F2E2EA15F74CEF005FF664 /* RenderDialog.h */; }; 1913 1915 76FC2B0B12370DA0006A991A /* DOMTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76FC2B0812370DA0006A991A /* DOMTokenList.cpp */; }; 1914 1916 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 76FC2B0912370DA0006A991A /* DOMTokenList.h */; }; … … 9096 9098 76CDD2F01103DA6600680521 /* AccessibilityMenuListOption.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityMenuListOption.cpp; sourceTree = "<group>"; }; 9097 9099 76CDD2F11103DA6600680521 /* AccessibilityMenuListOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityMenuListOption.h; sourceTree = "<group>"; }; 9100 76F2E2E915F74CEF005FF664 /* RenderDialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderDialog.cpp; sourceTree = "<group>"; }; 9101 76F2E2EA15F74CEF005FF664 /* RenderDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderDialog.h; sourceTree = "<group>"; }; 9098 9102 76FC2B0812370DA0006A991A /* DOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMTokenList.cpp; sourceTree = "<group>"; }; 9099 9103 76FC2B0912370DA0006A991A /* DOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTokenList.h; sourceTree = "<group>"; }; … … 21340 21344 D302754512A5FE84004BD828 /* RenderDetailsMarker.cpp */, 21341 21345 D302754612A5FE84004BD828 /* RenderDetailsMarker.h */, 21346 76F2E2E915F74CEF005FF664 /* RenderDialog.cpp */, 21347 76F2E2EA15F74CEF005FF664 /* RenderDialog.h */, 21342 21348 0F5B7A5210F65D7A00376302 /* RenderEmbeddedObject.cpp */, 21343 21349 0F5B7A5310F65D7A00376302 /* RenderEmbeddedObject.h */, … … 25491 25497 FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */, 25492 25498 FBD6AF8C15EF2604008B7110 /* BasicShapes.h in Headers */, 25499 76F2E2EC15F74CEF005FF664 /* RenderDialog.h in Headers */, 25493 25500 ); 25494 25501 runOnlyForDeploymentPostprocessing = 0; … … 28580 28587 377A3A9015EFCE9B0059F5C7 /* BitmapImageCG.cpp in Sources */, 28581 28588 BCD8A5F015F56F2C0098D071 /* TextBreakIterator.cpp in Sources */, 28589 76F2E2EB15F74CEF005FF664 /* RenderDialog.cpp in Sources */, 28582 28590 ); 28583 28591 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/html/HTMLDialogElement.cpp
r123193 r127681 30 30 31 31 #include "ExceptionCode.h" 32 #include "RenderDialog.h" 32 33 33 34 namespace WebCore { … … 72 73 } 73 74 75 RenderObject* HTMLDialogElement::createRenderer(RenderArena* arena, RenderStyle*) 76 { 77 return new (arena) RenderDialog(this); 78 } 79 74 80 } 75 81 -
trunk/Source/WebCore/html/HTMLDialogElement.h
r123193 r127681 46 46 HTMLDialogElement(const QualifiedName&, Document*); 47 47 48 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; 48 49 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 49 50 }; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r127596 r127681 1355 1355 void RenderBox::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const 1356 1356 { 1357 // We don't expect absoluteToLocal() to be called during layout (yet)1358 ASSERT(!view() || !view()->layoutStateEnabled());1359 1360 1357 bool isFixedPos = style()->position() == FixedPosition; 1361 1358 bool hasTransform = hasLayer() && layer()->transform(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r127497 r127681 2832 2832 void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const 2833 2833 { 2834 // We don't expect absoluteToLocal() to be called during layout (yet)2835 ASSERT(!view() || !view()->layoutStateEnabled());2836 2837 2834 RenderObject* o = container(); 2838 2835 if (!o) -
trunk/Source/WebCore/rendering/RenderDialog.cpp
r127680 r127681 25 25 26 26 #include "config.h" 27 #include " HTMLDialogElement.h"27 #include "RenderDialog.h" 28 28 29 29 #if ENABLE(DIALOG_ELEMENT) 30 31 #include "ExceptionCode.h" 30 #include "FrameView.h" 31 #include "LayoutRepainter.h" 32 #include "RenderLayer.h" 33 #include "RenderView.h" 32 34 33 35 namespace WebCore { 34 36 35 using namespace HTMLNames; 37 void RenderDialog::layout() 38 { 39 LayoutRepainter repainter(*this, true); 40 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); 36 41 37 HTMLDialogElement::HTMLDialogElement(const QualifiedName& tagName, Document* document) 38 : HTMLElement(tagName, document) 39 { 40 ASSERT(hasTagName(dialogTag)); 41 } 42 RenderBlock::layout(); 42 43 43 PassRefPtr<HTMLDialogElement> HTMLDialogElement::create(const QualifiedName& tagName, Document* document) 44 { 45 return adoptRef(new HTMLDialogElement(tagName, document)); 46 } 47 48 void HTMLDialogElement::close(ExceptionCode& ec) 49 { 50 if (!fastHasAttribute(openAttr)) { 51 ec = INVALID_STATE_ERR; 44 RenderStyle* styleToUse = style(); 45 if (styleToUse->position() != AbsolutePosition || !styleToUse->top().isAuto() || !styleToUse->bottom().isAuto()) { 46 statePusher.pop(); 52 47 return; 53 48 } 54 setBooleanAttribute(openAttr, false);55 }56 49 57 void HTMLDialogElement::show() 58 { 59 if (fastHasAttribute(openAttr)) 60 return; 61 setBooleanAttribute(openAttr, true); 62 } 50 // Adjust the dialog's position to be centered in or at the top of the viewport. 51 // FIXME: Figure out what to do in vertical writing mode. 52 FrameView* frameView = document()->view(); 53 int scrollTop = frameView->scrollOffset().height(); 54 FloatPoint absolutePoint(0, scrollTop); 55 int visibleHeight = frameView->visibleContentRect(true).height(); 56 if (height() < visibleHeight) 57 absolutePoint.move(0, (visibleHeight - height()) / 2); 58 FloatPoint localPoint = containingBlock()->absoluteToLocal(absolutePoint); 59 LayoutUnit localTop = LayoutSize(localPoint.x(), localPoint.y()).height(); 60 setY(localTop); 63 61 64 bool HTMLDialogElement::isPresentationAttribute(const QualifiedName& name) const 65 { 66 // FIXME: Workaround for <https://bugs.webkit.org/show_bug.cgi?id=91058>: modifying an attribute for which there is an attribute selector 67 // in html.css sometimes does not trigger a style recalc. 68 if (name == openAttr) 69 return true; 70 71 return HTMLElement::isPresentationAttribute(name); 62 statePusher.pop(); 63 // FIXME: Since there is always a layer here, repainter shouldn't be necessary. But without it, the dialog is sometimes not painted (see bug 90670). 64 repainter.repaintAfterLayout(); 72 65 } 73 66 -
trunk/Source/WebCore/rendering/RenderDialog.h
r127680 r127681 24 24 */ 25 25 26 #ifndef HTMLDialogElement_h27 #define HTMLDialogElement_h26 #ifndef RenderDialog_h 27 #define RenderDialog_h 28 28 29 29 #if ENABLE(DIALOG_ELEMENT) 30 31 #include " HTMLElement.h"30 #include "RenderBlock.h" 31 #include "RenderWidget.h" 32 32 33 33 namespace WebCore { 34 34 35 class Document; 36 class QualifiedName; 35 class HTMLDialogElement; 37 36 38 class HTMLDialogElement : public HTMLElement{37 class RenderDialog : public RenderBlock { 39 38 public: 40 static PassRefPtr<HTMLDialogElement> create(const QualifiedName&, Document*); 39 explicit RenderDialog(Node* node) 40 : RenderBlock(node) 41 { } 41 42 42 v oid close(ExceptionCode&);43 v oid show();43 virtual ~RenderDialog() { } 44 virtual void layout() OVERRIDE; 44 45 45 46 private: 46 HTMLDialogElement(const QualifiedName&, Document*); 47 48 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 47 virtual const char* renderName() const { return "RenderDialog"; } 48 virtual bool isDialog() const OVERRIDE { return true; } 49 49 }; 50 50 … … 53 53 #endif 54 54 55 #endif 55 #endif // RenderDialog_h -
trunk/Source/WebCore/rendering/RenderObject.h
r127608 r127681 312 312 virtual bool isBoxModelObject() const { return false; } 313 313 virtual bool isCounter() const { return false; } 314 #if ENABLE(DIALOG_ELEMENT) 315 virtual bool isDialog() const { return false; } 316 #endif 314 317 virtual bool isQuote() const { return false; } 315 318 -
trunk/Source/WebCore/rendering/RenderingAllInOne.cpp
r120569 r127681 52 52 #include "RenderDeprecatedFlexibleBox.cpp" 53 53 #include "RenderDetailsMarker.cpp" 54 #include "RenderDialog.cpp" 54 55 #include "RenderEmbeddedObject.cpp" 55 56 #include "RenderFieldset.cpp"
Note: See TracChangeset
for help on using the changeset viewer.