<https://webkit.org/b/120025> REGRESSION (r154254): fast/frames/frameset-frameborder...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Aug 2013 15:25:04 +0000 (15:25 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Aug 2013 15:25:04 +0000 (15:25 +0000)
Reviewed by Anders Carlsson.

Source/WebCore:

* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::isFrameSet):
* html/HTMLFrameElement.cpp:
(WebCore::HTMLFrameElement::didAttachRenderers):

    Make helper public in HTMLFrameSetElement.

* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::findContaining):

    Static function for finding containing frameset, if any.

(WebCore::HTMLFrameSetElement::willAttachRenderers):

    This broke in refactoring. We should exit the loop when the first containing frameset is found. Fix by refactoring more.

* html/HTMLFrameSetElement.h:
(WebCore::isHTMLFrameSetElement):
(WebCore::toHTMLFrameSetElement):

    Add casting functions.

* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::frameSet):

LayoutTests:

* platform/mac/TestExpectations: Unskip.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154326 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLFrameElement.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLFrameSetElement.h
Source/WebCore/rendering/RenderFrameSet.cpp

index 9b37d62..2a0b909 100644 (file)
@@ -1,5 +1,13 @@
 2013-08-20  Antti Koivisto  <antti@apple.com>
 
+        <https://webkit.org/b/120025> REGRESSION (r154254): fast/frames/frameset-frameborder-inheritance.html failing on Apple MountainLion Debug WK1 (Tests)
+
+        Reviewed by Anders Carlsson.
+
+        * platform/mac/TestExpectations: Unskip.
+
+2013-08-20  Antti Koivisto  <antti@apple.com>
+
         <https://webkit.org/b/120023> REGRESSION(r154257): svg/custom/bug78807.svg and svg/custom/use-invalid-style.svg failing
 
         Reviewed by by Andreas Kling.
index 133284b..ea6d5ac 100644 (file)
@@ -1276,8 +1276,6 @@ webkit.org/b/105988 [ Debug ] inspector/debugger/properties-special.html [ Pass
 webkit.org/b/105988 [ Debug ] inspector/debugger/reveal-execution-line.html [ Pass Crash ]
 webkit.org/b/105988 [ Debug ] inspector/debugger/watch-expressions-preserve-expansion.html [ Pass Crash ]
 
-webkit.org/b/120025 fast/frames/frameset-frameborder-inheritance.html [ Failure ]
-
 # Fails with WebKit1 only.
 editing/secure-input/reset-state-on-navigation.html [ Failure ]
 
index 177ad84..68dbd40 100644 (file)
@@ -1,5 +1,36 @@
 2013-08-20  Antti Koivisto  <antti@apple.com>
 
+        <https://webkit.org/b/120025> REGRESSION (r154254): fast/frames/frameset-frameborder-inheritance.html failing on Apple MountainLion Debug WK1 (Tests)
+
+        Reviewed by Anders Carlsson.
+
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::isFrameSet):
+        * html/HTMLFrameElement.cpp:
+        (WebCore::HTMLFrameElement::didAttachRenderers):
+        
+            Make helper public in HTMLFrameSetElement.
+
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::findContaining):
+        
+            Static function for finding containing frameset, if any.
+
+        (WebCore::HTMLFrameSetElement::willAttachRenderers):
+        
+            This broke in refactoring. We should exit the loop when the first containing frameset is found. Fix by refactoring more.
+
+        * html/HTMLFrameSetElement.h:
+        (WebCore::isHTMLFrameSetElement):
+        (WebCore::toHTMLFrameSetElement):
+        
+            Add casting functions.
+
+        * rendering/RenderFrameSet.cpp:
+        (WebCore::RenderFrameSet::frameSet):
+
+2013-08-20  Antti Koivisto  <antti@apple.com>
+
         <https://webkit.org/b/120023> REGRESSION(r154257): svg/custom/bug78807.svg and svg/custom/use-invalid-style.svg failing
 
         Reviewed by Andreas Kling.
index 9f2de62..95a5a99 100644 (file)
@@ -68,6 +68,7 @@
 #include "HTMLBodyElement.h"
 #include "HTMLElementFactory.h"
 #include "HTMLFrameOwnerElement.h"
+#include "HTMLFrameSetElement.h"
 #include "HTMLNames.h"
 #include "InspectorInstrumentation.h"
 #include "KURL.h"
@@ -392,7 +393,7 @@ void HTMLDocument::clear()
 bool HTMLDocument::isFrameSet() const
 {
     HTMLElement* bodyElement = body();
-    return bodyElement && bodyElement->hasTagName(framesetTag);
+    return bodyElement && isHTMLFrameSetElement(bodyElement);
 }
 
 }
index c5ef297..84e181c 100644 (file)
@@ -59,15 +59,6 @@ RenderObject* HTMLFrameElement::createRenderer(RenderArena* arena, RenderStyle*)
     return new (arena) RenderFrame(this);
 }
 
-static inline HTMLFrameSetElement* containingFrameSetElement(Node* node)
-{
-    while ((node = node->parentNode())) {
-        if (node->hasTagName(framesetTag))
-            return static_cast<HTMLFrameSetElement*>(node);
-    }
-    return 0;
-}
-
 bool HTMLFrameElement::noResize() const
 {
     return hasAttribute(noresizeAttr);
@@ -76,10 +67,11 @@ bool HTMLFrameElement::noResize() const
 void HTMLFrameElement::didAttachRenderers()
 {
     HTMLFrameElementBase::didAttachRenderers();
-    if (HTMLFrameSetElement* frameSetElement = containingFrameSetElement(this)) {
-        if (!m_frameBorderSet)
-            m_frameBorder = frameSetElement->hasFrameBorder();
-    }
+    const HTMLFrameSetElement* containingFrameSet = HTMLFrameSetElement::findContaining(this);
+    if (!containingFrameSet)
+        return;
+    if (!m_frameBorderSet)
+        m_frameBorder = containingFrameSet->hasFrameBorder();
 }
 
 void HTMLFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
index d8d0283..55e2264 100644 (file)
@@ -164,25 +164,32 @@ RenderObject *HTMLFrameSetElement::createRenderer(RenderArena *arena, RenderStyl
     return new (arena) RenderFrameSet(this);
 }
 
+HTMLFrameSetElement* HTMLFrameSetElement::findContaining(Node* node)
+{
+    for (Element* parent = node->parentElement(); parent; parent = parent->parentElement()) {
+        if (isHTMLFrameSetElement(parent))
+            return toHTMLFrameSetElement(parent);
+    }
+    return 0;
+}
+
 void HTMLFrameSetElement::willAttachRenderers()
 {
-    // Inherit default settings from parent frameset
+    // Inherit default settings from parent frameset.
     // FIXME: This is not dynamic.
-    for (ContainerNode* node = parentNode(); node; node = node->parentNode()) {
-        if (!node->hasTagName(framesetTag))
-            continue;
-        HTMLFrameSetElement* frameset = static_cast<HTMLFrameSetElement*>(node);
-        if (!m_frameborderSet)
-            m_frameborder = frameset->hasFrameBorder();
-        if (m_frameborder) {
-            if (!m_borderSet)
-                m_border = frameset->border();
-            if (!m_borderColorSet)
-                m_borderColorSet = frameset->hasBorderColor();
-        }
-        if (!m_noresize)
-            m_noresize = frameset->noResize();
+    const HTMLFrameSetElement* containingFrameSet = findContaining(this);
+    if (!containingFrameSet)
+        return;
+    if (!m_frameborderSet)
+        m_frameborder = containingFrameSet->hasFrameBorder();
+    if (m_frameborder) {
+        if (!m_borderSet)
+            m_border = containingFrameSet->border();
+        if (!m_borderColorSet)
+            m_borderColorSet = containingFrameSet->hasBorderColor();
     }
+    if (!m_noresize)
+        m_noresize = containingFrameSet->noResize();
 }
 
 void HTMLFrameSetElement::defaultEventHandler(Event* evt)
index 2756362..de10ef9 100644 (file)
@@ -45,6 +45,8 @@ public:
     const Length* rowLengths() const { return m_rowLengths.get(); }
     const Length* colLengths() const { return m_colLengths.get(); }
 
+    static HTMLFrameSetElement* findContaining(Node* descendant);
+
     // Declared virtual in Element
     DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(blur);
     DEFINE_WINDOW_ATTRIBUTE_EVENT_LISTENER(error);
@@ -98,6 +100,28 @@ private:
     bool m_noresize;
 };
 
+inline bool isHTMLFrameSetElement(const Node* node)
+{
+    return node->hasTagName(HTMLNames::framesetTag);
+}
+
+inline bool isHTMLFrameSetElement(const Element* element)
+{
+    return element->hasTagName(HTMLNames::framesetTag);
+}
+
+inline HTMLFrameSetElement* toHTMLFrameSetElement(Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLFrameSetElement(node));
+    return static_cast<HTMLFrameSetElement*>(node);
+}
+
+inline const HTMLFrameSetElement* toHTMLFrameSetElement(const Node* node)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!node || isHTMLFrameSetElement(node));
+    return static_cast<const HTMLFrameSetElement*>(node);
+}
+
 } // namespace WebCore
 
 #endif // HTMLFrameSetElement_h
index 911d8b4..95122b0 100644 (file)
@@ -63,7 +63,7 @@ RenderFrameSet::GridAxis::GridAxis()
 
 inline HTMLFrameSetElement* RenderFrameSet::frameSet() const
 {
-    return static_cast<HTMLFrameSetElement*>(node());
+    return toHTMLFrameSetElement(node());
 }
 
 static Color borderStartEdgeColor()