Diff
Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193564 => 193565)
--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog 2015-12-06 07:11:59 UTC (rev 193565)
@@ -1,5 +1,27 @@
2015-12-05 Babak Shafiei <[email protected]>
+ Merge r192953.
+
+ 2015-12-01 David Hyatt <[email protected]>
+
+ Implement the picture element.
+ https://bugs.webkit.org/show_bug.cgi?id=116963
+
+ Reviewed by Dean Jackson.
+
+ * fast/picture: Added.
+ * fast/picture/image-picture-1x-expected.txt: Added.
+ * fast/picture/image-picture-1x.html: Added.
+ * fast/picture/resources: Added.
+ * fast/picture/resources/blue_rect.jpg: Added.
+ * fast/picture/resources/currentSrcHelper.js: Added.
+ (fileName):
+ (currentSrcFileName):
+ (currentSrcFileNameNoParams):
+ * fast/picture/resources/image-set-4x.png: Added.
+
+2015-12-05 Babak Shafiei <[email protected]>
+
Merge r191252.
2015-10-17 David Hyatt <[email protected]>
Modified: branches/safari-601.1.46-branch/LayoutTests/imported/w3c/ChangeLog (193564 => 193565)
--- branches/safari-601.1.46-branch/LayoutTests/imported/w3c/ChangeLog 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/LayoutTests/imported/w3c/ChangeLog 2015-12-06 07:11:59 UTC (rev 193565)
@@ -1,3 +1,19 @@
+2015-12-05 Babak Shafiei <[email protected]>
+
+ Merge r192953.
+
+ 2015-12-01 David Hyatt <[email protected]>
+
+ Implement the picture element.
+ https://bugs.webkit.org/show_bug.cgi?id=116963
+
+ Reviewed by Dean Jackson.
+
+ * web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-expected.txt:
+ * web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/parse-a-srcset-attribute-expected.txt:
+ * web-platform-tests/html/semantics/embedded-content/the-img-element/srcset/select-an-image-source-expected.txt:
+ * web-platform-tests/html/semantics/embedded-content/the-img-element/update-the-source-set-expected.txt:
+
2015-04-13 Alexey Proskuryakov <[email protected]>
imported/w3c/canvas/2d.text.measure.width.empty.html is flaky
Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt (193564 => 193565)
--- branches/safari-601.1.46-branch/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt 2015-12-06 07:11:59 UTC (rev 193565)
@@ -623,6 +623,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').value is HTMLPictureElement
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').value is HTMLPreElement
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').hasOwnProperty('set') is false
Modified: branches/safari-601.1.46-branch/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt (193564 => 193565)
--- branches/safari-601.1.46-branch/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt 2015-12-06 07:11:59 UTC (rev 193565)
@@ -623,6 +623,11 @@
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').hasOwnProperty('set') is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').enumerable is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLParamElement').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').value is HTMLPictureElement
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'HTMLPictureElement').configurable is true
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').value is HTMLPreElement
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').hasOwnProperty('get') is false
PASS Object.getOwnPropertyDescriptor(global, 'HTMLPreElement').hasOwnProperty('set') is false
Modified: branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/CMakeLists.txt 2015-12-06 07:11:59 UTC (rev 193565)
@@ -519,6 +519,7 @@
html/HTMLOutputElement.idl
html/HTMLParagraphElement.idl
html/HTMLParamElement.idl
+ html/HTMLPictureElement.idl
html/HTMLPreElement.idl
html/HTMLProgressElement.idl
html/HTMLQuoteElement.idl
@@ -1667,6 +1668,7 @@
html/HTMLOutputElement.cpp
html/HTMLParagraphElement.cpp
html/HTMLParamElement.cpp
+ html/HTMLPictureElement.cpp
html/HTMLPlugInElement.cpp
html/HTMLPlugInImageElement.cpp
html/HTMLPreElement.cpp
Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog 2015-12-06 07:11:59 UTC (rev 193565)
@@ -1,5 +1,74 @@
2015-12-05 Babak Shafiei <[email protected]>
+ Merge r192953.
+
+ 2015-11-30 David Hyatt <[email protected]>
+
+ Implement the picture element.
+ https://bugs.webkit.org/show_bug.cgi?id=116963
+
+ Reviewed by Dean Jackson.
+
+ Added fast/picture tests.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Add HTMLPictureElement.* to the project.
+
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::setBestFitURLAndDPRFromImageCandidate):
+ Remove the CURRENT_SRC ifdef.
+
+ (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
+ New helper function that checks the <source> elements of a <picture> parent
+ for the best match.
+
+ (WebCore::HTMLImageElement::selectImageSource):
+ Pull out the process of image selection into its own function so that this can
+ be called from many places (to ensure that dynamic changes are reflected as elements
+ get changed, added or removed).
+
+ (WebCore::HTMLImageElement::parseAttribute):
+ Call selectImageSource when attributes change.
+
+ (WebCore::HTMLImageElement::insertedInto):
+ If inserted into a picture element, make sure to update the source.
+
+ * html/HTMLImageElement.h:
+ (WebCore::HTMLImageElement::currentSrc):
+ Remove the CURRENT_SRC ifdef.
+
+ * html/HTMLImageElement.idl:
+ Remove the CURRENT_SRC ifdef.
+
+ * html/HTMLPictureElement.cpp: Added.
+ (WebCore::HTMLPictureElement::HTMLPictureElement):
+ (WebCore::HTMLPictureElement::create):
+ (WebCore::HTMLPictureElement::sourcesChanged):
+ * html/HTMLPictureElement.h: Added.
+ The new picture element. Has a sourcesChanged() function that is invoked whenever anything
+ about the <source> elements changes.
+
+ * html/HTMLSourceElement.cpp:
+ (WebCore::HTMLSourceElement::insertedInto):
+ (WebCore::HTMLSourceElement::removedFrom):
+ (WebCore::HTMLSourceElement::parseAttribute):
+ Make sure to call sourcesChanged when new sources come and go or when attributes on
+ source elements change.
+
+ * html/HTMLSourceElement.h:
+ Added parseAttribute function so we can see when attributes change that force us to
+ do a dynamic update.
+
+ * html/HTMLTagNames.in:
+ Add the picture element.
+
+ * html/parser/HTMLSrcsetParser.h:
+ (WebCore::ImageCandidate::srcOrigin):
+ (WebCore::ImageCandidate::isEmpty):
+ Some helpers for picture parsing.
+
+2015-12-05 Babak Shafiei <[email protected]>
+
Merge r191252.
2015-10-17 David Hyatt <[email protected]>
Modified: branches/safari-601.1.46-branch/Source/WebCore/DerivedSources.make (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/DerivedSources.make 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/DerivedSources.make 2015-12-06 07:11:59 UTC (rev 193565)
@@ -393,6 +393,7 @@
$(WebCore)/html/HTMLOutputElement.idl \
$(WebCore)/html/HTMLParagraphElement.idl \
$(WebCore)/html/HTMLParamElement.idl \
+ $(WebCore)/html/HTMLPictureElement.idl \
$(WebCore)/html/HTMLPreElement.idl \
$(WebCore)/html/HTMLProgressElement.idl \
$(WebCore)/html/HTMLQuoteElement.idl \
Modified: branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-12-06 07:11:59 UTC (rev 193565)
@@ -5244,6 +5244,8 @@
BC3BE9AB0E9C242000835588 /* RenderScrollbarPart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3BE9AA0E9C242000835588 /* RenderScrollbarPart.cpp */; };
BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */; };
BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */; };
+ BC3D85BB1C0E2E7700D3B610 /* JSHTMLPictureElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC808B121C0E2B350066FD6B /* JSHTMLPictureElement.cpp */; settings = {ASSET_TAGS = (); }; };
+ BC3D85BC1C0E2E7A00D3B610 /* JSHTMLPictureElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC808B131C0E2B350066FD6B /* JSHTMLPictureElement.h */; settings = {ASSET_TAGS = (); }; };
BC4368E80C226E32005EFB5F /* Rect.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4368E70C226E32005EFB5F /* Rect.h */; };
BC46C1EE0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */; };
BC46C1FA0C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F00C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp */; };
@@ -5485,6 +5487,8 @@
BCC065880F3CE2A700CD2D87 /* JSClientRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC065840F3CE2A700CD2D87 /* JSClientRect.h */; };
BCC065890F3CE2A700CD2D87 /* JSClientRectList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC065850F3CE2A700CD2D87 /* JSClientRectList.cpp */; };
BCC0658A0F3CE2A700CD2D87 /* JSClientRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC065860F3CE2A700CD2D87 /* JSClientRectList.h */; };
+ BCC0E8751BFE70E9008F7F50 /* HTMLPictureElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC0E8731BFE70E9008F7F50 /* HTMLPictureElement.cpp */; settings = {ASSET_TAGS = (); }; };
+ BCC0E8761BFE70E9008F7F50 /* HTMLPictureElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC0E8741BFE70E9008F7F50 /* HTMLPictureElement.h */; settings = {ASSET_TAGS = (); }; };
BCC438780E886CC700533DD5 /* JSHTMLInputElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC438770E886CC700533DD5 /* JSHTMLInputElementCustom.cpp */; };
BCC573350D695BBE006EF517 /* DOMProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC573330D695BBE006EF517 /* DOMProgressEvent.h */; };
BCC573360D695BBE006EF517 /* DOMProgressEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC573340D695BBE006EF517 /* DOMProgressEvent.mm */; };
@@ -12957,6 +12961,9 @@
BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveNodeList.h; sourceTree = "<group>"; };
BC7FA62B0D1F0EFF00DB22A9 /* StaticNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticNodeList.h; sourceTree = "<group>"; };
BC7FA62C0D1F0EFF00DB22A9 /* StaticNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticNodeList.cpp; sourceTree = "<group>"; };
+ BC808B111C0E23AC0066FD6B /* HTMLPictureElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLPictureElement.idl; sourceTree = "<group>"; };
+ BC808B121C0E2B350066FD6B /* JSHTMLPictureElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLPictureElement.cpp; sourceTree = "<group>"; };
+ BC808B131C0E2B350066FD6B /* JSHTMLPictureElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLPictureElement.h; sourceTree = "<group>"; };
BC80C9850CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSTimingFunctionValue.cpp; sourceTree = "<group>"; };
BC80C9860CD294EE00A0B7B3 /* CSSTimingFunctionValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSTimingFunctionValue.h; sourceTree = "<group>"; };
BC8243250D0CE8A200460C8F /* JSSQLError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLError.h; sourceTree = "<group>"; };
@@ -13069,6 +13076,8 @@
BCC065840F3CE2A700CD2D87 /* JSClientRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClientRect.h; sourceTree = "<group>"; };
BCC065850F3CE2A700CD2D87 /* JSClientRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClientRectList.cpp; sourceTree = "<group>"; };
BCC065860F3CE2A700CD2D87 /* JSClientRectList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClientRectList.h; sourceTree = "<group>"; };
+ BCC0E8731BFE70E9008F7F50 /* HTMLPictureElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLPictureElement.cpp; sourceTree = "<group>"; };
+ BCC0E8741BFE70E9008F7F50 /* HTMLPictureElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLPictureElement.h; sourceTree = "<group>"; };
BCC438770E886CC700533DD5 /* JSHTMLInputElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLInputElementCustom.cpp; sourceTree = "<group>"; };
BCC573330D695BBE006EF517 /* DOMProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMProgressEvent.h; sourceTree = "<group>"; };
BCC573340D695BBE006EF517 /* DOMProgressEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMProgressEvent.mm; sourceTree = "<group>"; };
@@ -18353,6 +18362,9 @@
A8EA7CA20A192B9C00A8EF5F /* HTMLPreElement.h */,
1AE2AB850A1CE85000B42B25 /* HTMLPreElement.idl */,
A43BF5961149290A00C643CA /* HTMLProgressElement.cpp */,
+ BCC0E8731BFE70E9008F7F50 /* HTMLPictureElement.cpp */,
+ BCC0E8741BFE70E9008F7F50 /* HTMLPictureElement.h */,
+ BC808B111C0E23AC0066FD6B /* HTMLPictureElement.idl */,
A43BF5971149290A00C643CA /* HTMLProgressElement.h */,
A4226EA51163D84D008B8397 /* HTMLProgressElement.idl */,
A8CFF79B0A156978000A4234 /* HTMLQuoteElement.cpp */,
@@ -19299,6 +19311,8 @@
1AE2AB9F0A1CE90500B42B25 /* JSHTMLParagraphElement.h */,
1AE2ABA00A1CE90500B42B25 /* JSHTMLParamElement.cpp */,
1AE2ABA10A1CE90500B42B25 /* JSHTMLParamElement.h */,
+ BC808B121C0E2B350066FD6B /* JSHTMLPictureElement.cpp */,
+ BC808B131C0E2B350066FD6B /* JSHTMLPictureElement.h */,
1AE2ABA20A1CE90500B42B25 /* JSHTMLPreElement.cpp */,
1AE2ABA30A1CE90500B42B25 /* JSHTMLPreElement.h */,
A4226E591163D667008B8397 /* JSHTMLProgressElement.cpp */,
@@ -25993,6 +26007,7 @@
D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
C90843D01B18E47D00B68564 /* MediaRemoteControls.h in Headers */,
+ BC3D85BC1C0E2E7A00D3B610 /* JSHTMLPictureElement.h in Headers */,
CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */,
@@ -26266,6 +26281,7 @@
C0F2A44113869AAB0066C534 /* preprocessor.pm in Headers */,
B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */,
A8EA7EBC0A1945D000A8EF5F /* ProcessingInstruction.h in Headers */,
+ BCC0E8761BFE70E9008F7F50 /* HTMLPictureElement.h in Headers */,
E44613EC0CD681B500FADA75 /* ProgressEvent.h in Headers */,
A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */,
1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */,
@@ -28247,6 +28263,7 @@
85183B450AA6926100F19FA3 /* DOMHTMLHeadingElement.mm in Sources */,
85ECBEF20AA7626900544F0B /* DOMHTMLHRElement.mm in Sources */,
85992EBD0AA5069500AC0785 /* DOMHTMLHtmlElement.mm in Sources */,
+ BC3D85BB1C0E2E7700D3B610 /* JSHTMLPictureElement.cpp in Sources */,
85DF819A0AA77E4B00486AD7 /* DOMHTMLIFrameElement.mm in Sources */,
85DF812A0AA7787200486AD7 /* DOMHTMLImageElement.mm in Sources */,
85F32AED0AA63B8700FF3184 /* DOMHTMLInputElement.mm in Sources */,
@@ -28987,6 +29004,7 @@
1AE2AA220A1CDAB400B42B25 /* JSHTMLBodyElement.cpp in Sources */,
1AE2AA240A1CDAB400B42B25 /* JSHTMLBRElement.cpp in Sources */,
A80E7EA00A1A83E3007FB8C5 /* JSHTMLButtonElement.cpp in Sources */,
+ BCC0E8751BFE70E9008F7F50 /* HTMLPictureElement.cpp in Sources */,
938E666009F09B81008A48EC /* JSHTMLCanvasElement.cpp in Sources */,
9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */,
BCCBAD400C18C14200CE890F /* JSHTMLCollection.cpp in Sources */,
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.cpp 2015-12-06 07:11:59 UTC (rev 193565)
@@ -32,7 +32,11 @@
#include "HTMLDocument.h"
#include "HTMLFormElement.h"
#include "HTMLParserIdioms.h"
+#include "HTMLSourceElement.h"
#include "HTMLSrcsetParser.h"
+#include "MIMETypeRegistry.h"
+#include "MediaList.h"
+#include "MediaQueryEvaluator.h"
#include "Page.h"
#include "RenderImage.h"
#include "Settings.h"
@@ -136,17 +140,61 @@
downcast<RenderImage>(*renderer()).setImageDevicePixelRatio(m_imageDevicePixelRatio);
}
+ImageCandidate HTMLImageElement::bestFitSourceFromPictureElement()
+{
+ auto* parent = parentNode();
+ if (!is<HTMLPictureElement>(parent))
+ return { };
+ for (Node* child = parent->firstChild(); child && child != this; child = child->nextSibling()) {
+ if (!is<HTMLSourceElement>(*child))
+ continue;
+ auto& source = downcast<HTMLSourceElement>(*child);
+ auto& srcset = source.fastGetAttribute(srcsetAttr);
+ if (srcset.isEmpty())
+ continue;
+ if (source.hasAttribute(typeAttr)) {
+ String type = source.fastGetAttribute(typeAttr).string();
+ int indexOfSemicolon = type.find(';');
+ if (indexOfSemicolon >= 0)
+ type.truncate(indexOfSemicolon);
+ type = stripLeadingAndTrailingHTMLSpaces(type);
+ type = type.lower();
+ if (!type.isEmpty() && !MIMETypeRegistry::isSupportedImageMIMEType(type) && type != "image/svg+xml")
+ continue;
+ }
+ MediaQueryEvaluator evaluator(document().printing() ? "print" : "screen", document().frame(), computedStyle());
+ if (!evaluator.eval(MediaQuerySet::createAllowingDescriptionSyntax(source.media()).ptr()))
+ continue;
+
+ float sourceSize = parseSizesAttribute(source.fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
+ ImageCandidate candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), nullAtom, source.fastGetAttribute(srcsetAttr), sourceSize);
+ if (!candidate.isEmpty())
+ return candidate;
+ }
+ return { };
+}
+
+void HTMLImageElement::selectImageSource()
+{
+ // First look for the best fit source from our <picture> parent if we have one.
+ ImageCandidate candidate = bestFitSourceFromPictureElement();
+ if (candidate.isEmpty()) {
+ // If we don't have a <picture> or didn't find a source, then we use our own attributes.
+ float sourceSize = parseSizesAttribute(fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
+ candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr), sourceSize);
+ }
+ setBestFitURLAndDPRFromImageCandidate(candidate);
+ m_imageLoader.updateFromElementIgnoringPreviousError();
+}
+
void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == altAttr) {
if (is<RenderImage>(renderer()))
downcast<RenderImage>(*renderer()).updateAltText();
- } else if (name == srcAttr || name == srcsetAttr) {
- float sourceSize = parseSizesAttribute(fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
- ImageCandidate candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr), sourceSize);
- setBestFitURLAndDPRFromImageCandidate(candidate);
- m_imageLoader.updateFromElementIgnoringPreviousError();
- } else if (name == usemapAttr) {
+ } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr)
+ selectImageSource();
+ else if (name == usemapAttr) {
if (inDocument() && !m_lowercasedUsemap.isNull())
document().removeImageElementByLowercasedUsemap(*m_lowercasedUsemap.impl(), *this);
@@ -255,7 +303,10 @@
if (insertionPoint.inDocument() && !m_lowercasedUsemap.isNull())
document().addImageElementByLowercasedUsemap(*m_lowercasedUsemap.impl(), *this);
-
+
+ if (is<HTMLPictureElement>(parentNode()))
+ selectImageSource();
+
// If we have been inserted from a renderer-less document,
// our loader may have not fetched the image, so do it now.
if (insertionPoint.inDocument() && !m_imageLoader.image())
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.h (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.h 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLImageElement.h 2015-12-06 07:11:59 UTC (rev 193565)
@@ -122,6 +122,10 @@
virtual HTMLImageElement& asHTMLElement() override final { return *this; }
virtual const HTMLImageElement& asHTMLElement() const override final { return *this; }
+ void selectImageSource();
+
+ ImageCandidate bestFitSourceFromPictureElement();
+
HTMLImageLoader m_imageLoader;
HTMLFormElement* m_form;
CompositeOperator m_compositeOperator;
@@ -141,6 +145,8 @@
bool hasImageControls() const;
virtual bool childShouldCreateRenderer(const Node&) const override;
#endif
+
+ friend class HTMLPictureElement;
};
} //namespace
Copied: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp (from rev 193533, branches/safari-601-branch/Source/WebCore/html/HTMLPictureElement.cpp) (0 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.cpp 2015-12-06 07:11:59 UTC (rev 193565)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTMLPictureElement.h"
+
+#include "ElementChildIterator.h"
+#include "HTMLImageElement.h"
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+HTMLPictureElement::HTMLPictureElement(const QualifiedName& tagName, Document& document)
+ : HTMLElement(tagName, document)
+{
+}
+
+Ref<HTMLPictureElement> HTMLPictureElement::create(const QualifiedName& tagName, Document& document)
+{
+ return adoptRef(*new HTMLPictureElement(tagName, document));
+}
+
+void HTMLPictureElement::sourcesChanged()
+{
+ for (auto& imageElement : childrenOfType<HTMLImageElement>(*this))
+ imageElement.selectImageSource();
+}
+
+}
+
Copied: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h (from rev 193533, branches/safari-601-branch/Source/WebCore/html/HTMLPictureElement.h) (0 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.h 2015-12-06 07:11:59 UTC (rev 193565)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HTMLPictureElement_h
+#define HTMLPictureElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLPictureElement final : public HTMLElement {
+public:
+ static Ref<HTMLPictureElement> create(const QualifiedName&, Document&);
+
+ void sourcesChanged();
+
+private:
+ HTMLPictureElement(const QualifiedName&, Document&);
+};
+
+} // namespace WebCore
+
+#endif // HTMLPictureElement_h
Copied: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.idl (from rev 193533, branches/safari-601-branch/Source/WebCore/html/HTMLPictureElement.idl) (0 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.idl (rev 0)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLPictureElement.idl 2015-12-06 07:11:59 UTC (rev 193565)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+interface HTMLPictureElement : HTMLElement {
+};
+
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.cpp 2015-12-06 07:11:59 UTC (rev 193565)
@@ -24,7 +24,6 @@
*/
#include "config.h"
-#if ENABLE(VIDEO)
#include "HTMLSourceElement.h"
#include "Event.h"
@@ -32,6 +31,7 @@
#include "HTMLDocument.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
+#include "HTMLPictureElement.h"
#include "Logging.h"
namespace WebCore {
@@ -58,8 +58,12 @@
{
HTMLElement::insertedInto(insertionPoint);
Element* parent = parentElement();
- if (is<HTMLMediaElement>(parent))
- downcast<HTMLMediaElement>(*parent).sourceWasAdded(this);
+ if (parent) {
+ if (is<HTMLMediaElement>(*parent))
+ downcast<HTMLMediaElement>(*parent).sourceWasAdded(this);
+ else if (is<HTMLPictureElement>(*parent))
+ downcast<HTMLPictureElement>(*parent).sourcesChanged();
+ }
return InsertionDone;
}
@@ -68,8 +72,12 @@
Element* parent = parentElement();
if (!parent && is<Element>(removalRoot))
parent = &downcast<Element>(removalRoot);
- if (is<HTMLMediaElement>(parent))
- downcast<HTMLMediaElement>(*parent).sourceWasRemoved(this);
+ if (parent) {
+ if (is<HTMLMediaElement>(*parent))
+ downcast<HTMLMediaElement>(*parent).sourceWasRemoved(this);
+ else if (is<HTMLPictureElement>(*parent))
+ downcast<HTMLPictureElement>(*parent).sourcesChanged();
+ }
HTMLElement::removedFrom(removalRoot);
}
@@ -155,6 +163,15 @@
cancelPendingErrorEvent();
}
+void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
+{
+ HTMLElement::parseAttribute(name, value);
+ if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
+ auto* parent = parentNode();
+ if (is<HTMLPictureElement>(parent))
+ downcast<HTMLPictureElement>(*parent).sourcesChanged();
+ }
}
-#endif
+}
+
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLSourceElement.h 2015-12-06 07:11:59 UTC (rev 193565)
@@ -26,7 +26,6 @@
#ifndef HTMLSourceElement_h
#define HTMLSourceElement_h
-#if ENABLE(VIDEO)
#include "HTMLElement.h"
#include "Timer.h"
@@ -59,6 +58,8 @@
void resume() override;
void stop() override;
+ void parseAttribute(const QualifiedName&, const AtomicString&) override;
+
void errorEventTimerFired();
Timer m_errorEventTimer;
@@ -68,4 +69,4 @@
} //namespace
#endif
-#endif
+
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/HTMLTagNames.in (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/HTMLTagNames.in 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/HTMLTagNames.in 2015-12-06 07:11:59 UTC (rev 193565)
@@ -97,6 +97,7 @@
output constructorNeedsFormElement
p interfaceName=HTMLParagraphElement
param
+picture interfaceName=HTMLPictureElement
plaintext interfaceName=HTMLElement
pre
progress interfaceName=HTMLProgressElement
@@ -112,7 +113,7 @@
section interfaceName=HTMLElement
select constructorNeedsFormElement
small interfaceName=HTMLElement
-source wrapperOnlyIfMediaIsAvailable, conditional=VIDEO
+source
span
strike interfaceName=HTMLElement
strong interfaceName=HTMLElement
Modified: branches/safari-601.1.46-branch/Source/WebCore/html/parser/HTMLSrcsetParser.h (193564 => 193565)
--- branches/safari-601.1.46-branch/Source/WebCore/html/parser/HTMLSrcsetParser.h 2015-12-06 07:09:52 UTC (rev 193564)
+++ branches/safari-601.1.46-branch/Source/WebCore/html/parser/HTMLSrcsetParser.h 2015-12-06 07:11:59 UTC (rev 193565)
@@ -91,6 +91,11 @@
{
return (originAttribute == SrcOrigin);
}
+
+ bool isEmpty() const
+ {
+ return string.isEmpty();
+ }
StringView string;
float density;