Changeset 84511 in webkit
- Timestamp:
- Apr 21, 2011 9:51:55 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 16 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r84509 r84511 1 2011-04-20 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Content of <summary> should be forwarded through the shadow DOM 6 https://bugs.webkit.org/show_bug.cgi?id=58914 7 8 - Added test cases for dynamic DOM change. 9 - Updated expectations details-open2.html because generated RenderTree slightly changed. 10 11 * fast/html/details-add-summary-child-1.html: Added. 12 * fast/html/details-add-summary-child-2.html: Added. 13 * fast/html/details-remove-summary-child-1.html: Added. 14 * fast/html/details-remove-summary-child-2.html: Added. 15 * platform/chromium/test_expectations.txt: 16 * platform/mac/fast/html/details-add-summary-child-1-expected.checksum: Added. 17 * platform/mac/fast/html/details-add-summary-child-1-expected.png: Added. 18 * platform/mac/fast/html/details-add-summary-child-1-expected.txt: Added. 19 * platform/mac/fast/html/details-add-summary-child-2-expected.checksum: Added. 20 * platform/mac/fast/html/details-add-summary-child-2-expected.png: Added. 21 * platform/mac/fast/html/details-add-summary-child-2-expected.txt: Added. 22 * platform/mac/fast/html/details-open2-expected.txt: 23 * platform/mac/fast/html/details-remove-summary-child-1-expected.checksum: Added. 24 * platform/mac/fast/html/details-remove-summary-child-1-expected.png: Added. 25 * platform/mac/fast/html/details-remove-summary-child-1-expected.txt: Added. 26 * platform/mac/fast/html/details-remove-summary-child-2-expected.checksum: Added. 27 * platform/mac/fast/html/details-remove-summary-child-2-expected.png: Added. 28 * platform/mac/fast/html/details-remove-summary-child-2-expected.txt: Added. 29 1 30 2011-04-20 Matthew Delaney <mdelaney@apple.com> 2 31 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r84503 r84511 3506 3506 BUGCR79770 WIN : fast/html/details-add-summary-8.html = IMAGE 3507 3507 BUGCR79770 WIN : fast/forms/select-background-none.html = IMAGE 3508 3509 // Need rebaselining 3510 BUGWK58914 : fast/html/details-add-summary-child-1.html = FAIL 3511 BUGWK58914 : fast/html/details-add-summary-child-2.html = FAIL 3512 BUGWK58914 : fast/html/details-remove-summary-child-1.html = FAIL 3513 BUGWK58914 : fast/html/details-remove-summary-child-2.html = FAIL 3514 BUGWK58914 : fast/html/details-open2.html = FAIL 3508 3515 3509 3516 // Temporarily marked as failing for rebaselining. -
trunk/LayoutTests/platform/mac/fast/html/details-open2-expected.txt
r84039 r84511 13 13 RenderTextControl {INPUT} at (2,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)] 14 14 RenderText {#text} at (0,0) size 0x0 15 RenderText {#text} at (0,0) size 0x0 15 16 layer at (13,31) size 119x13 16 17 RenderBlock {DIV} at (3,3) size 119x13 -
trunk/Source/WebCore/ChangeLog
r84510 r84511 1 2011-04-20 MORITA Hajime <morrita@google.com> 2 3 Reviewed by Dimitri Glazkov. 4 5 Content of <summary> should be forwarded through the shadow DOM 6 https://bugs.webkit.org/show_bug.cgi?id=58914 7 8 - Introduced ShadowContentElement which hosts forwarded children of <summary> 9 - Encapsulated Node::parentNodeForRenderingAndStyle() and shouldCreateRendererFor() 10 into NodeVisualParentLookupResult class. 11 - The parent lookup is also aware of node forwarding. If the visual parent node has 12 a shadow root, the node is possibly forwarded to ShadowContentElement 13 - ShadowContentElement lookup is implemented inside ShadowRoot. 14 15 Tests: fast/html/details-add-summary-child-1.html 16 fast/html/details-add-summary-child-2.html 17 fast/html/details-remove-summary-child-1.html 18 fast/html/details-remove-summary-child-2.html 19 20 * GNUmakefile.list.am: 21 * WebCore.gypi: 22 * WebCore.vcproj/WebCore.vcproj: 23 * WebCore.xcodeproj/project.pbxproj: 24 * dom/Element.cpp: 25 (WebCore::Element::childrenChanged): 26 * dom/Node.cpp: 27 (WebCore::NodeRenderParentDetector::NodeRenderParentDetector): 28 (WebCore::NodeRenderParentDetector::parentNodeForRenderingAndStyle): 29 (WebCore::NodeRenderParentDetector::findVisualParent): 30 (WebCore::NodeRenderParentDetector::shouldCreateRenderer): 31 (WebCore::Node::parentNodeForRenderingAndStyle): 32 (WebCore::Node::createRendererAndStyle): 33 * dom/ShadowRoot.cpp: 34 (WebCore::ShadowRoot::contentContainerFor): 35 (WebCore::ShadowRoot::hostChildrenChanged): 36 (WebCore::ShadowRoot::firstContentElement): 37 * dom/ShadowRoot.h: 38 * html/HTMLSummaryElement.cpp: 39 (WebCore::HTMLSummaryElement::createShadowSubtree): 40 * html/HTMLSummaryElement.h: 41 * html/shadow/ShadowContentElement.h: Copied from Source/WebCore/dom/ShadowRoot.h. 42 (WebCore::ShadowContentElement::ShadowContentElement): 43 (WebCore::ShadowContentElement::isShadowBoundary): 44 (WebCore::ShadowContentElement::createRenderer): 45 (WebCore::ShadowContentElement::create): 46 1 47 2011-04-21 Andrey Kosyakov <caseq@chromium.org> 2 48 -
trunk/Source/WebCore/GNUmakefile.list.am
r84498 r84511 1856 1856 Source/WebCore/html/shadow/ProgressShadowElement.cpp \ 1857 1857 Source/WebCore/html/shadow/ProgressShadowElement.h \ 1858 Source/WebCore/html/shadow/ShadowContentElement.h \ 1858 1859 Source/WebCore/html/shadow/SliderThumbElement.cpp \ 1859 1860 Source/WebCore/html/shadow/SliderThumbElement.h \ -
trunk/Source/WebCore/WebCore.gypi
r84498 r84511 3190 3190 'html/shadow/ProgressShadowElement.cpp', 3191 3191 'html/shadow/ProgressShadowElement.h', 3192 'html/shadow/ShadowContentElement.h', 3192 3193 'html/shadow/SliderThumbElement.cpp', 3193 3194 'html/shadow/SliderThumbElement.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r84498 r84511 56770 56770 </File> 56771 56771 <File 56772 RelativePath="..\html\shadow\ShadowContentElement.h" 56773 > 56774 </File> 56775 <File 56772 56776 RelativePath="..\html\shadow\SliderThumbElement.cpp" 56773 56777 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r84498 r84511 3240 3240 A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */; }; 3241 3241 A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3242 A7477538135FC56900937899 /* ShadowContentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7477537135FC56900937899 /* ShadowContentElement.h */; }; 3242 3243 A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3243 3244 A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; }; … … 9813 9814 A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedIntRect.cpp; sourceTree = "<group>"; }; 9814 9815 A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedIntRect.h; sourceTree = "<group>"; }; 9816 A7477537135FC56900937899 /* ShadowContentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowContentElement.h; sourceTree = "<group>"; }; 9815 9817 A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; }; 9816 9818 A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; }; … … 13558 13560 A715E650134BBBEC00D8E713 /* ProgressShadowElement.cpp */, 13559 13561 A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */, 13562 A7477537135FC56900937899 /* ShadowContentElement.h */, 13560 13563 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */, 13561 13564 4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */, … … 22422 22425 498770E91242C535002226BA /* Shader.h in Headers */, 22423 22426 0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */, 22427 A7477538135FC56900937899 /* ShadowContentElement.h in Headers */, 22424 22428 BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */, 22425 22429 A7F338A411C0EFCA00A320A7 /* ShadowElement.h in Headers */, -
trunk/Source/WebCore/dom/Element.cpp
r84039 r84511 1308 1308 else 1309 1309 checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta); 1310 if (ShadowRoot* shadow = toShadowRoot(shadowRoot())) 1311 shadow->hostChildrenChanged(); 1310 1312 } 1311 1313 -
trunk/Source/WebCore/dom/Node.cpp
r84394 r84511 1447 1447 } 1448 1448 1449 ContainerNode* Node::parentNodeForRenderingAndStyle() const 1450 { 1451 ContainerNode* parent = parentOrHostNode(); 1452 return parent && parent->isShadowBoundary() ? parent->shadowHost() : parent; 1453 } 1454 1455 static bool shouldCreateRendererFor(Node* node, ContainerNode* parentForRenderingAndStyle) 1456 { 1457 RenderObject* parentRenderer = parentForRenderingAndStyle->renderer(); 1449 1450 class NodeRenderParentDetector { 1451 public: 1452 enum Type { 1453 NotFound, 1454 AsLightChild, 1455 AsShadowChild, 1456 AsContentChild 1457 }; 1458 1459 NodeRenderParentDetector(Node* node) 1460 : m_type(NotFound) 1461 , m_node(node) 1462 , m_visualParentShadowRoot(0) 1463 { 1464 m_parentNodeForRenderingAndStyle = findVisualParent(); 1465 } 1466 1467 ContainerNode* parentNodeForRenderingAndStyle() const { return m_parentNodeForRenderingAndStyle; } 1468 bool shouldCreateRenderer() const; 1469 1470 private: 1471 ContainerNode* findVisualParent(); 1472 1473 Type m_type; 1474 Node* m_node; 1475 ContainerNode* m_parentNodeForRenderingAndStyle; 1476 ShadowRoot* m_visualParentShadowRoot; 1477 }; 1478 1479 ContainerNode* NodeRenderParentDetector::findVisualParent() 1480 { 1481 ContainerNode* parent = m_node->parentOrHostNode(); 1482 if (!parent) 1483 return 0; 1484 1485 if (parent->isShadowBoundary()) { 1486 m_type = AsShadowChild; 1487 return parent->shadowHost(); 1488 } 1489 1490 if (parent->isElementNode()) { 1491 m_visualParentShadowRoot = toShadowRoot(toElement(parent)->shadowRoot()); 1492 if (m_visualParentShadowRoot) { 1493 if (ContainerNode* contentContainer = m_visualParentShadowRoot->contentContainerFor(m_node)) { 1494 m_type = AsContentChild; 1495 return NodeRenderParentDetector(contentContainer).parentNodeForRenderingAndStyle(); 1496 } 1497 1498 // FIXME: should be not found once light/shadow is mutual exclusive. 1499 } 1500 } 1501 1502 m_type = AsLightChild; 1503 return parent; 1504 } 1505 1506 bool NodeRenderParentDetector::shouldCreateRenderer() const 1507 { 1508 ASSERT(m_parentNodeForRenderingAndStyle); 1509 1510 RenderObject* parentRenderer = m_parentNodeForRenderingAndStyle->renderer(); 1458 1511 if (!parentRenderer) 1459 1512 return false; 1460 1513 1461 bool atShadowBoundary = node->parentOrHostNode()->isShadowBoundary(); 1462 1463 // FIXME: Ignoring canHaveChildren() in a case of isShadowRoot() might be wrong. 1464 // See https://bugs.webkit.org/show_bug.cgi?id=52423 1465 if (!parentRenderer->canHaveChildren() && !(node->isShadowRoot() || atShadowBoundary)) 1514 if (m_type == AsLightChild) { 1515 // FIXME: Ignoring canHaveChildren() in a case of shadow children might be wrong. 1516 // See https://bugs.webkit.org/show_bug.cgi?id=52423 1517 if (!parentRenderer->canHaveChildren()) 1518 return false; 1519 1520 if (m_visualParentShadowRoot && !m_parentNodeForRenderingAndStyle->canHaveLightChildRendererWithShadow()) 1521 return false; 1522 } 1523 1524 if (!m_parentNodeForRenderingAndStyle->childShouldCreateRenderer(m_node)) 1466 1525 return false; 1467 1526 1468 if (shadowRoot(parentForRenderingAndStyle) && !atShadowBoundary1469 && !parentForRenderingAndStyle->canHaveLightChildRendererWithShadow())1470 return false;1471 1472 if (!parentForRenderingAndStyle->childShouldCreateRenderer(node))1473 return false;1474 1475 1527 return true; 1528 } 1529 1530 1531 ContainerNode* Node::parentNodeForRenderingAndStyle() const 1532 { 1533 return NodeRenderParentDetector(const_cast<Node*>(this)).parentNodeForRenderingAndStyle(); 1476 1534 } 1477 1535 … … 1481 1539 ASSERT(document()->shouldCreateRenderers()); 1482 1540 1483 ContainerNode* parent = parentNodeForRenderingAndStyle(); 1484 ASSERT(parent); 1485 1486 if (!shouldCreateRendererFor(this, parent)) 1541 NodeRenderParentDetector parentDetector(this); 1542 if (!parentDetector.shouldCreateRenderer()) 1487 1543 return 0; 1488 1544 … … 1495 1551 return 0; 1496 1552 1497 if (!parent ->renderer()->isChildAllowed(newRenderer, style.get())) {1553 if (!parentDetector.parentNodeForRenderingAndStyle()->renderer()->isChildAllowed(newRenderer, style.get())) { 1498 1554 newRenderer->destroy(); 1499 1555 return 0; -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r84394 r84511 27 27 #include "config.h" 28 28 #include "ShadowRoot.h" 29 #include "Element.h" 29 30 30 31 #include "Document.h" … … 90 91 } 91 92 93 ContainerNode* ShadowRoot::contentContainerFor(Node*) 94 { 95 // Current limitation: 96 // - There is at most one content element for each shadow tree 97 // - The shadow tree accepts any light node. 98 return firstContentElement(); 92 99 } 100 101 void ShadowRoot::hostChildrenChanged() 102 { 103 if (!firstContentElement()) 104 return; 105 Element* host = shadowHost(); 106 if (!host || !host->attached()) 107 return; 108 host->detach(); 109 host->lazyAttach(); 110 } 111 112 ContainerNode* ShadowRoot::firstContentElement() const 113 { 114 for (Node* n = firstChild(); n; n = n->traverseNextNode(this)) { 115 // FIXME: This should be replaced with tag-name checking once <content> is ready. 116 // See also http://webkit.org/b/56973 117 if (n->isShadowBoundary()) 118 return toContainerNode(n); 119 } 120 121 return 0; 122 } 123 124 } -
trunk/Source/WebCore/dom/ShadowRoot.h
r84394 r84511 41 41 virtual void recalcStyle(StyleChange = NoChange); 42 42 43 ContainerNode* contentContainerFor(Node*); 44 void hostChildrenChanged(); 45 43 46 private: 44 47 ShadowRoot(Document*); … … 49 52 virtual PassRefPtr<Node> cloneNode(bool deep); 50 53 virtual bool childTypeAllowed(NodeType) const; 54 55 ContainerNode* firstContentElement() const; 51 56 }; 52 57 -
trunk/Source/WebCore/html/HTMLSummaryElement.cpp
r84039 r84511 28 28 #include "PlatformMouseEvent.h" 29 29 #include "RenderSummary.h" 30 #include "ShadowContentElement.h" 30 31 31 32 namespace WebCore { … … 55 56 ExceptionCode ec = 0; 56 57 ensureShadowRoot()->appendChild(DetailsMarkerControl::create(document()), ec, true); 58 ensureShadowRoot()->appendChild(ShadowContentElement::create(document()), ec, true); 57 59 } 58 60 -
trunk/Source/WebCore/html/HTMLSummaryElement.h
r84039 r84511 38 38 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 39 39 virtual void defaultEventHandler(Event*); 40 virtual void createShadowSubtree();41 virtual bool canHaveLightChildRendererWithShadow() const { return true; }42 40 41 void createShadowSubtree(); 43 42 HTMLDetailsElement* detailsElement() const; 44 43 }; -
trunk/Source/WebCore/html/shadow/ShadowContentElement.h
r84510 r84511 8 8 * * Redistributions of source code must retain the above copyright 9 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 10 14 * * Neither the name of Google Inc. nor the names of its 11 15 * contributors may be used to endorse or promote products derived from … … 25 29 */ 26 30 27 #ifndef Shadow Root_h28 #define Shadow Root_h31 #ifndef ShadowContentElement_h 32 #define ShadowContentElement_h 29 33 30 #include "TreeScope.h" 34 #include "HTMLDivElement.h" 35 #include "HTMLNames.h" 36 #include <wtf/Forward.h> 31 37 32 38 namespace WebCore { 33 39 34 class Document; 40 // NOTE: Current implementation doesn't support dynamic insertion/deletion of ShadowContentElement. 41 // You should create ShadowContentElement during the host construction. 42 class ShadowContentElement : public HTMLDivElement { 43 public: 44 ShadowContentElement(Document* document) 45 : HTMLDivElement(HTMLNames::divTag, document) 46 { 47 } 35 48 36 class ShadowRoot : public TreeScope { 37 public: 38 static PassRefPtr<ShadowRoot> create(Document*); 39 40 virtual bool isShadowBoundary() const { return true; } 41 virtual void recalcStyle(StyleChange = NoChange); 49 static PassRefPtr<ShadowContentElement> create(Document*); 42 50 43 51 private: 44 ShadowRoot(Document*); 45 virtual ~ShadowRoot(); 46 47 virtual String nodeName() const; 48 virtual NodeType nodeType() const; 49 virtual PassRefPtr<Node> cloneNode(bool deep); 50 virtual bool childTypeAllowed(NodeType) const; 52 // FIXME: This should be replaced with tag-name checking once <content> is ready. 53 // See also http://webkit.org/b/56973 54 virtual bool isShadowBoundary() const { return true; } 55 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; } 51 56 }; 52 57 53 inline PassRefPtr<Shadow Root> ShadowRoot::create(Document* document)58 inline PassRefPtr<ShadowContentElement> ShadowContentElement::create(Document* document) 54 59 { 55 return adoptRef(new Shadow Root(document));60 return adoptRef(new ShadowContentElement(document)); 56 61 } 57 62 58 inline ShadowRoot* toShadowRoot(Node* node)59 {60 ASSERT(!node || node->isShadowBoundary());61 return static_cast<ShadowRoot*>(node);62 63 } 63 64 64 } // namespace65 66 65 #endif
Note: See TracChangeset
for help on using the changeset viewer.